tomzx / ditto
Specification-oriented BDD helpers for PHPUnit
Installs: 1 794
Dependents: 1
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 1
Open Issues: 2
Requires
- php: >=5.4
- illuminate/container: ~4.2|~5.0
Requires (Dev)
- phpunit/phpunit: ~4.1
This package is auto-updated.
Last update: 2024-11-12 05:44:02 UTC
README
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.