Skip to content

Commit

Permalink
Merge pull request #3986 from kenjis/fix-testing-feature
Browse files Browse the repository at this point in the history
Fix testing feature
  • Loading branch information
MGatner authored Dec 13, 2020
2 parents 10baac2 + ceb5593 commit 539fa41
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions user_guide_src/source/testing/feature.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ populated, while a **post** request would have the **$_POST** array populated.
::

// Get a simple page
$result = $this->call('get', site_url());
$result = $this->call('get', '/');

// Submit a form
$result = $this->call('post', site_url('contact'), [
$result = $this->call('post', 'contact'), [
'name' => 'Fred Flintstone',
'email' => '[email protected]'
]);
Expand Down Expand Up @@ -177,7 +177,7 @@ a response status code in the 200 or 300's.
This assertion simply uses the **isOK()** method to test a response.
::

$this->assertOK();
$result->assertOK();

**isRedirect()**

Expand All @@ -194,7 +194,7 @@ Returns a boolean true/false based on whether the response is a redirected respo
Asserts that the Response is an instance of RedirectResponse.
::

$this->assertRedirect();
$result->assertRedirect();

**getRedirectUrl()**

Expand All @@ -209,7 +209,7 @@ Returns the URL set for a RedirectResponse, or null for failure.
Asserts that the HTTP status code returned matches $code.
::

$this->assertStatus(403);
$result->assertStatus(403);


Session Assertions
Expand All @@ -221,14 +221,14 @@ Asserts that a value exists in the resulting session. If $value is passed, will
matches what was specified.
::

$this->assertSessionHas('logged_in', 123);
$result->assertSessionHas('logged_in', 123);

**assertSessionMissing(string $key)**

Asserts that the resulting session does not include the specified $key.
::

$this->assertSessionMissin('logged_in');
$result->assertSessionMissin('logged_in');


Header Assertions
Expand All @@ -240,14 +240,14 @@ Asserts that a header named **$key** exists in the response. If **$value** is no
the values match.
::

$this->assertHeader('Content-Type', 'text/html');
$result->assertHeader('Content-Type', 'text/html');

**assertHeaderMissing(string $key)**

Asserts that a header name **$key** does not exist in the response.
::

$this->assertHeader('Accepts');
$result->assertHeader('Accepts');



Expand All @@ -260,22 +260,22 @@ Asserts that a cookie named **$key** exists in the response. If **$value** is no
the values match. You can set the cookie prefix, if needed, by passing it in as the third parameter.
::

$this->assertCookie('foo', 'bar');
$result->assertCookie('foo', 'bar');

**assertCookieMissing(string $key)**

Asserts that a cookie named **$key** does not exist in the response.
::

$this->assertCookieMissing('ci_session');
$result->assertCookieMissing('ci_session');

**assertCookieExpired(string $key, string $prefix = '')**

Asserts that a cookie named **$key** exists, but has expired. You can set the cookie prefix, if needed, by passing it
in as the second parameter.
::

$this->assertCookieExpired('foo');
$result->assertCookieExpired('foo');


DOM Assertions
Expand All @@ -290,13 +290,13 @@ Asserts that text/HTML is on the page, either by itself or - more specifically -
a tag, as specified by type, class, or id::

// Check that "Hello World" is on the page
$this->assertSee('Hello World');
$result->assertSee('Hello World');
// Check that "Hello World" is within an h1 tag
$this->assertSee('Hello World', 'h1');
$result->assertSee('Hello World', 'h1');
// Check that "Hello World" is within an element with the "notice" class
$this->assertSee('Hello World', '.notice');
$result->assertSee('Hello World', '.notice');
// Check that "Hello World" is within an element with id of "title"
$this->assertSee('Hellow World', '#title');
$result->assertSee('Hellow World', '#title');


**assertDontSee(string $search = null, string $element = null)**
Expand Down Expand Up @@ -395,4 +395,3 @@ Working With XML
**getXML()**

If your application returns XML, you can retrieve it through this method.

0 comments on commit 539fa41

Please sign in to comment.