tomzx/ditto

Specification-oriented BDD helpers for PHPUnit
1,795 2
Install
composer require tomzx/ditto
Latest Version:v0.2.0
PHP:>=5.4
Laravel:4 · 5
License:MIT
Last Updated:Mar 11, 2021
Links: GitHub  ·  Packagist
Maintainer: tomzx

Ditto

License Latest Stable Version Latest Unstable Version Build Status Code Quality Code Coverage Total Downloads

What is Ditto?

Ditto is a simple wrapper around PHPUnit assertions which allows developers to use a syntax similar to the one provided by phpspec matchers. With it, you can replace your calls to assertSame, assertEquals and assertInstanceOf.

Usage

use Ditto\Ditto as d;

// Before PHP 5.5
$ditto = d::make('SomeClass');
// As of PHP 5.5
$ditto = d::make(SomeClass::class);

$ditto->someMethod()->shouldReturn('some value');

// ===
$ditto->someMethod()->shouldReturn('some value');
$ditto->someMethod()->shouldBe('some value');
$ditto->someMethod()->shouldEqual('some value');
$ditto->someMethod()->shouldBeEqualTo('some value');

// ==
$ditto->someMethod()->shouldBeLike('some value');

// instanceof
$ditto->someMethod()->shouldHaveType('SomeType');
$ditto->someMethod()->shouldReturnAnInstanceOf('SomeType');
$ditto->someMethod()->shouldBeAnInstance('SomeType');
$ditto->someMethod()->shouldImplement('SomeType');

// It also works on intrinsic values
$ditto = d::make('this is nice');
$ditto->shouldReturn('this is nice');

$ditto = d::make(15);
$ditto->shouldBe(15);

Contributing to Ditto

All issues and pull requests should be filed on the tomzx/ditto repository.

License

The code is licensed under the MIT license. See LICENSE.

Related Packages

padosoft/laravel-test

laravel test

520 0
unisharp/laravel-swagger-testcase

Laravel File API - Handle Files with Laravel Storage

18 0
hughsaffar/laravel-test-trap

Laravel Test Trap

406,761 18
postcon/bootstrap-extension

A Behat Extension that allows custom bootstrapping

139,127 5
baijunyao/laravel-test-support

Laravel Test Support

20,473 1

Version History

Version Released PHP Laravel License
v0.2.0 >=5.4 ~4.2|~5.0 MIT
v0.1.0 >=5.4 ~4.2 MIT