Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

SpecBDD with phpspec

If you want to do spec BDD in PHP phpspec is your guy. These are the slides I've used for an internal presentation of the tool @ ideato.

This was part of a regular series called "ideato pills"

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all
  • Be the first to comment

  • Be the first to like this

SpecBDD with phpspec

  1. 1. SpecBDD with phpspec Tassi Francesco
  2. 2. A php toolset to drive emergent design by specification. http://www.phpspec.net/
  3. 3. It helps you with boring stuff
  4. 4. New classes… boOoOred
  5. 5. Constructor… boOoOred
  6. 6. New methods… boOoOred
  7. 7. Syntax just make sense
  8. 8. Obvious SUT You’re testing just one class, no need to instantiate it. ! $this is your SUT
  9. 9. Natural language The method your testing
  10. 10. Natural language What it should be doing -> shouldBe -> shouldEqual -> shouldBeEqualTo -> shouldBeLike -> shouldThrow
  11. 11. Constructor args let our SUT be constructed with …
  12. 12. Easy mocking All you need to define a mock is add it as an argument of your spec
  13. 13. Easy mocking A method with some arguments should be called during the test
  14. 14. Easy mocking A method will return some value.
  15. 15. Easy mocking Same instance. Of course, they have the same name and the same type after all
  16. 16. There’s more magic to come
  17. 17. Templates Configuration Matchers ! Formatters
  18. 18. Let’s go see the prophet https://github.com/phpspec/prophecy
  19. 19. Prophet Prophecy is a highly opinionated yet very powerful and flexible PHP object mocking framework. Though initially it was created to fulfil phpspec2 needs, it is flexible enough to be used inside any testing framework out there with minimal effort. Use it !

×