Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use message argument for PHPunit assert() functions #6736

Merged
merged 2 commits into from
Jul 9, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions book/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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());
Expand Down