forked from codeigniter4/CodeIgniter4
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request codeigniter4#7804 from kenjis/docs-testing-respons…
…e.rst docs: improve testing/response.rst
- Loading branch information
Showing
13 changed files
with
115 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,21 @@ | ||
<?php | ||
|
||
// Check that "Hello World" is on the page | ||
$results->see('Hello World'); | ||
if ($results->see('Hello World')) { | ||
// ... | ||
} | ||
|
||
// Check that "Hello World" is within an h1 tag | ||
$results->see('Hello World', 'h1'); | ||
if ($results->see('Hello World', 'h1')) { | ||
// ... | ||
} | ||
|
||
// Check that "Hello World" is within an element with the "notice" class | ||
$results->see('Hello World', '.notice'); | ||
if ($results->see('Hello World', '.notice')) { | ||
// ... | ||
} | ||
|
||
// Check that "Hello World" is within an element with id of "title" | ||
$results->see('Hello World', '#title'); | ||
if ($results->see('Hello World', '#title')) { | ||
// ... | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
<?php | ||
|
||
// Checks that "Hello World" does NOT exist on the page | ||
$results->dontSee('Hello World'); | ||
if ($results->dontSee('Hello World')) { | ||
// ... | ||
} | ||
|
||
// Checks that "Hellow World" does NOT exist within any h1 tag | ||
$results->dontSee('Hello World', 'h1'); | ||
if ($results->dontSee('Hello World', 'h1')) { | ||
// ... | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
<?php | ||
|
||
// Check that an element with class 'notice' exists | ||
$results->seeElement('.notice'); | ||
if ($results->seeElement('.notice')) { | ||
// ... | ||
} | ||
|
||
// Check that an element with id 'title' exists | ||
$results->seeElement('#title'); | ||
if ($results->seeElement('#title')) { | ||
// ... | ||
} | ||
|
||
// Verify that an element with id 'title' does NOT exist | ||
$results->dontSeeElement('#title'); | ||
if ($results->dontSeeElement('#title')) { | ||
// ... | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
<?php | ||
|
||
// Check that a link exists with 'Upgrade Account' as the text:: | ||
$results->seeLink('Upgrade Account'); | ||
if ($results->seeLink('Upgrade Account')) { | ||
// ... | ||
} | ||
|
||
// Check that a link exists with 'Upgrade Account' as the text, AND a class of 'upsell' | ||
$results->seeLink('Upgrade Account', '.upsell'); | ||
if ($results->seeLink('Upgrade Account', '.upsell')) { | ||
// ... | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
<?php | ||
|
||
// Check that an input exists named 'user' with the value 'John Snow' | ||
$results->seeInField('user', 'John Snow'); | ||
if ($results->seeInField('user', 'John Snow')) { | ||
// ... | ||
} | ||
|
||
// Check a multi-dimensional input | ||
$results->seeInField('user[name]', 'John Snow'); | ||
if ($results->seeInField('user[name]', 'John Snow')) { | ||
// ... | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
<?php | ||
|
||
// Check if checkbox is checked with class of 'foo' | ||
$results->seeCheckboxIsChecked('.foo'); | ||
if ($results->seeCheckboxIsChecked('.foo')) { | ||
// ... | ||
} | ||
|
||
// Check if checkbox with id of 'bar' is checked | ||
$results->seeCheckboxIsChecked('#bar'); | ||
if ($results->seeCheckboxIsChecked('#bar')) { | ||
// ... | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
<?php | ||
|
||
// Check that "Hello World" is on the page | ||
// Verify that "Hello World" is on the page | ||
$result->assertSee('Hello World'); | ||
// Check that "Hello World" is within an h1 tag | ||
|
||
// Verify that "Hello World" is within an h1 tag | ||
$result->assertSee('Hello World', 'h1'); | ||
// Check that "Hello World" is within an element with the "notice" class | ||
|
||
// Verify that "Hello World" is within an element with the "notice" class | ||
$result->assertSee('Hello World', '.notice'); | ||
// Check that "Hello World" is within an element with id of "title" | ||
|
||
// Verify that "Hello World" is within an element with id of "title" | ||
$result->assertSee('Hello World', '#title'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
<?php | ||
|
||
// Checks that "Hello World" does NOT exist on the page | ||
$results->dontSee('Hello World'); | ||
// Checks that "Hello World" does NOT exist within any h1 tag | ||
$results->dontSee('Hello World', 'h1'); | ||
// Verify that "Hello World" does NOT exist on the page | ||
$results->assertDontSee('Hello World'); | ||
|
||
// Verify that "Hello World" does NOT exist within any h1 tag | ||
$results->assertDontSee('Hello World', 'h1'); |
Oops, something went wrong.