The document discusses Behavior Driven Development (BDD) and testing in PHP. It introduces BDD and some common problems in testing like how to test dependencies. It then discusses tools for PHP testing like PHPUnit and PHP Spec 2. PHP Spec 2 is presented as a BDD framework for PHP that makes testing easy with matchers, test doubles and a TDD cycle approach. Examples are provided of how to write tests in PHP Spec 2.
13/06/13 GliwiceSpec BDDIN PHP
3 LAWS OF TDD
1.You are not allowed to write any production
code unless it is to make a failing unit test pass.
2.You are not allowed to write any more of a unit
test than is sufficient to fail; and compilation
failures are failures.
3.You are not allowed to write any more
production code than is sufficient to pass the one
failing unit test.
13/06/13 GliwiceSpec BDDIN PHP
4 RULES OF SIMPLE DESING
1.Passes all the tests.
2.Express every idea we need to express.
3.Contains no duplication.
4.Minimized the number of classes,
methods and other moving parts.
13/06/13 GliwiceSpec BDDIN PHP
LET & LETGO
function let($die)
{
$die->beADoubleOf('Die');
$this->beConstructedWith($die);
}
function it_live_and_let_die($die)
{
$this->liveAndLet()->shouldReturn($die);
}
function letgo(){}
13/06/13 GliwiceSpec BDDIN PHP
WE ARE HIRING!
Software Engineer
Front-end Engineer
Software Engineer in test
PRoject manager
Business analyst
www.sensiolabs.co.uk
www.inviqa.com