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