SpecBDD in PHP

10,636 views
9,579 views

Published on

SPUG Meetup #4 13/06/2013
http://spug.pl/

Published in: Technology
2 Comments
26 Likes
Statistics
Notes
No Downloads
Views
Total views
10,636
On SlideShare
0
From Embeds
0
Number of Embeds
384
Actions
Shares
0
Downloads
71
Comments
2
Likes
26
Embeds 0
No embeds

No notes for slide

SpecBDD in PHP

  1. SPEC BDDIN PHP@cakper
  2. 13/06/13 GliwiceSpec BDD IN PHPSoftware Engineer @SensioLabsUKSilesia PHP User Group // Spug.pl#symfony-pl // Symfonylab.pl@CAKPER
  3. 13/06/13 GliwiceSpec BDD IN PHPWHAT IS TEST?
  4. 13/06/13 GliwiceSpec BDD IN PHPWHY DO WE TEST?
  5. 13/06/13 GliwiceSpec BDD IN PHPHOW DO WE TEST?
  6. 13/06/13 GliwiceSpec BDD IN PHPWE MAKE MISTAKESSO WE HAVE TO TEST
  7. 13/06/13 GliwiceSpec BDD IN PHPTESTDRIVENDEVELOPMENTKent Beck // 2003Extreme Programming // 1999
  8. 13/06/13 GliwiceSpec BDD IN PHPPROBLEM #1How to test something thatdoes not exist?
  9. 13/06/13 GliwiceSpec BDD IN PHPPROBLEM #1TEST == SpecificationDrivenDevelopment
  10. 13/06/13 GliwiceSpec BDD IN PHPPROBLEM #1Communicationis our ProblemNot testing itself
  11. 13/06/13 GliwiceSpec BDD IN PHPBEHAVIOURDRIVENDEVELOPMENTDan North // 2006
  12. 13/06/13 GliwiceSpec BDD IN PHPBDDNamingConvenTionstoolsBetter{
  13. 13/06/13 GliwiceSpec BDD IN PHPBDD= TDD v2.0‘TDD DONE RIGHT’
  14. 13/06/13 GliwiceSpec BDD IN PHPPROBLEM #2Writing specificationstakes timeTime is a cost
  15. 13/06/13 GliwiceSpec BDD IN PHPyou can learn it
  16. 13/06/13 GliwiceSpec BDD IN PHPDELIBERATE PRACTICEPair ProgrammingCode KataCode ClubCode Retreat
  17. 13/06/13 GliwiceSpec BDD IN PHPPROBLEM #3Why are you sure that yourtest is correct?
  18. 13/06/13 GliwiceSpec BDD IN PHPTDD CYCLEREDGREENREFACTOR
  19. 13/06/13 GliwiceSpec BDD IN PHP3 LAWS OF TDD1.You are not allowed to write any productioncode unless it is to make a failing unit test pass.2.You are not allowed to write any more of a unittest than is sufficient to fail; and compilationfailures are failures.3.You are not allowed to write any moreproduction code than is sufficient to pass the onefailing unit test.
  20. 13/06/13 GliwiceSpec BDD IN PHPPROBLEM #4When and how to Refactor?
  21. 13/06/13 GliwiceSpec BDD IN PHP‘Refactoring w/o tests= Refucktoring’PROBLEM #4
  22. 13/06/13 GliwiceSpec BDD IN PHP4 RULES OF SIMPLE DESING1.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.
  23. 13/06/13 GliwiceSpec BDD IN PHPPROBLEM #5How to test dependencies?
  24. 13/06/13 GliwiceSpec BDD IN PHPDO NOT TEST...
  25. 13/06/13 GliwiceSpec BDD IN PHPTEST DOUBLESDUMMiesSTUBSMOCKSSPIES
  26. 13/06/13 GliwiceSpec BDD IN PHPMocking should be easyvery easy
  27. 13/06/13 GliwiceSpec BDD IN PHPPROBLEM #6Code Coverage
  28. 13/06/13 GliwiceSpec BDD IN PHPPROBLEM #6Useful tofind dead code ;)
  29. 13/06/13 GliwiceSpec BDD IN PHPPROBLEM #7STORY BDDvsSpec BDD
  30. 13/06/13 GliwiceSpec BDD IN PHPSTORY BDDdescription ofbusiness-targetedapplication behavior
  31. 13/06/13 GliwiceSpec BDD IN PHPSPEC BDDspecification forlow-level implementation
  32. 13/06/13 GliwiceSpec BDD IN PHPPROBLEM #8PHP UNITBy Sebastian Bergmann©
  33. 13/06/13 GliwiceSpec BDD IN PHPPHP Spec 2
  34. 13/06/13 GliwiceSpec BDD IN PHPPHP SPEC 2Framework Spec BDD@_md & @everzetProphecy
  35. 13/06/13 GliwiceSpec BDD IN PHPPHP SPEC 2EASY to useTDD-Cycle orientedBehaviour focused
  36. 13/06/13 GliwiceSpec BDD IN PHPPHP SPEC 2Test CaseSpecification
  37. 13/06/13 GliwiceSpec BDD IN PHPPHP SPEC 2Testexample
  38. 13/06/13 GliwiceSpec BDD IN PHPPHP SPEC 2AssertExpectation
  39. 13/06/13 GliwiceSpec BDD IN PHPPHP SPEC 2class MarkdownSpec extends ObjectBehavior{function it_is_initializable(){$this->shouldHaveType(Markdown);}}
  40. 13/06/13 GliwiceSpec BDD IN PHPMATCHERSIdentity (===):shouldReturn()shouldBe()shouldEqual()shouldBeEqualTo()
  41. 13/06/13 GliwiceSpec BDD IN PHPMATCHERSComparison (==):shouldBeLike()
  42. 13/06/13 GliwiceSpec BDD IN PHPMATCHERSThrow:shouldThrow(‘Exception’)->duringSomeMethod()
  43. 13/06/13 GliwiceSpec BDD IN PHPMATCHERSType:shouldBeAnInstanceOf()shouldReturnAnInstanceOf()shouldHaveType()
  44. 13/06/13 GliwiceSpec BDD IN PHPMATCHERSObject State:shouldHave**()
  45. 13/06/13 GliwiceSpec BDD IN PHPTEST DOUBLES/*** @param MarkdownStream $stream*/function it_adds_a_end_of_list_to_markup($stream){$stream->getNextLine()->willReturn("");$this->format(" * Hi, there", $stream)->shouldReturn("</li></ul>");}
  46. 13/06/13 GliwiceSpec BDD IN PHPLET & LETGOfunction let($die){$die->beADoubleOf(Die);$this->beConstructedWith($die);}function it_live_and_let_die($die){$this->liveAndLet()->shouldReturn($die);}function letgo(){}
  47. 13/06/13 GliwiceSpec BDD IN PHPPHP SPEC 2{"require-dev": {"phpspec/phpspec": "2.0.*@dev"},"config": {"bin-dir": "bin"},"autoload": {"psr-0": {"": "src"}}}
  48. 13/06/13 GliwiceSpec BDD IN PHPDemo
  49. 13/06/13 GliwiceSpec BDD IN PHPQuestions?
  50. 13/06/13 GliwiceSpec BDD IN PHPWE ARE HIRING!Software EngineerFront-end EngineerSoftware Engineer in testPRoject managerBusiness analystwww.sensiolabs.co.ukwww.inviqa.com
  51. THANK YOU!@cakper

×