Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 059c4bb

Browse filesBrowse files
committed
Merge branch '5.0'
* 5.0: [Testing] Fixed the description of assertSelectorTextContains()
2 parents e9d8a21 + fac3a25 commit 059c4bb
Copy full SHA for 059c4bb

File tree

1 file changed

+4
-12
lines changed
Filter options

1 file changed

+4
-12
lines changed

‎testing.rst

Copy file name to clipboardExpand all lines: testing.rst
+4-12Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -212,22 +212,14 @@ Now you can use CSS selectors with the crawler. To assert that the phrase
212212

213213
$this->assertSelectorTextContains('html h1.title', 'Hello World');
214214

215-
This assertion will internally call ``$crawler->filter('html h1.title')``, which allows
216-
you to use CSS selectors to filter any HTML element in the page and check for
217-
its existence, attributes, text, etc.
215+
This assertion checks if the first element matching the CSS selector contains
216+
the given text. This asserts calls ``$crawler->filter('html h1.title')``
217+
internally, which allows you to use CSS selectors to filter any HTML element in
218+
the page and check for its existence, attributes, text, etc.
218219

219220
The ``assertSelectorTextContains`` method is not a native PHPUnit assertion and is
220221
available thanks to the ``WebTestCase`` class.
221222

222-
.. seealso::
223-
224-
Using native PHPUnit methods, the same assertion would look like this::
225-
226-
$this->assertGreaterThan(
227-
0,
228-
$crawler->filter('html h1.title:contains("Hello World")')->count()
229-
);
230-
231223
The crawler can also be used to interact with the page. Click on a link by first
232224
selecting it with the crawler using either an XPath expression or a CSS selector,
233225
then use the client to click on it::

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.