@@ -13,16 +13,15 @@ When doing functional tests, sometimes you need to make complex assertions in
13
13
order to check whether the ``Request ``, the ``Response `` or the ``Crawler ``
14
14
contain the expected information to make your test succeed.
15
15
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::
17
18
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'));
22
21
23
- Now here is the example with the assertions specific to Symfony::
22
+ This is the same example using the assertions provided by Symfony::
24
23
25
- $this->assertSelectorTextContains('html ', 'Hello World' );
24
+ $this->assertResponseRedirects('https://example.com ', 301 );
26
25
27
26
.. note ::
28
27
@@ -70,9 +69,9 @@ Crawler
70
69
71
70
- ``assertSelectorExists() ``
72
71
- ``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)
76
75
- ``assertPageTitleSame() ``
77
76
- ``assertPageTitleContains() ``
78
77
- ``assertInputValueSame() ``
0 commit comments