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); }
/** * Unsets a position in the ArrayAccess object * * @param string|integer $key */ public function offsetUnset($key) { $this->object->offsetUnset($key); }
function it_ignores_any_other_exception(Subject $subject, WrappedObject $wrapped) { $subject->callOnWrappedObject('getWrappedObject', array())->willThrow('\\Exception'); $wrapped->getClassName()->willReturn('\\stdClass'); $this->shouldNotThrow('\\Exception')->duringMatch('be', $subject, array(), $wrapped); }