@@ -13,16 +13,15 @@ When doing functional tests, sometimes you need to make complex assertions in
1313order to check whether the ``Request ``, the ``Response `` or the ``Crawler ``
1414contain the expected information to make your test succeed.
1515
16- Here is an example with plain PHPUnit::
16+ The following example uses plain PHPUnit to assert that the response redirects
17+ to a certain URL::
1718
18- $this->assertGreaterThan(
19- 0,
20- $crawler->filter('html:contains("Hello World")')->count()
21- );
19+ $this->assertSame(301, $client->getResponse()->getStatusCode());
20+ $this->assertSame('https://example.com', $client->getResponse()->headers->get('Location'));
2221
23- Now here is the example with the assertions specific to Symfony::
22+ This is the same example using the assertions provided by Symfony::
2423
25- $this->assertSelectorTextContains('html ', 'Hello World' );
24+ $this->assertResponseRedirects('https://example.com ', 301 );
2625
2726.. note ::
2827
@@ -70,9 +69,9 @@ Crawler
7069
7170- ``assertSelectorExists() ``
7271- ``assertSelectorNotExists() ``
73- - ``assertSelectorTextContains() ``
74- - ``assertSelectorTextSame() ``
75- - ``assertSelectorTextNotContains() ``
72+ - ``assertSelectorTextContains() `` (note: it only checks the first selector occurrence)
73+ - ``assertSelectorTextSame() `` (note: it only checks the first selector occurrence)
74+ - ``assertSelectorTextNotContains() `` (note: it only checks the first selector occurrence)
7675- ``assertPageTitleSame() ``
7776- ``assertPageTitleContains() ``
7877- ``assertInputValueSame() ``
0 commit comments