function it_passes_the_created_subject_to_expectation(WrappedObject $wrappedObject, ExpectationFactory $expectationFactory, Expectation $expectation) { $expectation->match(Argument::cetera())->willReturn(true); $wrappedObject->getClassName()->willReturn('spec\\PhpSpec\\Wrapper\\Everything'); $expectationFactory->create(Argument::cetera())->willReturn($expectation); $this->callOnWrappedObject('shouldBeAlright'); $expectationFactory->create(Argument::any(), Argument::type('spec\\PhpSpec\\Wrapper\\Everything'), Argument::any())->shouldHaveBeenCalled(); }
/** * @param string $method * @param array $arguments * * @return mixed */ private function callExpectation($method, array $arguments) { $subject = $this->makeSureWeHaveASubject(); $expectation = $this->expectationFactory->create($method, $subject, $arguments); if (0 === strpos($method, 'shouldNot')) { return $expectation->match(lcfirst(substr($method, 9)), $this, $arguments, $this->wrappedObject); } return $expectation->match(lcfirst(substr($method, 6)), $this, $arguments, $this->wrappedObject); }