@@ -144,7 +144,7 @@ for its ``DemoController`` (`DemoControllerTest`_) that reads as follows::
144
144
145
145
$crawler = $client->request('GET', '/demo/hello/Fabien');
146
146
147
- $this->assertTrue( $crawler->filter('html:contains("Hello Fabien")')->count() > 0 );
147
+ $this->assertGreaterThan(0, $crawler->filter('html:contains("Hello Fabien")')->count());
148
148
}
149
149
}
150
150
@@ -210,7 +210,7 @@ that it actually does what you expect it to. Use the Crawler to make assertions
210
210
on the DOM::
211
211
212
212
// Assert that the response matches a given CSS selector.
213
- $this->assertTrue( $crawler->filter('h1')->count() > 0 );
213
+ $this->assertGreaterThan(0, $crawler->filter('h1')->count());
214
214
215
215
Or, test against the Response content directly if you just want to assert that
216
216
the content contains some text, or if the Response is not an XML/HTML
@@ -258,10 +258,10 @@ document::
258
258
useful test assertions::
259
259
260
260
// Assert that there is more than one h2 tag with the class "subtitle"
261
- $this->assertTrue( $crawler->filter('h2.subtitle')->count() > 0 );
261
+ $this->assertGreaterThan(0, $crawler->filter('h2.subtitle')->count());
262
262
263
263
// Assert that there are exactly 4 h2 tags on the page
264
- $this->assertEquals (4, $crawler->filter('h2')->count());
264
+ $this->assertCount (4, $crawler->filter('h2')->count());
265
265
266
266
// Assert the the "Content-Type" header is "application/json"
267
267
$this->assertTrue($client->getResponse()->headers->contains('Content-Type', 'application/json'));
0 commit comments