watoki / scrut
Injectable test classes for PHP.
v0.3
2015-05-12 12:48 UTC
Requires
- php: >=5.3.8
- phpunit/phpunit: 3.7.*
- watoki/factory: *
This package is not auto-updated.
Last update: 2026-02-28 22:25:27 UTC
README
Have you ever thought how nice it would be to use dependency injection in your test classes? Search no further!
scrut uses [factory] to inject it's properties. Just extend from Specification (which extends PHPUnit's TestCase)
and define its dependencies by marking injectable properties with <-.
/** * @property DependencyOne one <- * @property NotInjected not (because to arrow) */ class MyTest extends Specification { /** @var DependencyTwo <- **/ public $two; function testSomething() { $this->one->createSomeTestContext(); $this->two->doSomething(); $this->assertTrue($this->one->everythingIsCool()); } }
scrut can be used to create maintainable test suites which can also serve quite nicely as living documentation which then can be published (with dox for example).