PhpRiot
News Archive
PhpRiot Newsletter
Your Email Address:

More information

Evert Pot: phpspec2: SUS and collaborators

Note: This article was originally published at PHPDeveloper on 10 October 2012.
PHPDeveloper

Following the release of the phpspec SpecBDD tool, Evert Pot has posted this new article talking about SUSes ("Subject Under Specification") and how they relate to the functionality phpspec offers.

First of all, phpspec2 is not a testing framework. It's a SpecBDD tool. It means, testing is not our primary aim. Tool's job is to enforce and make SpecBDD in project flawless and phpspec2 uses all available methods to do that - state of the artformatters, class and method generators and lot of othe fancy buzzwords :) Today, i want to explain you the heart of phpspec2 - SUS, collaborators and prophets.

He starts off defining specifications as a list of behaviors about how an object should behave and the abilities that come with them (like "getTitle"). He shows assertions, like "shouldReturn", and how you can use Collaborators to evaluate the interfaces between objects.