watoki / scrut
Injectable test classes for PHP.
Installs: 3 897
Dependents: 10
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.3.8
- phpunit/phpunit: 3.7.*
- watoki/factory: *
This package is not auto-updated.
Last update: 2024-10-26 15:49:40 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).