Skip to content

Commit 4cf3fe4

Browse files
committed
docs: improve descritpion on see*() method
They are not assertions.
1 parent 818ac96 commit 4cf3fe4

7 files changed

Lines changed: 56 additions & 16 deletions

File tree

user_guide_src/source/testing/response.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ are useful for using within assertions in your tests.
178178
see()
179179
-----
180180

181-
The ``see()`` method checks the text on the page to see if it exists either by itself, or more specifically within
181+
Returns a boolean true/false based on whether the text on the page exists either
182+
by itself, or more specifically within
182183
a tag, as specified by type, class, or id:
183184

184185
.. literalinclude:: response/018.php
Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
<?php
22

33
// Check that "Hello World" is on the page
4-
$results->see('Hello World');
4+
if ($results->see('Hello World')) {
5+
// ...
6+
}
7+
58
// Check that "Hello World" is within an h1 tag
6-
$results->see('Hello World', 'h1');
9+
if ($results->see('Hello World', 'h1')) {
10+
// ...
11+
}
12+
713
// Check that "Hello World" is within an element with the "notice" class
8-
$results->see('Hello World', '.notice');
14+
if ($results->see('Hello World', '.notice')) {
15+
// ...
16+
}
17+
918
// Check that "Hello World" is within an element with id of "title"
10-
$results->see('Hello World', '#title');
19+
if ($results->see('Hello World', '#title')) {
20+
// ...
21+
}
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<?php
22

33
// Checks that "Hello World" does NOT exist on the page
4-
$results->dontSee('Hello World');
4+
if ($results->dontSee('Hello World')) {
5+
// ...
6+
}
7+
58
// Checks that "Hellow World" does NOT exist within any h1 tag
6-
$results->dontSee('Hello World', 'h1');
9+
if ($results->dontSee('Hello World', 'h1')) {
10+
// ...
11+
}
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
<?php
22

33
// Check that an element with class 'notice' exists
4-
$results->seeElement('.notice');
4+
if ($results->seeElement('.notice')) {
5+
// ...
6+
}
7+
58
// Check that an element with id 'title' exists
6-
$results->seeElement('#title');
9+
if ($results->seeElement('#title')) {
10+
// ...
11+
}
12+
713
// Verify that an element with id 'title' does NOT exist
8-
$results->dontSeeElement('#title');
14+
if ($results->dontSeeElement('#title')) {
15+
// ...
16+
}
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<?php
22

33
// Check that a link exists with 'Upgrade Account' as the text::
4-
$results->seeLink('Upgrade Account');
4+
if ($results->seeLink('Upgrade Account')) {
5+
// ...
6+
}
7+
58
// Check that a link exists with 'Upgrade Account' as the text, AND a class of 'upsell'
6-
$results->seeLink('Upgrade Account', '.upsell');
9+
if ($results->seeLink('Upgrade Account', '.upsell')) {
10+
// ...
11+
}
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<?php
22

33
// Check that an input exists named 'user' with the value 'John Snow'
4-
$results->seeInField('user', 'John Snow');
4+
if ($results->seeInField('user', 'John Snow')) {
5+
// ...
6+
}
7+
58
// Check a multi-dimensional input
6-
$results->seeInField('user[name]', 'John Snow');
9+
if ($results->seeInField('user[name]', 'John Snow')) {
10+
// ...
11+
}
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<?php
22

33
// Check if checkbox is checked with class of 'foo'
4-
$results->seeCheckboxIsChecked('.foo');
4+
if ($results->seeCheckboxIsChecked('.foo')) {
5+
// ...
6+
}
7+
58
// Check if checkbox with id of 'bar' is checked
6-
$results->seeCheckboxIsChecked('#bar');
9+
if ($results->seeCheckboxIsChecked('#bar')) {
10+
// ...
11+
}

0 commit comments

Comments
 (0)