phpspec: Testing... *Designing* with a Bite


What you'll be learning

phpspec: a tool for unit testing? Sure... but, oof, it's so much cooler than that!

Yes, just like with our phpunit tutorial, when we finally launch our dinosaur park... during a hurricane... on a Friday night, we do not want all the dinosaurs to escape. But, phpspec goes one step beyond "just writing tests": it helps you think about the design of your classes first through "specifications" and "examples". And as a side-effect, yes! You get tests, code generation and, with a little bit of work, a nyan cat to tell us if our tests pass:

  • Getting phpspec set up
  • What's a specification?
  • Writing examples
  • Generating code from our specifications! Nice!
  • Understanding matchers and writing out own for custom "assertions"
  • How does phpspec fit into TDD, BDD, PHPUnit & Behat?
  • Demystifying the ObjectBehavior class
  • The red, green, refactor cycle
  • Testing exceptions
  • Prophecy & test doubles! Dummies, stubs, spies & mocks
  • The let() method for set up

Let's finally design a dinosaur park that will scale with every sequel!

Your Guides
Andrew Marcinkevičius Ryan Weaver

Buy Access

Questions? Conversation?

  • 2019-02-05 Diego Aguiar

    Hey Knayz

    We do not have plans for a Microservices tutorial at the moment but we love to know what kind of tutorials you'd like to watch. In the meanwhile, there is a talk about microservices from SymfonyCon 2018 that we will upload soon. You can check it at:


  • 2019-02-05 Knayz

    Hi, I have one little question. Do you have any plans to make course about microservices? It's really popular skill nowadays.