xSpec BDD Framework for PHP.
Strongly inspired from RSpec.
- Nested context
- Specification with string
- Expectation DSL provided by Espérance
I like both PHPUnit and PHPSpec, but I think they have common issue.
- No nested context
- Specification with camelCase or lower_case_with_underscore method name
These are very messy.
PHP Development should be more enjoyable.
I have proposal (see below) and Speciphy shows working example.
- Use function in namespace, Not method in class
Use array to build nested structure(Deprecated since 0.1.0)
More details are in below slide.
http://www.slideshare.net/taketyan/proposal-for-xspep-bdd-framework-for-php
<?php
namespace Speciphy\DSL;
return
describe('Bowling',
describe('->score',
context('all gutter game',
subject(function () {
$bowling = new Bowling;
for ($i = 1; $i <= 20; $i++) {
$bowling->hit(0);
}
return $bowling;
}),
it('should equal 0', function ($bowling) {
expect($bowling->score)->to->be(0);
})
)
)
);Yuya Takeyama

