phpspec: a tool for unit testing? Sure... but, oof, it's so much cooler than that! 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. However, phpspec goes one step beyond "just writing tests": it helps you think about the design of your classes first through "specifications" and "examples".
Why Choose phpspec?
phpspec is more than a testing tool; it's a design tool. As a side-effect of using phpspec, you get tests, code generation, and with a bit of creativity, even a nyan cat to show us if our tests pass:
Course Outline
- Getting phpspec set up: Start with installation and configuration.
- What is a Specification? Understand how specifications guide your design process.
- Writing Examples: Learn how to write effective examples that serve as tests.
- Generating Code: Automatically generate code from specifications!
- Matchers and Custom Assertions: Dive into matchers and learn how to write your own.
- phpspec, TDD, BDD, PHPUnit & Behat: Discover how phpspec fits into the testing and development landscape.
- Understanding ObjectBehavior: Unravel the mysteries of the
ObjectBehaviorclass. - The Red, Green, Refactor Cycle: Master the essential TDD cycle.
- Testing Exceptions: Learn how to handle exceptions in your tests.
- Prophecy & Test Doubles: Grasp the use of dummies, stubs, spies, and mocks.
- The let() Method for Set Up: Simplify setup with the
let()method.