diff --git a/book/testing.rst b/book/testing.rst index ddac77197a6..4e3257885e1 100644 --- a/book/testing.rst +++ b/book/testing.rst @@ -263,7 +263,8 @@ document:: $client->getResponse()->headers->contains( 'Content-Type', 'application/json' - ) + ), + 'the "Content-Type" header is "application/json"' // optional message shown on failure ); // Assert that the response content contains a string @@ -272,7 +273,7 @@ document:: $this->assertRegExp('/foo(bar)?/', $client->getResponse()->getContent()); // Assert that the response status code is 2xx - $this->assertTrue($client->getResponse()->isSuccessful()); + $this->assertTrue($client->getResponse()->isSuccessful(), 'response status is 2xx'); // Assert that the response status code is 404 $this->assertTrue($client->getResponse()->isNotFound()); // Assert a specific 200 status code @@ -283,7 +284,8 @@ document:: // Assert that the response is a redirect to /demo/contact $this->assertTrue( - $client->getResponse()->isRedirect('/demo/contact') + $client->getResponse()->isRedirect('/demo/contact'), + 'response is a redirect to /demo/contact' ); // ...or simply check that the response is a redirect to any URL $this->assertTrue($client->getResponse()->isRedirect());