function it_creates_negative_throw_expectations(MatcherManager $matchers, Matcher $matcher, Subject $subject) { $matchers->find(Argument::cetera())->willReturn($matcher); $subject->__call('getWrappedObject', array())->willReturn(new \stdClass()); $expectation = $this->create('shouldNotThrow', $subject); $expectation->shouldHaveType('PhpSpec\\Wrapper\\Subject\\Expectation\\NegativeThrow'); }
public function __call($method, array $arguments = array()) { if (preg_match('/^(to|notTo)(.+)$/', $method, $matches)) { $method = 'should' . $matches[2]; if ('notTo' === $matches[1]) { $method = 'shouldNot' . $matches[2]; } } return parent::__call($method, $arguments); }
function it_rethrows_fracture_errors_as_phpspec_error_exceptions(Subject $subject, WrappedObject $wrapped) { $subject->__call('getWrappedObject', array())->willThrow('PhpSpec\\Exception\\Fracture\\FractureException'); $this->shouldThrow('PhpSpec\\Exception\\Fracture\\FractureException')->duringMatch('be', $subject, array(), $wrapped); }