It should! - BDD in practice5. BUT THIS IS NOT ABOUT WHAT BDD MEANS
THIS IS ALL ABOUT
TOOLS
AND ...
7. MA'AM! CAN YOU TEST WHO YOU SAW?
"Whatdo you mean test?Ican describe itif you like"-Ma'am
./bin/phpspecdescSuspect
8. THE SUSPECTS
"He was one of those types, you know"-Ma'am
namespacespecOrientExpressSuspect;
usePhpSpecObjectBehavior;
useProphecyArgument;
classSuspectSpecextendsObjectBehavior
{
functionit_is_initializable()
{
$this->shouldHaveType('OrientExpressSuspectSuspect');
}
}
13. THE SUSPECTS - REFACTORING MADE EASY
"Oh, Ijustremembered!"-Ma'am
namespacespecOrientExpressSuspect;
usePhpSpecObjectBehavior;
useProphecyArgument;
classSuspectSpecextendsObjectBehavior
{
//...
functionit_should_not_confess_to_wrong_questions_if_guilty()
{
$this->setGuilty(true);
$this->answer('Areyouthekiller?')
->shouldReturn('Nope,notme');
}
}
14. THE SUSPECTS - REFACTORING MADE EASY
"Oh, Ijustremembered!"-Ma'am
namespacespecOrientExpressSuspect;
usePhpSpecObjectBehavior;
useProphecyArgument;
classSuspectSpecextendsObjectBehavior
{
//...
functionit_should_confess_to_key_question_if_guilty()
{
$this->setGuilty(true);
$this->answer('Itwasyou!')
->shouldReturn('MmmkayIconfess');
}
}
16. SIR! CAN YOU DESCRIBE WHO SOLVED IT?
./bin/phpspecdescDetective
22. DOES THE POLICE FUNCTION PROPERLY?
Feature:
Inordertoknowthecrimesonorientexpress
AsaScotlandYardAPIclient
Iwanttogetaccesstothearchives
23. DOES THE POLICE FUNCTION PROPERLY?
Background:
Giventhefollowingcrimesexist:
|name |
|"MurderontheOrientExpress"|
Andthefollowingdetectivesexist:
|name |
|"HerculsePoirot"|
Andthefollowingsuspectsexist:
|name |
|"PrincessDragomiroff"|
|"CountAdrenyi" |
26. WHY IS THIS SO IMPORTANT?
BECAUSE EVERY CODE TELLS A STORY
OR AT LEAST
IT SHOULD!