2017 © Pedro Peláez
 

library phpspec-expect

Add the expect function for BDD style assertions

image

bravesheep/phpspec-expect

Add the expect function for BDD style assertions

  • Monday, March 31, 2014
  • by rnijveld
  • Repository
  • 2 Watchers
  • 0 Stars
  • 2,055 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

phpspec expect

Adds the expect(value) function for you to your code, allowing you the same style of assertions that phpspec uses. Note that phpspec uses should[matcher] and shouldNot[matcher], where this function also allows to[matcher] and notTo[matcher] calls. For more information of matchers take a look at the phpspec documentation on matchers., (*1)

Adding custom matcher globally

By calling Bravesheep\PhpspecExpect\ContainerHolder::getInstance()->getContainer() you can modify the phpspec ServiceContainer instance. You can add extra matchers for all your tests from that point on by adding an object starting with matchers.matcher, for example:, (*2)

$container = \Bravesheep\PhpspecExpect\ContainerHolder::getInstance()->getContainer();
$container->setShared('matchers.matcher.my.custom.matcher', function (\PhpSpec\ServiceContainer $c) {
    return new My\Custom\Matcher($c->get('formatter.presenter'));
});

Note that shared objects will only be created once, whereas those added with $container->set() will be constructed again for every call made., (*3)

MatchersProviderInterface

If the object in which a call to expect(value) is made implements the PhpSpec\Matcher\MatchersProviderInterface then the matchers provided by that object are included in the available matchers., (*4)

The Versions

31/03 2014

dev-master

9999999-dev

Add the expect function for BDD style assertions

  Sources   Download

MIT

The Requires

 

by Ruben Nijveld

bdd tdd spec specbdd specification phpspec

31/03 2014

v0.1.0

0.1.0.0

Add the expect function for BDD style assertions

  Sources   Download

MIT

The Requires

 

by Ruben Nijveld

bdd tdd spec specbdd specification phpspec