Level 4
shouldBeCalled() must only be used with mocked objects and must not be used with the actual class your testing. Could you give us more context of your class and explain your intention ?
I am just starting to use PhpSpec and I seem to be running into an issue
I am testing this function
public function response(array $errors)
{
return $this->errorForbidden($errors);
}
public function errorForbidden($message = 'Forbidden')
{
return $this->setStatusCode(403)->respondWithError($message);
}
When I run this test
function it_checks_errors_returns_array_of_errors()
{
$error = ["This is an error" => "Error time!"];
$this->response($error)->shouldBeCalled();
}
it just stops half way through, see the image:
http://cl.ly/image/0K2v2r0d290l
Where as I should see something like this:
http://cl.ly/image/2X1G1e1T2N1q
There must be a simple reason why this is happening I just don't know it
Please or to participate in this conversation.