@@ -8,16 +8,15 @@ When doing functional tests, sometimes you need to make complex assertions in
88order to check whether the ``Request ``, the ``Response `` or the ``Crawler ``
99contain the expected information to make your test succeed.
1010
11- Here is an example with plain PHPUnit::
11+ The following example uses plain PHPUnit to assert that the response redirects
12+ to a certain URL::
1213
13- $this->assertGreaterThan(
14- 0,
15- $crawler->filter('html:contains("Hello World")')->count()
16- );
14+ $this->assertSame(301, $client->getResponse()->getStatusCode());
15+ $this->assertSame('https://example.com', $client->getResponse()->headers->get('Location'));
1716
18- Now here is the example with the assertions specific to Symfony::
17+ This is the same example using the assertions provided by Symfony::
1918
20- $this->assertSelectorTextContains('html ', 'Hello World' );
19+ $this->assertResponseRedirects('https://example.com ', 301 );
2120
2221.. note ::
2322
@@ -64,9 +63,9 @@ Crawler
6463
6564- ``assertSelectorExists() ``
6665- ``assertSelectorNotExists() ``
67- - ``assertSelectorTextContains() ``
68- - ``assertSelectorTextSame() ``
69- - ``assertSelectorTextNotContains() ``
66+ - ``assertSelectorTextContains() `` (note: it only checks the first selector occurrence)
67+ - ``assertSelectorTextSame() `` (note: it only checks the first selector occurrence)
68+ - ``assertSelectorTextNotContains() `` (note: it only checks the first selector occurrence)
7069- ``assertPageTitleSame() ``
7170- ``assertPageTitleContains() ``
7271- ``assertInputValueSame() ``
0 commit comments