@@ -310,22 +310,26 @@ document::
310
310
),
311
311
'the "Content-Type" header is "application/json"' // optional message shown on failure
312
312
);
313
-
313
+ //or
314
+ $this->assertResponseHeaderSame('Content-Type', 'application/json', 'the "Content-Type" header is "application/json"');
314
315
// asserts that the response content contains a string
315
316
$this->assertContains('foo', $client->getResponse()->getContent());
316
317
// ...or matches a regex
317
318
$this->assertRegExp('/foo(bar)?/', $client->getResponse()->getContent());
318
319
319
320
// asserts that the response status code is 2xx
320
321
$this->assertTrue($client->getResponse()->isSuccessful(), 'response status is 2xx');
322
+ // ...or simply
323
+ $this->assertResponseIsSuccessful('response status is 2xx');
321
324
// asserts that the response status code is 404
322
325
$this->assertTrue($client->getResponse()->isNotFound());
323
326
// asserts a specific 200 status code
324
327
$this->assertEquals(
325
328
200, // or Symfony\Component\HttpFoundation\Response::HTTP_OK
326
329
$client->getResponse()->getStatusCode()
327
330
);
328
-
331
+ //...or simply
332
+ $this->assertResponseStatusCodeSame(200);
329
333
// asserts that the response is a redirect to /demo/contact
330
334
$this->assertTrue(
331
335
$client->getResponse()->isRedirect('/demo/contact')
@@ -334,7 +338,8 @@ document::
334
338
);
335
339
// ...or simply check that the response is a redirect to any URL
336
340
$this->assertTrue($client->getResponse()->isRedirect());
337
-
341
+ // ...or simply
342
+ $this->assertResponseRedirects();
338
343
.. _testing-data-providers :
339
344
340
345
Testing against Different Sets of Data
0 commit comments