4621 lines
155 KiB
PHP
4621 lines
155 KiB
PHP
<?php //[STAMP] 28939ab87a9833860b309fa80c19ba9c
|
|
namespace _generated;
|
|
|
|
// This class was automatically generated by build task
|
|
// You should not change it manually as it will be overwritten on next build
|
|
// @codingStandardsIgnoreFile
|
|
|
|
trait FunctionalTesterActions
|
|
{
|
|
/**
|
|
* @return \Codeception\Scenario
|
|
*/
|
|
abstract protected function getScenario();
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Adds HTTP authentication via username/password.
|
|
*
|
|
* @param $username
|
|
* @param $password
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::amHttpAuthenticated()
|
|
*/
|
|
public function amHttpAuthenticated($username, $password) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Condition('amHttpAuthenticated', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sets a HTTP header to be used for all subsequent requests. Use [`deleteHeader`](#deleteHeader) to unset it.
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->haveHttpHeader('Content-Type', 'application/json');
|
|
* // all next requests will contain this header
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $name
|
|
* @param $value
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::haveHttpHeader()
|
|
*/
|
|
public function haveHttpHeader($name, $value) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('haveHttpHeader', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Deletes a HTTP header (that was originally added by [haveHttpHeader()](#haveHttpHeader)),
|
|
* so that subsequent requests will not send it anymore.
|
|
*
|
|
* Example:
|
|
* ```php
|
|
* <?php
|
|
* $I->haveHttpHeader('X-Requested-With', 'Codeception');
|
|
* $I->sendGet('test-headers.php');
|
|
* // ...
|
|
* $I->deleteHeader('X-Requested-With');
|
|
* $I->sendPost('some-other-page.php');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param string $name the name of the header to delete.
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::deleteHeader()
|
|
*/
|
|
public function deleteHeader($name) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('deleteHeader', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Opens the page for the given relative URI.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // opens front page
|
|
* $I->amOnPage('/');
|
|
* // opens /register page
|
|
* $I->amOnPage('/register');
|
|
* ```
|
|
*
|
|
* @param string $page
|
|
* @see \Codeception\Lib\InnerBrowser::amOnPage()
|
|
*/
|
|
public function amOnPage($page) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnPage', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Perform a click on a link or a button, given by a locator.
|
|
* If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
|
|
* For buttons, the "value" attribute, "name" attribute, and inner text are searched.
|
|
* For links, the link text is searched.
|
|
* For images, the "alt" attribute and inner text of any parent links are searched.
|
|
*
|
|
* The second parameter is a context (CSS or XPath locator) to narrow the search.
|
|
*
|
|
* Note that if the locator matches a button of type `submit`, the form will be submitted.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // simple link
|
|
* $I->click('Logout');
|
|
* // button of form
|
|
* $I->click('Submit');
|
|
* // CSS button
|
|
* $I->click('#form input[type=submit]');
|
|
* // XPath
|
|
* $I->click('//form/*[@type="submit"]');
|
|
* // link in context
|
|
* $I->click('Logout', '#nav');
|
|
* // using strict locator
|
|
* $I->click(['link' => 'Login']);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $link
|
|
* @param $context
|
|
* @see \Codeception\Lib\InnerBrowser::click()
|
|
*/
|
|
public function click($link, $context = NULL) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('click', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the current page contains the given string (case insensitive).
|
|
*
|
|
* You can specify a specific HTML element (via CSS or XPath) as the second
|
|
* parameter to only search within that element.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->see('Logout'); // I can suppose user is logged in
|
|
* $I->see('Sign Up', 'h1'); // I can suppose it's a signup page
|
|
* $I->see('Sign Up', '//body/h1'); // with XPath
|
|
* $I->see('Sign Up', ['css' => 'body h1']); // with strict CSS locator
|
|
* ```
|
|
*
|
|
* Note that the search is done after stripping all HTML tags from the body,
|
|
* so `$I->see('strong')` will return true for strings like:
|
|
*
|
|
* - `<p>I am Stronger than thou</p>`
|
|
* - `<script>document.createElement('strong');</script>`
|
|
*
|
|
* But will *not* be true for strings like:
|
|
*
|
|
* - `<strong>Home</strong>`
|
|
* - `<div class="strong">Home</strong>`
|
|
* - `<!-- strong -->`
|
|
*
|
|
* For checking the raw source code, use `seeInSource()`.
|
|
*
|
|
* @param string $text
|
|
* @param array|string $selector optional
|
|
* @see \Codeception\Lib\InnerBrowser::see()
|
|
*/
|
|
public function see($text, $selector = NULL) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('see', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that the current page contains the given string (case insensitive).
|
|
*
|
|
* You can specify a specific HTML element (via CSS or XPath) as the second
|
|
* parameter to only search within that element.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->see('Logout'); // I can suppose user is logged in
|
|
* $I->see('Sign Up', 'h1'); // I can suppose it's a signup page
|
|
* $I->see('Sign Up', '//body/h1'); // with XPath
|
|
* $I->see('Sign Up', ['css' => 'body h1']); // with strict CSS locator
|
|
* ```
|
|
*
|
|
* Note that the search is done after stripping all HTML tags from the body,
|
|
* so `$I->see('strong')` will return true for strings like:
|
|
*
|
|
* - `<p>I am Stronger than thou</p>`
|
|
* - `<script>document.createElement('strong');</script>`
|
|
*
|
|
* But will *not* be true for strings like:
|
|
*
|
|
* - `<strong>Home</strong>`
|
|
* - `<div class="strong">Home</strong>`
|
|
* - `<!-- strong -->`
|
|
*
|
|
* For checking the raw source code, use `seeInSource()`.
|
|
*
|
|
* @param string $text
|
|
* @param array|string $selector optional
|
|
* @see \Codeception\Lib\InnerBrowser::see()
|
|
*/
|
|
public function canSee($text, $selector = NULL) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('see', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the current page doesn't contain the text specified (case insensitive).
|
|
* Give a locator as the second parameter to match a specific region.
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->dontSee('Login'); // I can suppose user is already logged in
|
|
* $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
|
|
* $I->dontSee('Sign Up','//body/h1'); // with XPath
|
|
* $I->dontSee('Sign Up', ['css' => 'body h1']); // with strict CSS locator
|
|
* ```
|
|
*
|
|
* Note that the search is done after stripping all HTML tags from the body,
|
|
* so `$I->dontSee('strong')` will fail on strings like:
|
|
*
|
|
* - `<p>I am Stronger than thou</p>`
|
|
* - `<script>document.createElement('strong');</script>`
|
|
*
|
|
* But will ignore strings like:
|
|
*
|
|
* - `<strong>Home</strong>`
|
|
* - `<div class="strong">Home</strong>`
|
|
* - `<!-- strong -->`
|
|
*
|
|
* For checking the raw source code, use `seeInSource()`.
|
|
*
|
|
* @param string $text
|
|
* @param array|string $selector optional
|
|
* @see \Codeception\Lib\InnerBrowser::dontSee()
|
|
*/
|
|
public function dontSee($text, $selector = NULL) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSee', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that the current page doesn't contain the text specified (case insensitive).
|
|
* Give a locator as the second parameter to match a specific region.
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->dontSee('Login'); // I can suppose user is already logged in
|
|
* $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
|
|
* $I->dontSee('Sign Up','//body/h1'); // with XPath
|
|
* $I->dontSee('Sign Up', ['css' => 'body h1']); // with strict CSS locator
|
|
* ```
|
|
*
|
|
* Note that the search is done after stripping all HTML tags from the body,
|
|
* so `$I->dontSee('strong')` will fail on strings like:
|
|
*
|
|
* - `<p>I am Stronger than thou</p>`
|
|
* - `<script>document.createElement('strong');</script>`
|
|
*
|
|
* But will ignore strings like:
|
|
*
|
|
* - `<strong>Home</strong>`
|
|
* - `<div class="strong">Home</strong>`
|
|
* - `<!-- strong -->`
|
|
*
|
|
* For checking the raw source code, use `seeInSource()`.
|
|
*
|
|
* @param string $text
|
|
* @param array|string $selector optional
|
|
* @see \Codeception\Lib\InnerBrowser::dontSee()
|
|
*/
|
|
public function cantSee($text, $selector = NULL) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSee', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the current page contains the given string in its
|
|
* raw source code.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeInSource('<h1>Green eggs & ham</h1>');
|
|
* ```
|
|
*
|
|
* @param $raw
|
|
* @see \Codeception\Lib\InnerBrowser::seeInSource()
|
|
*/
|
|
public function seeInSource($raw) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInSource', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that the current page contains the given string in its
|
|
* raw source code.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeInSource('<h1>Green eggs & ham</h1>');
|
|
* ```
|
|
*
|
|
* @param $raw
|
|
* @see \Codeception\Lib\InnerBrowser::seeInSource()
|
|
*/
|
|
public function canSeeInSource($raw) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInSource', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the current page contains the given string in its
|
|
* raw source code.
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->dontSeeInSource('<h1>Green eggs & ham</h1>');
|
|
* ```
|
|
*
|
|
* @param $raw
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeInSource()
|
|
*/
|
|
public function dontSeeInSource($raw) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeInSource', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that the current page contains the given string in its
|
|
* raw source code.
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->dontSeeInSource('<h1>Green eggs & ham</h1>');
|
|
* ```
|
|
*
|
|
* @param $raw
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeInSource()
|
|
*/
|
|
public function cantSeeInSource($raw) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInSource', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that there's a link with the specified text.
|
|
* Give a full URL as the second parameter to match links with that exact URL.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeLink('Logout'); // matches <a href="#">Logout</a>
|
|
* $I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a>
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param string $text
|
|
* @param string $url optional
|
|
* @see \Codeception\Lib\InnerBrowser::seeLink()
|
|
*/
|
|
public function seeLink($text, $url = NULL) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeLink', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that there's a link with the specified text.
|
|
* Give a full URL as the second parameter to match links with that exact URL.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeLink('Logout'); // matches <a href="#">Logout</a>
|
|
* $I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a>
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param string $text
|
|
* @param string $url optional
|
|
* @see \Codeception\Lib\InnerBrowser::seeLink()
|
|
*/
|
|
public function canSeeLink($text, $url = NULL) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeLink', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the page doesn't contain a link with the given string.
|
|
* If the second parameter is given, only links with a matching "href" attribute will be checked.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeLink('Logout'); // I suppose user is not logged in
|
|
* $I->dontSeeLink('Checkout now', '/store/cart.php');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param string $text
|
|
* @param string $url optional
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeLink()
|
|
*/
|
|
public function dontSeeLink($text, $url = "") {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeLink', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that the page doesn't contain a link with the given string.
|
|
* If the second parameter is given, only links with a matching "href" attribute will be checked.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeLink('Logout'); // I suppose user is not logged in
|
|
* $I->dontSeeLink('Checkout now', '/store/cart.php');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param string $text
|
|
* @param string $url optional
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeLink()
|
|
*/
|
|
public function cantSeeLink($text, $url = "") {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeLink', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that current URI contains the given string.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // to match: /home/dashboard
|
|
* $I->seeInCurrentUrl('home');
|
|
* // to match: /users/1
|
|
* $I->seeInCurrentUrl('/users/');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param string $uri
|
|
* @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl()
|
|
*/
|
|
public function seeInCurrentUrl($uri) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInCurrentUrl', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that current URI contains the given string.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // to match: /home/dashboard
|
|
* $I->seeInCurrentUrl('home');
|
|
* // to match: /users/1
|
|
* $I->seeInCurrentUrl('/users/');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param string $uri
|
|
* @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl()
|
|
*/
|
|
public function canSeeInCurrentUrl($uri) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInCurrentUrl', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the current URI doesn't contain the given string.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeInCurrentUrl('/users/');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param string $uri
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl()
|
|
*/
|
|
public function dontSeeInCurrentUrl($uri) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeInCurrentUrl', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that the current URI doesn't contain the given string.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeInCurrentUrl('/users/');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param string $uri
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl()
|
|
*/
|
|
public function cantSeeInCurrentUrl($uri) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInCurrentUrl', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the current URL is equal to the given string.
|
|
* Unlike `seeInCurrentUrl`, this only matches the full URL.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // to match root url
|
|
* $I->seeCurrentUrlEquals('/');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param string $uri
|
|
* @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals()
|
|
*/
|
|
public function seeCurrentUrlEquals($uri) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentUrlEquals', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that the current URL is equal to the given string.
|
|
* Unlike `seeInCurrentUrl`, this only matches the full URL.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // to match root url
|
|
* $I->seeCurrentUrlEquals('/');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param string $uri
|
|
* @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals()
|
|
*/
|
|
public function canSeeCurrentUrlEquals($uri) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlEquals', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the current URL doesn't equal the given string.
|
|
* Unlike `dontSeeInCurrentUrl`, this only matches the full URL.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // current url is not root
|
|
* $I->dontSeeCurrentUrlEquals('/');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param string $uri
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals()
|
|
*/
|
|
public function dontSeeCurrentUrlEquals($uri) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeCurrentUrlEquals', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that the current URL doesn't equal the given string.
|
|
* Unlike `dontSeeInCurrentUrl`, this only matches the full URL.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // current url is not root
|
|
* $I->dontSeeCurrentUrlEquals('/');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param string $uri
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals()
|
|
*/
|
|
public function cantSeeCurrentUrlEquals($uri) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlEquals', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the current URL matches the given regular expression.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // to match root url
|
|
* $I->seeCurrentUrlMatches('~^/users/(\d+)~');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param string $uri
|
|
* @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches()
|
|
*/
|
|
public function seeCurrentUrlMatches($uri) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentUrlMatches', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that the current URL matches the given regular expression.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // to match root url
|
|
* $I->seeCurrentUrlMatches('~^/users/(\d+)~');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param string $uri
|
|
* @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches()
|
|
*/
|
|
public function canSeeCurrentUrlMatches($uri) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlMatches', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that current url doesn't match the given regular expression.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // to match root url
|
|
* $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param string $uri
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches()
|
|
*/
|
|
public function dontSeeCurrentUrlMatches($uri) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeCurrentUrlMatches', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that current url doesn't match the given regular expression.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // to match root url
|
|
* $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param string $uri
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches()
|
|
*/
|
|
public function cantSeeCurrentUrlMatches($uri) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlMatches', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Executes the given regular expression against the current URI and returns the first capturing group.
|
|
* If no parameters are provided, the full URI is returned.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $user_id = $I->grabFromCurrentUrl('~^/user/(\d+)/~');
|
|
* $uri = $I->grabFromCurrentUrl();
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param string $uri optional
|
|
*
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::grabFromCurrentUrl()
|
|
*/
|
|
public function grabFromCurrentUrl($uri = NULL) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabFromCurrentUrl', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the specified checkbox is checked.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
|
|
* $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form.
|
|
* $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $checkbox
|
|
* @see \Codeception\Lib\InnerBrowser::seeCheckboxIsChecked()
|
|
*/
|
|
public function seeCheckboxIsChecked($checkbox) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCheckboxIsChecked', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that the specified checkbox is checked.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
|
|
* $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form.
|
|
* $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $checkbox
|
|
* @see \Codeception\Lib\InnerBrowser::seeCheckboxIsChecked()
|
|
*/
|
|
public function canSeeCheckboxIsChecked($checkbox) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCheckboxIsChecked', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Check that the specified checkbox is unchecked.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms
|
|
* $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form.
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $checkbox
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeCheckboxIsChecked()
|
|
*/
|
|
public function dontSeeCheckboxIsChecked($checkbox) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeCheckboxIsChecked', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Check that the specified checkbox is unchecked.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms
|
|
* $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form.
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $checkbox
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeCheckboxIsChecked()
|
|
*/
|
|
public function cantSeeCheckboxIsChecked($checkbox) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCheckboxIsChecked', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the given input field or textarea *equals* (i.e. not just contains) the given value.
|
|
* Fields are matched by label text, the "name" attribute, CSS, or XPath.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeInField('Body','Type your comment here');
|
|
* $I->seeInField('form textarea[name=body]','Type your comment here');
|
|
* $I->seeInField('form input[type=hidden]','hidden_value');
|
|
* $I->seeInField('#searchform input','Search');
|
|
* $I->seeInField('//form/*[@name=search]','Search');
|
|
* $I->seeInField(['name' => 'search'], 'Search');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $field
|
|
* @param $value
|
|
* @see \Codeception\Lib\InnerBrowser::seeInField()
|
|
*/
|
|
public function seeInField($field, $value) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInField', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that the given input field or textarea *equals* (i.e. not just contains) the given value.
|
|
* Fields are matched by label text, the "name" attribute, CSS, or XPath.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeInField('Body','Type your comment here');
|
|
* $I->seeInField('form textarea[name=body]','Type your comment here');
|
|
* $I->seeInField('form input[type=hidden]','hidden_value');
|
|
* $I->seeInField('#searchform input','Search');
|
|
* $I->seeInField('//form/*[@name=search]','Search');
|
|
* $I->seeInField(['name' => 'search'], 'Search');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $field
|
|
* @param $value
|
|
* @see \Codeception\Lib\InnerBrowser::seeInField()
|
|
*/
|
|
public function canSeeInField($field, $value) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInField', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that an input field or textarea doesn't contain the given value.
|
|
* For fuzzy locators, the field is matched by label text, CSS and XPath.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeInField('Body','Type your comment here');
|
|
* $I->dontSeeInField('form textarea[name=body]','Type your comment here');
|
|
* $I->dontSeeInField('form input[type=hidden]','hidden_value');
|
|
* $I->dontSeeInField('#searchform input','Search');
|
|
* $I->dontSeeInField('//form/*[@name=search]','Search');
|
|
* $I->dontSeeInField(['name' => 'search'], 'Search');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $field
|
|
* @param $value
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeInField()
|
|
*/
|
|
public function dontSeeInField($field, $value) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeInField', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that an input field or textarea doesn't contain the given value.
|
|
* For fuzzy locators, the field is matched by label text, CSS and XPath.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeInField('Body','Type your comment here');
|
|
* $I->dontSeeInField('form textarea[name=body]','Type your comment here');
|
|
* $I->dontSeeInField('form input[type=hidden]','hidden_value');
|
|
* $I->dontSeeInField('#searchform input','Search');
|
|
* $I->dontSeeInField('//form/*[@name=search]','Search');
|
|
* $I->dontSeeInField(['name' => 'search'], 'Search');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $field
|
|
* @param $value
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeInField()
|
|
*/
|
|
public function cantSeeInField($field, $value) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInField', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks if the array of form parameters (name => value) are set on the form matched with the
|
|
* passed selector.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeInFormFields('form[name=myform]', [
|
|
* 'input1' => 'value',
|
|
* 'input2' => 'other value',
|
|
* ]);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* For multi-select elements, or to check values of multiple elements with the same name, an
|
|
* array may be passed:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeInFormFields('.form-class', [
|
|
* 'multiselect' => [
|
|
* 'value1',
|
|
* 'value2',
|
|
* ],
|
|
* 'checkbox[]' => [
|
|
* 'a checked value',
|
|
* 'another checked value',
|
|
* ],
|
|
* ]);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* Additionally, checkbox values can be checked with a boolean.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeInFormFields('#form-id', [
|
|
* 'checkbox1' => true, // passes if checked
|
|
* 'checkbox2' => false, // passes if unchecked
|
|
* ]);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* Pair this with submitForm for quick testing magic.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $form = [
|
|
* 'field1' => 'value',
|
|
* 'field2' => 'another value',
|
|
* 'checkbox1' => true,
|
|
* // ...
|
|
* ];
|
|
* $I->submitForm('//form[@id=my-form]', $form, 'submitButton');
|
|
* // $I->amOnPage('/path/to/form-page') may be needed
|
|
* $I->seeInFormFields('//form[@id=my-form]', $form);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $formSelector
|
|
* @param $params
|
|
* @see \Codeception\Lib\InnerBrowser::seeInFormFields()
|
|
*/
|
|
public function seeInFormFields($formSelector, $params) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInFormFields', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks if the array of form parameters (name => value) are set on the form matched with the
|
|
* passed selector.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeInFormFields('form[name=myform]', [
|
|
* 'input1' => 'value',
|
|
* 'input2' => 'other value',
|
|
* ]);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* For multi-select elements, or to check values of multiple elements with the same name, an
|
|
* array may be passed:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeInFormFields('.form-class', [
|
|
* 'multiselect' => [
|
|
* 'value1',
|
|
* 'value2',
|
|
* ],
|
|
* 'checkbox[]' => [
|
|
* 'a checked value',
|
|
* 'another checked value',
|
|
* ],
|
|
* ]);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* Additionally, checkbox values can be checked with a boolean.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeInFormFields('#form-id', [
|
|
* 'checkbox1' => true, // passes if checked
|
|
* 'checkbox2' => false, // passes if unchecked
|
|
* ]);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* Pair this with submitForm for quick testing magic.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $form = [
|
|
* 'field1' => 'value',
|
|
* 'field2' => 'another value',
|
|
* 'checkbox1' => true,
|
|
* // ...
|
|
* ];
|
|
* $I->submitForm('//form[@id=my-form]', $form, 'submitButton');
|
|
* // $I->amOnPage('/path/to/form-page') may be needed
|
|
* $I->seeInFormFields('//form[@id=my-form]', $form);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $formSelector
|
|
* @param $params
|
|
* @see \Codeception\Lib\InnerBrowser::seeInFormFields()
|
|
*/
|
|
public function canSeeInFormFields($formSelector, $params) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInFormFields', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks if the array of form parameters (name => value) are not set on the form matched with
|
|
* the passed selector.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeInFormFields('form[name=myform]', [
|
|
* 'input1' => 'non-existent value',
|
|
* 'input2' => 'other non-existent value',
|
|
* ]);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* To check that an element hasn't been assigned any one of many values, an array can be passed
|
|
* as the value:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeInFormFields('.form-class', [
|
|
* 'fieldName' => [
|
|
* 'This value shouldn\'t be set',
|
|
* 'And this value shouldn\'t be set',
|
|
* ],
|
|
* ]);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* Additionally, checkbox values can be checked with a boolean.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeInFormFields('#form-id', [
|
|
* 'checkbox1' => true, // fails if checked
|
|
* 'checkbox2' => false, // fails if unchecked
|
|
* ]);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $formSelector
|
|
* @param $params
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeInFormFields()
|
|
*/
|
|
public function dontSeeInFormFields($formSelector, $params) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeInFormFields', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks if the array of form parameters (name => value) are not set on the form matched with
|
|
* the passed selector.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeInFormFields('form[name=myform]', [
|
|
* 'input1' => 'non-existent value',
|
|
* 'input2' => 'other non-existent value',
|
|
* ]);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* To check that an element hasn't been assigned any one of many values, an array can be passed
|
|
* as the value:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeInFormFields('.form-class', [
|
|
* 'fieldName' => [
|
|
* 'This value shouldn\'t be set',
|
|
* 'And this value shouldn\'t be set',
|
|
* ],
|
|
* ]);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* Additionally, checkbox values can be checked with a boolean.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeInFormFields('#form-id', [
|
|
* 'checkbox1' => true, // fails if checked
|
|
* 'checkbox2' => false, // fails if unchecked
|
|
* ]);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $formSelector
|
|
* @param $params
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeInFormFields()
|
|
*/
|
|
public function cantSeeInFormFields($formSelector, $params) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInFormFields', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Submits the given form on the page, with the given form
|
|
* values. Pass the form field's values as an array in the second
|
|
* parameter.
|
|
*
|
|
* Although this function can be used as a short-hand version of
|
|
* `fillField()`, `selectOption()`, `click()` etc. it has some important
|
|
* differences:
|
|
*
|
|
* * Only field *names* may be used, not CSS/XPath selectors nor field labels
|
|
* * If a field is sent to this function that does *not* exist on the page,
|
|
* it will silently be added to the HTTP request. This is helpful for testing
|
|
* some types of forms, but be aware that you will *not* get an exception
|
|
* like you would if you called `fillField()` or `selectOption()` with
|
|
* a missing field.
|
|
*
|
|
* Fields that are not provided will be filled by their values from the page,
|
|
* or from any previous calls to `fillField()`, `selectOption()` etc.
|
|
* You don't need to click the 'Submit' button afterwards.
|
|
* This command itself triggers the request to form's action.
|
|
*
|
|
* You can optionally specify which button's value to include
|
|
* in the request with the last parameter (as an alternative to
|
|
* explicitly setting its value in the second parameter), as
|
|
* button values are not otherwise included in the request.
|
|
*
|
|
* Examples:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->submitForm('#login', [
|
|
* 'login' => 'davert',
|
|
* 'password' => '123456'
|
|
* ]);
|
|
* // or
|
|
* $I->submitForm('#login', [
|
|
* 'login' => 'davert',
|
|
* 'password' => '123456'
|
|
* ], 'submitButtonName');
|
|
*
|
|
* ```
|
|
*
|
|
* For example, given this sample "Sign Up" form:
|
|
*
|
|
* ``` html
|
|
* <form action="/sign_up">
|
|
* Login:
|
|
* <input type="text" name="user[login]" /><br/>
|
|
* Password:
|
|
* <input type="password" name="user[password]" /><br/>
|
|
* Do you agree to our terms?
|
|
* <input type="checkbox" name="user[agree]" /><br/>
|
|
* Select pricing plan:
|
|
* <select name="plan">
|
|
* <option value="1">Free</option>
|
|
* <option value="2" selected="selected">Paid</option>
|
|
* </select>
|
|
* <input type="submit" name="submitButton" value="Submit" />
|
|
* </form>
|
|
* ```
|
|
*
|
|
* You could write the following to submit it:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->submitForm(
|
|
* '#userForm',
|
|
* [
|
|
* 'user' => [
|
|
* 'login' => 'Davert',
|
|
* 'password' => '123456',
|
|
* 'agree' => true
|
|
* ]
|
|
* ],
|
|
* 'submitButton'
|
|
* );
|
|
* ```
|
|
* Note that "2" will be the submitted value for the "plan" field, as it is
|
|
* the selected option.
|
|
*
|
|
* You can also emulate a JavaScript submission by not specifying any
|
|
* buttons in the third parameter to submitForm.
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->submitForm(
|
|
* '#userForm',
|
|
* [
|
|
* 'user' => [
|
|
* 'login' => 'Davert',
|
|
* 'password' => '123456',
|
|
* 'agree' => true
|
|
* ]
|
|
* ]
|
|
* );
|
|
* ```
|
|
*
|
|
* This function works well when paired with `seeInFormFields()`
|
|
* for quickly testing CRUD interfaces and form validation logic.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $form = [
|
|
* 'field1' => 'value',
|
|
* 'field2' => 'another value',
|
|
* 'checkbox1' => true,
|
|
* // ...
|
|
* ];
|
|
* $I->submitForm('#my-form', $form, 'submitButton');
|
|
* // $I->amOnPage('/path/to/form-page') may be needed
|
|
* $I->seeInFormFields('#my-form', $form);
|
|
* ```
|
|
*
|
|
* Parameter values can be set to arrays for multiple input fields
|
|
* of the same name, or multi-select combo boxes. For checkboxes,
|
|
* you can use either the string value or boolean `true`/`false` which will
|
|
* be replaced by the checkbox's value in the DOM.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->submitForm('#my-form', [
|
|
* 'field1' => 'value',
|
|
* 'checkbox' => [
|
|
* 'value of first checkbox',
|
|
* 'value of second checkbox',
|
|
* ],
|
|
* 'otherCheckboxes' => [
|
|
* true,
|
|
* false,
|
|
* false
|
|
* ],
|
|
* 'multiselect' => [
|
|
* 'first option value',
|
|
* 'second option value'
|
|
* ]
|
|
* ]);
|
|
* ```
|
|
*
|
|
* Mixing string and boolean values for a checkbox's value is not supported
|
|
* and may produce unexpected results.
|
|
*
|
|
* Field names ending in `[]` must be passed without the trailing square
|
|
* bracket characters, and must contain an array for its value. This allows
|
|
* submitting multiple values with the same name, consider:
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* // This will NOT work correctly
|
|
* $I->submitForm('#my-form', [
|
|
* 'field[]' => 'value',
|
|
* 'field[]' => 'another value', // 'field[]' is already a defined key
|
|
* ]);
|
|
* ```
|
|
*
|
|
* The solution is to pass an array value:
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* // This way both values are submitted
|
|
* $I->submitForm('#my-form', [
|
|
* 'field' => [
|
|
* 'value',
|
|
* 'another value',
|
|
* ]
|
|
* ]);
|
|
* ```
|
|
*
|
|
* @param $selector
|
|
* @param $params
|
|
* @param $button
|
|
* @see \Codeception\Lib\InnerBrowser::submitForm()
|
|
*/
|
|
public function submitForm($selector, $params, $button = NULL) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('submitForm', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Fills a text field or textarea with the given string.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->fillField("//input[@type='text']", "Hello World!");
|
|
* $I->fillField(['name' => 'email'], 'jon@mail.com');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $field
|
|
* @param $value
|
|
* @see \Codeception\Lib\InnerBrowser::fillField()
|
|
*/
|
|
public function fillField($field, $value) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('fillField', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Selects an option in a select tag or in radio button group.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->selectOption('form select[name=account]', 'Premium');
|
|
* $I->selectOption('form input[name=payment]', 'Monthly');
|
|
* $I->selectOption('//form/select[@name=account]', 'Monthly');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* Provide an array for the second argument to select multiple options:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->selectOption('Which OS do you use?', array('Windows','Linux'));
|
|
* ?>
|
|
* ```
|
|
*
|
|
* Or provide an associative array for the second argument to specifically define which selection method should be used:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->selectOption('Which OS do you use?', array('text' => 'Windows')); // Only search by text 'Windows'
|
|
* $I->selectOption('Which OS do you use?', array('value' => 'windows')); // Only search by value 'windows'
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $select
|
|
* @param $option
|
|
* @see \Codeception\Lib\InnerBrowser::selectOption()
|
|
*/
|
|
public function selectOption($select, $option) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('selectOption', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Ticks a checkbox. For radio buttons, use the `selectOption` method instead.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->checkOption('#agree');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $option
|
|
* @see \Codeception\Lib\InnerBrowser::checkOption()
|
|
*/
|
|
public function checkOption($option) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('checkOption', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Unticks a checkbox.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->uncheckOption('#notify');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $option
|
|
* @see \Codeception\Lib\InnerBrowser::uncheckOption()
|
|
*/
|
|
public function uncheckOption($option) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('uncheckOption', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Attaches a file relative to the Codeception `_data` directory to the given file upload field.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // file is stored in 'tests/_data/prices.xls'
|
|
* $I->attachFile('input[@type="file"]', 'prices.xls');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $field
|
|
* @param $filename
|
|
* @see \Codeception\Lib\InnerBrowser::attachFile()
|
|
*/
|
|
public function attachFile($field, $filename) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('attachFile', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends an ajax GET request with the passed parameters.
|
|
* See `sendAjaxPostRequest()`
|
|
*
|
|
* @param $uri
|
|
* @param $params
|
|
* @see \Codeception\Lib\InnerBrowser::sendAjaxGetRequest()
|
|
*/
|
|
public function sendAjaxGetRequest($uri, $params = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('sendAjaxGetRequest', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends an ajax POST request with the passed parameters.
|
|
* The appropriate HTTP header is added automatically:
|
|
* `X-Requested-With: XMLHttpRequest`
|
|
* Example:
|
|
* ``` php
|
|
* <?php
|
|
* $I->sendAjaxPostRequest('/add-task', ['task' => 'lorem ipsum']);
|
|
* ```
|
|
* Some frameworks (e.g. Symfony) create field names in the form of an "array":
|
|
* `<input type="text" name="form[task]">`
|
|
* In this case you need to pass the fields like this:
|
|
* ``` php
|
|
* <?php
|
|
* $I->sendAjaxPostRequest('/add-task', ['form' => [
|
|
* 'task' => 'lorem ipsum',
|
|
* 'category' => 'miscellaneous',
|
|
* ]]);
|
|
* ```
|
|
*
|
|
* @param string $uri
|
|
* @param array $params
|
|
* @see \Codeception\Lib\InnerBrowser::sendAjaxPostRequest()
|
|
*/
|
|
public function sendAjaxPostRequest($uri, $params = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('sendAjaxPostRequest', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends an ajax request, using the passed HTTP method.
|
|
* See `sendAjaxPostRequest()`
|
|
* Example:
|
|
* ``` php
|
|
* <?php
|
|
* $I->sendAjaxRequest('PUT', '/posts/7', ['title' => 'new title']);
|
|
* ```
|
|
*
|
|
* @param $method
|
|
* @param $uri
|
|
* @param $params
|
|
* @see \Codeception\Lib\InnerBrowser::sendAjaxRequest()
|
|
*/
|
|
public function sendAjaxRequest($method, $uri, $params = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('sendAjaxRequest', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Use this method within an [interactive pause](https://codeception.com/docs/02-GettingStarted#Interactive-Pause) to save the HTML source code of the current page.
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->makeHtmlSnapshot('edit_page');
|
|
* // saved to: tests/_output/debug/edit_page.html
|
|
* $I->makeHtmlSnapshot();
|
|
* // saved to: tests/_output/debug/2017-05-26_14-24-11_4b3403665fea6.html
|
|
* ```
|
|
*
|
|
* @param null $name
|
|
* @see \Codeception\Lib\InnerBrowser::makeHtmlSnapshot()
|
|
*/
|
|
public function makeHtmlSnapshot($name = NULL) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('makeHtmlSnapshot', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Finds and returns the text contents of the given element.
|
|
* If a fuzzy locator is used, the element is found using CSS, XPath,
|
|
* and by matching the full page source by regular expression.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $heading = $I->grabTextFrom('h1');
|
|
* $heading = $I->grabTextFrom('descendant-or-self::h1');
|
|
* $value = $I->grabTextFrom('~<input value=(.*?)]~sgi'); // match with a regex
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $cssOrXPathOrRegex
|
|
*
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::grabTextFrom()
|
|
*/
|
|
public function grabTextFrom($cssOrXPathOrRegex) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabTextFrom', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Grabs the value of the given attribute value from the given element.
|
|
* Fails if element is not found.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->grabAttributeFrom('#tooltip', 'title');
|
|
* ?>
|
|
* ```
|
|
*
|
|
*
|
|
* @param $cssOrXpath
|
|
* @param $attribute
|
|
*
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::grabAttributeFrom()
|
|
*/
|
|
public function grabAttributeFrom($cssOrXpath, $attribute) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabAttributeFrom', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Grabs either the text content, or attribute values, of nodes
|
|
* matched by $cssOrXpath and returns them as an array.
|
|
*
|
|
* ```html
|
|
* <a href="#first">First</a>
|
|
* <a href="#second">Second</a>
|
|
* <a href="#third">Third</a>
|
|
* ```
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* // would return ['First', 'Second', 'Third']
|
|
* $aLinkText = $I->grabMultiple('a');
|
|
*
|
|
* // would return ['#first', '#second', '#third']
|
|
* $aLinks = $I->grabMultiple('a', 'href');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $cssOrXpath
|
|
* @param $attribute
|
|
* @return string[]
|
|
* @see \Codeception\Lib\InnerBrowser::grabMultiple()
|
|
*/
|
|
public function grabMultiple($cssOrXpath, $attribute = NULL) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabMultiple', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* @param $field
|
|
*
|
|
* @return array|mixed|null|string
|
|
* @see \Codeception\Lib\InnerBrowser::grabValueFrom()
|
|
*/
|
|
public function grabValueFrom($field) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabValueFrom', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sets a cookie with the given name and value.
|
|
* You can set additional cookie params like `domain`, `path`, `expires`, `secure` in array passed as last argument.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $name
|
|
* @param $val
|
|
* @param array $params
|
|
*
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::setCookie()
|
|
*/
|
|
public function setCookie($name, $val, $params = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('setCookie', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Grabs a cookie value.
|
|
* You can set additional cookie params like `domain`, `path` in array passed as last argument.
|
|
* If the cookie is set by an ajax request (XMLHttpRequest), there might be some delay caused by the browser, so try `$I->wait(0.1)`.
|
|
*
|
|
* @param $cookie
|
|
*
|
|
* @param array $params
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::grabCookie()
|
|
*/
|
|
public function grabCookie($cookie, $params = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabCookie', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Grabs current page source code.
|
|
*
|
|
* @throws ModuleException if no page was opened.
|
|
*
|
|
* @return string Current page source code.
|
|
* @see \Codeception\Lib\InnerBrowser::grabPageSource()
|
|
*/
|
|
public function grabPageSource() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabPageSource', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that a cookie with the given name is set.
|
|
* You can set additional cookie params like `domain`, `path` as array passed in last argument.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeCookie('PHPSESSID');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $cookie
|
|
* @param array $params
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::seeCookie()
|
|
*/
|
|
public function seeCookie($cookie, $params = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCookie', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that a cookie with the given name is set.
|
|
* You can set additional cookie params like `domain`, `path` as array passed in last argument.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeCookie('PHPSESSID');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $cookie
|
|
* @param array $params
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::seeCookie()
|
|
*/
|
|
public function canSeeCookie($cookie, $params = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCookie', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that there isn't a cookie with the given name.
|
|
* You can set additional cookie params like `domain`, `path` as array passed in last argument.
|
|
*
|
|
* @param $cookie
|
|
*
|
|
* @param array $params
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeCookie()
|
|
*/
|
|
public function dontSeeCookie($cookie, $params = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeCookie', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that there isn't a cookie with the given name.
|
|
* You can set additional cookie params like `domain`, `path` as array passed in last argument.
|
|
*
|
|
* @param $cookie
|
|
*
|
|
* @param array $params
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeCookie()
|
|
*/
|
|
public function cantSeeCookie($cookie, $params = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCookie', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Unsets cookie with the given name.
|
|
* You can set additional cookie params like `domain`, `path` in array passed as last argument.
|
|
*
|
|
* @param $cookie
|
|
*
|
|
* @param array $params
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::resetCookie()
|
|
*/
|
|
public function resetCookie($name, $params = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('resetCookie', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the given element exists on the page and is visible.
|
|
* You can also specify expected attributes of this element.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeElement('.error');
|
|
* $I->seeElement('//form/input[1]');
|
|
* $I->seeElement('input', ['name' => 'login']);
|
|
* $I->seeElement('input', ['value' => '123456']);
|
|
*
|
|
* // strict locator in first arg, attributes in second
|
|
* $I->seeElement(['css' => 'form input'], ['name' => 'login']);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $selector
|
|
* @param array $attributes
|
|
* @return
|
|
* @see \Codeception\Lib\InnerBrowser::seeElement()
|
|
*/
|
|
public function seeElement($selector, $attributes = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeElement', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that the given element exists on the page and is visible.
|
|
* You can also specify expected attributes of this element.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeElement('.error');
|
|
* $I->seeElement('//form/input[1]');
|
|
* $I->seeElement('input', ['name' => 'login']);
|
|
* $I->seeElement('input', ['value' => '123456']);
|
|
*
|
|
* // strict locator in first arg, attributes in second
|
|
* $I->seeElement(['css' => 'form input'], ['name' => 'login']);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $selector
|
|
* @param array $attributes
|
|
* @return
|
|
* @see \Codeception\Lib\InnerBrowser::seeElement()
|
|
*/
|
|
public function canSeeElement($selector, $attributes = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeElement', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the given element is invisible or not present on the page.
|
|
* You can also specify expected attributes of this element.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeElement('.error');
|
|
* $I->dontSeeElement('//form/input[1]');
|
|
* $I->dontSeeElement('input', ['name' => 'login']);
|
|
* $I->dontSeeElement('input', ['value' => '123456']);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $selector
|
|
* @param array $attributes
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeElement()
|
|
*/
|
|
public function dontSeeElement($selector, $attributes = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeElement', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that the given element is invisible or not present on the page.
|
|
* You can also specify expected attributes of this element.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeElement('.error');
|
|
* $I->dontSeeElement('//form/input[1]');
|
|
* $I->dontSeeElement('input', ['name' => 'login']);
|
|
* $I->dontSeeElement('input', ['value' => '123456']);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $selector
|
|
* @param array $attributes
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeElement()
|
|
*/
|
|
public function cantSeeElement($selector, $attributes = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeElement', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that there are a certain number of elements matched by the given locator on the page.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeNumberOfElements('tr', 10);
|
|
* $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements
|
|
* ?>
|
|
* ```
|
|
* @param $selector
|
|
* @param mixed $expected int or int[]
|
|
* @see \Codeception\Lib\InnerBrowser::seeNumberOfElements()
|
|
*/
|
|
public function seeNumberOfElements($selector, $expected) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeNumberOfElements', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that there are a certain number of elements matched by the given locator on the page.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeNumberOfElements('tr', 10);
|
|
* $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements
|
|
* ?>
|
|
* ```
|
|
* @param $selector
|
|
* @param mixed $expected int or int[]
|
|
* @see \Codeception\Lib\InnerBrowser::seeNumberOfElements()
|
|
*/
|
|
public function canSeeNumberOfElements($selector, $expected) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeNumberOfElements', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the given option is selected.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeOptionIsSelected('#form input[name=payment]', 'Visa');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $selector
|
|
* @param $optionText
|
|
*
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected()
|
|
*/
|
|
public function seeOptionIsSelected($selector, $optionText) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeOptionIsSelected', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that the given option is selected.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeOptionIsSelected('#form input[name=payment]', 'Visa');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $selector
|
|
* @param $optionText
|
|
*
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected()
|
|
*/
|
|
public function canSeeOptionIsSelected($selector, $optionText) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeOptionIsSelected', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the given option is not selected.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $selector
|
|
* @param $optionText
|
|
*
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected()
|
|
*/
|
|
public function dontSeeOptionIsSelected($selector, $optionText) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeOptionIsSelected', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that the given option is not selected.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $selector
|
|
* @param $optionText
|
|
*
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected()
|
|
*/
|
|
public function cantSeeOptionIsSelected($selector, $optionText) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeOptionIsSelected', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Asserts that current page has 404 response status code.
|
|
* @see \Codeception\Lib\InnerBrowser::seePageNotFound()
|
|
*/
|
|
public function seePageNotFound() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seePageNotFound', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Asserts that current page has 404 response status code.
|
|
* @see \Codeception\Lib\InnerBrowser::seePageNotFound()
|
|
*/
|
|
public function canSeePageNotFound() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seePageNotFound', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks response code equals to provided value.
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->seeResponseCodeIs(200);
|
|
*
|
|
* // preferred to use \Codeception\Util\HttpCode
|
|
* $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
|
|
* ```
|
|
*
|
|
* @part json
|
|
* @part xml
|
|
* @param $code
|
|
* @see \Codeception\Module\REST::seeResponseCodeIs()
|
|
*/
|
|
public function seeResponseCodeIs($code) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIs', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks response code equals to provided value.
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->seeResponseCodeIs(200);
|
|
*
|
|
* // preferred to use \Codeception\Util\HttpCode
|
|
* $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
|
|
* ```
|
|
*
|
|
* @part json
|
|
* @part xml
|
|
* @param $code
|
|
* @see \Codeception\Module\REST::seeResponseCodeIs()
|
|
*/
|
|
public function canSeeResponseCodeIs($code) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIs', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that response code is between a certain range. Between actually means [from <= CODE <= to]
|
|
*
|
|
* @param $from
|
|
* @param $to
|
|
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsBetween()
|
|
*/
|
|
public function seeResponseCodeIsBetween($from, $to) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsBetween', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that response code is between a certain range. Between actually means [from <= CODE <= to]
|
|
*
|
|
* @param $from
|
|
* @param $to
|
|
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsBetween()
|
|
*/
|
|
public function canSeeResponseCodeIsBetween($from, $to) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsBetween', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that response code is not equal to provided value.
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->dontSeeResponseCodeIs(200);
|
|
*
|
|
* // preferred to use \Codeception\Util\HttpCode
|
|
* $I->dontSeeResponseCodeIs(\Codeception\Util\HttpCode::OK);
|
|
* ```
|
|
*
|
|
* @part json
|
|
* @part xml
|
|
* @param $code
|
|
* @see \Codeception\Module\REST::dontSeeResponseCodeIs()
|
|
*/
|
|
public function dontSeeResponseCodeIs($code) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeResponseCodeIs', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that response code is not equal to provided value.
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->dontSeeResponseCodeIs(200);
|
|
*
|
|
* // preferred to use \Codeception\Util\HttpCode
|
|
* $I->dontSeeResponseCodeIs(\Codeception\Util\HttpCode::OK);
|
|
* ```
|
|
*
|
|
* @part json
|
|
* @part xml
|
|
* @param $code
|
|
* @see \Codeception\Module\REST::dontSeeResponseCodeIs()
|
|
*/
|
|
public function cantSeeResponseCodeIs($code) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseCodeIs', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the response code is 2xx
|
|
*
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeResponseCodeIsSuccessful()
|
|
*/
|
|
public function seeResponseCodeIsSuccessful() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsSuccessful', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that the response code is 2xx
|
|
*
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeResponseCodeIsSuccessful()
|
|
*/
|
|
public function canSeeResponseCodeIsSuccessful() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsSuccessful', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the response code 3xx
|
|
*
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeResponseCodeIsRedirection()
|
|
*/
|
|
public function seeResponseCodeIsRedirection() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsRedirection', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that the response code 3xx
|
|
*
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeResponseCodeIsRedirection()
|
|
*/
|
|
public function canSeeResponseCodeIsRedirection() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsRedirection', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the response code is 4xx
|
|
*
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeResponseCodeIsClientError()
|
|
*/
|
|
public function seeResponseCodeIsClientError() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsClientError', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that the response code is 4xx
|
|
*
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeResponseCodeIsClientError()
|
|
*/
|
|
public function canSeeResponseCodeIsClientError() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsClientError', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the response code is 5xx
|
|
*
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeResponseCodeIsServerError()
|
|
*/
|
|
public function seeResponseCodeIsServerError() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsServerError', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that the response code is 5xx
|
|
*
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeResponseCodeIsServerError()
|
|
*/
|
|
public function canSeeResponseCodeIsServerError() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsServerError', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the page title contains the given string.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeInTitle('Blog - Post #1');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $title
|
|
*
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::seeInTitle()
|
|
*/
|
|
public function seeInTitle($title) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInTitle', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that the page title contains the given string.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeInTitle('Blog - Post #1');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $title
|
|
*
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::seeInTitle()
|
|
*/
|
|
public function canSeeInTitle($title) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInTitle', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the page title does not contain the given string.
|
|
*
|
|
* @param $title
|
|
*
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeInTitle()
|
|
*/
|
|
public function dontSeeInTitle($title) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeInTitle', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that the page title does not contain the given string.
|
|
*
|
|
* @param $title
|
|
*
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeInTitle()
|
|
*/
|
|
public function cantSeeInTitle($title) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInTitle', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Switch to iframe or frame on the page.
|
|
*
|
|
* Example:
|
|
* ``` html
|
|
* <iframe name="another_frame" src="http://example.com">
|
|
* ```
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* # switch to iframe
|
|
* $I->switchToIframe("another_frame");
|
|
* ```
|
|
*
|
|
* @param string $name
|
|
* @see \Codeception\Lib\InnerBrowser::switchToIframe()
|
|
*/
|
|
public function switchToIframe($name) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('switchToIframe', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Moves back in history.
|
|
*
|
|
* @param int $numberOfSteps (default value 1)
|
|
* @see \Codeception\Lib\InnerBrowser::moveBack()
|
|
*/
|
|
public function moveBack($numberOfSteps = 1) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('moveBack', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sets SERVER parameters valid for all next requests.
|
|
* this will remove old ones.
|
|
*
|
|
* ```php
|
|
* $I->setServerParameters([]);
|
|
* ```
|
|
* @see \Codeception\Module\REST::setServerParameters()
|
|
*/
|
|
public function setServerParameters($params) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('setServerParameters', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sets SERVER parameter valid for all next requests.
|
|
*
|
|
* ```php
|
|
* $I->haveServerParameter('name', 'value');
|
|
* ```
|
|
* @see \Codeception\Module\REST::haveServerParameter()
|
|
*/
|
|
public function haveServerParameter($name, $value) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('haveServerParameter', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Prevents automatic redirects to be followed by the client
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->stopFollowingRedirects();
|
|
* ```
|
|
*
|
|
* @part xml
|
|
* @part json
|
|
* @see \Codeception\Module\REST::stopFollowingRedirects()
|
|
*/
|
|
public function stopFollowingRedirects() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('stopFollowingRedirects', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Enables automatic redirects to be followed by the client
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->startFollowingRedirects();
|
|
* ```
|
|
*
|
|
* @part xml
|
|
* @part json
|
|
* @see \Codeception\Module\REST::startFollowingRedirects()
|
|
*/
|
|
public function startFollowingRedirects() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('startFollowingRedirects', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Follow pending redirect if there is one.
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->followRedirect();
|
|
* ```
|
|
*
|
|
* @see \Codeception\Lib\InnerBrowser::followRedirect()
|
|
*/
|
|
public function followRedirect() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('followRedirect', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sets the maximum number of redirects that the Client can follow.
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->setMaxRedirects(2);
|
|
* ```
|
|
*
|
|
* @param int $maxRedirects
|
|
* @see \Codeception\Lib\InnerBrowser::setMaxRedirects()
|
|
*/
|
|
public function setMaxRedirects($maxRedirects) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('setMaxRedirects', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* HOOK to be executed when config changes with `_reconfigure`.
|
|
* @see \Codeception\Module\Doctrine2::onReconfigure()
|
|
*/
|
|
public function onReconfigure() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('onReconfigure', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Performs $em->flush();
|
|
* @see \Codeception\Module\Doctrine2::flushToDatabase()
|
|
*/
|
|
public function flushToDatabase() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('flushToDatabase', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Performs $em->refresh() on every passed entity:
|
|
*
|
|
* ``` php
|
|
* $I->refreshEntities($user);
|
|
* $I->refreshEntities([$post1, $post2, $post3]]);
|
|
* ```
|
|
*
|
|
* This can useful in acceptance tests where entity can become invalid due to
|
|
* external (relative to entity manager used in tests) changes.
|
|
*
|
|
* @param object|object[] $entities
|
|
* @see \Codeception\Module\Doctrine2::refreshEntities()
|
|
*/
|
|
public function refreshEntities($entities) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('refreshEntities', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Performs $em->clear():
|
|
*
|
|
* ``` php
|
|
* $I->clearEntityManager();
|
|
* ```
|
|
* @see \Codeception\Module\Doctrine2::clearEntityManager()
|
|
*/
|
|
public function clearEntityManager() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('clearEntityManager', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* This method is deprecated in favor of `haveInRepository()`. Its functionality is exactly the same.
|
|
* @see \Codeception\Module\Doctrine2::persistEntity()
|
|
*/
|
|
public function persistEntity($obj, $values = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('persistEntity', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Mocks the repository.
|
|
*
|
|
* With this action you can redefine any method of any repository.
|
|
* Please, note: this fake repositories will be accessible through entity manager till the end of test.
|
|
*
|
|
* Example:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
*
|
|
* $I->haveFakeRepository(User::class, ['findByUsername' => function($username) { return null; }]);
|
|
*
|
|
* ```
|
|
*
|
|
* This creates a stub class for Entity\User repository with redefined method findByUsername,
|
|
* which will always return the NULL value.
|
|
*
|
|
* @param $classname
|
|
* @param array $methods
|
|
* @see \Codeception\Module\Doctrine2::haveFakeRepository()
|
|
*/
|
|
public function haveFakeRepository($classname, $methods = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('haveFakeRepository', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Persists a record into the repository.
|
|
* This method creates an entity, and sets its properties directly (via reflection).
|
|
* Setters of the entity won't be executed, but you can create almost any entity and save it to the database.
|
|
* If the entity has a constructor, for optional parameters the default value will be used and for non-optional parameters the given fields (with a matching name) will be passed when calling the constructor before the properties get set directly (via reflection).
|
|
*
|
|
* Returns the primary key of the newly created entity. The primary key value is extracted using Reflection API.
|
|
* If the primary key is composite, an array of values is returned.
|
|
*
|
|
* ```php
|
|
* $I->haveInRepository(User::class, ['name' => 'davert']);
|
|
* ```
|
|
*
|
|
* This method also accepts instances as first argument, which is useful when the entity constructor
|
|
* has some arguments:
|
|
*
|
|
* ```php
|
|
* $I->haveInRepository(new User($arg), ['name' => 'davert']);
|
|
* ```
|
|
*
|
|
* Alternatively, constructor arguments can be passed by name. Given User constructor signature is `__constructor($arg)`, the example above could be rewritten like this:
|
|
*
|
|
* ```php
|
|
* $I->haveInRepository(User::class, ['arg' => $arg, 'name' => 'davert']);
|
|
* ```
|
|
*
|
|
* If the entity has relations, they can be populated too. In case of
|
|
* [OneToMany](https://www.doctrine-project.org/projects/doctrine-orm/en/latest/reference/association-mapping.html#one-to-many-bidirectional)
|
|
* the following format is expected:
|
|
*
|
|
* ```php
|
|
* $I->haveInRepository(User::class, [
|
|
* 'name' => 'davert',
|
|
* 'posts' => [
|
|
* ['title' => 'Post 1'],
|
|
* ['title' => 'Post 2'],
|
|
* ],
|
|
* ]);
|
|
* ```
|
|
*
|
|
* For [ManyToOne](https://www.doctrine-project.org/projects/doctrine-orm/en/latest/reference/association-mapping.html#many-to-one-unidirectional)
|
|
* the format is slightly different:
|
|
*
|
|
* ```php
|
|
* $I->haveInRepository(User::class, [
|
|
* 'name' => 'davert',
|
|
* 'post' => [
|
|
* 'title' => 'Post 1',
|
|
* ],
|
|
* ]);
|
|
* ```
|
|
*
|
|
* This works recursively, so you can create deep structures in a single call.
|
|
*
|
|
* Note that `$em->persist()`, `$em->refresh()`, and `$em->flush()` are called every time.
|
|
*
|
|
* @param string|object $classNameOrInstance
|
|
* @param array $data
|
|
* @return mixed
|
|
* @see \Codeception\Module\Doctrine2::haveInRepository()
|
|
*/
|
|
public function haveInRepository($classNameOrInstance, $data = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('haveInRepository', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Loads fixtures. Fixture can be specified as a fully qualified class name,
|
|
* an instance, or an array of class names/instances.
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->loadFixtures(AppFixtures::class);
|
|
* $I->loadFixtures([AppFixtures1::class, AppFixtures2::class]);
|
|
* $I->loadFixtures(new AppFixtures);
|
|
* ```
|
|
*
|
|
* By default fixtures are loaded in 'append' mode. To replace all
|
|
* data in database, use `false` as second parameter:
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->loadFixtures(AppFixtures::class, false);
|
|
* ```
|
|
*
|
|
* This method requires [`doctrine/data-fixtures`](https://github.com/doctrine/data-fixtures) to be installed.
|
|
*
|
|
* @param string|string[]|object[] $fixtures
|
|
* @param bool $append
|
|
* @throws ModuleException
|
|
* @throws ModuleRequireException
|
|
* @see \Codeception\Module\Doctrine2::loadFixtures()
|
|
*/
|
|
public function loadFixtures($fixtures, $append = true) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('loadFixtures', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Flushes changes to database, and executes a query with parameters defined in an array.
|
|
* You can use entity associations to build complex queries.
|
|
*
|
|
* Example:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeInRepository(User::class, ['name' => 'davert']);
|
|
* $I->seeInRepository(User::class, ['name' => 'davert', 'Company' => ['name' => 'Codegyre']]);
|
|
* $I->seeInRepository(Client::class, ['User' => ['Company' => ['name' => 'Codegyre']]]);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* Fails if record for given criteria can\'t be found,
|
|
*
|
|
* @param $entity
|
|
* @param array $params
|
|
* @see \Codeception\Module\Doctrine2::seeInRepository()
|
|
*/
|
|
public function seeInRepository($entity, $params = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInRepository', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Flushes changes to database, and executes a query with parameters defined in an array.
|
|
* You can use entity associations to build complex queries.
|
|
*
|
|
* Example:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeInRepository(User::class, ['name' => 'davert']);
|
|
* $I->seeInRepository(User::class, ['name' => 'davert', 'Company' => ['name' => 'Codegyre']]);
|
|
* $I->seeInRepository(Client::class, ['User' => ['Company' => ['name' => 'Codegyre']]]);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* Fails if record for given criteria can\'t be found,
|
|
*
|
|
* @param $entity
|
|
* @param array $params
|
|
* @see \Codeception\Module\Doctrine2::seeInRepository()
|
|
*/
|
|
public function canSeeInRepository($entity, $params = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInRepository', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Flushes changes to database and performs `findOneBy()` call for current repository.
|
|
*
|
|
* @param $entity
|
|
* @param array $params
|
|
* @see \Codeception\Module\Doctrine2::dontSeeInRepository()
|
|
*/
|
|
public function dontSeeInRepository($entity, $params = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeInRepository', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Flushes changes to database and performs `findOneBy()` call for current repository.
|
|
*
|
|
* @param $entity
|
|
* @param array $params
|
|
* @see \Codeception\Module\Doctrine2::dontSeeInRepository()
|
|
*/
|
|
public function cantSeeInRepository($entity, $params = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInRepository', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Selects field value from repository.
|
|
* It builds query based on array of parameters.
|
|
* You can use entity associations to build complex queries.
|
|
*
|
|
* Example:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $email = $I->grabFromRepository(User::class, 'email', ['name' => 'davert']);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @version 1.1
|
|
* @param $entity
|
|
* @param $field
|
|
* @param array $params
|
|
* @return mixed
|
|
* @see \Codeception\Module\Doctrine2::grabFromRepository()
|
|
*/
|
|
public function grabFromRepository($entity, $field, $params = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabFromRepository', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Selects entities from repository.
|
|
* It builds query based on array of parameters.
|
|
* You can use entity associations to build complex queries.
|
|
*
|
|
* Example:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $users = $I->grabEntitiesFromRepository(User::class, ['name' => 'davert']);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @version 1.1
|
|
* @param $entity
|
|
* @param array $params. For `IS NULL`, use `['field' => null]`
|
|
* @return array
|
|
* @see \Codeception\Module\Doctrine2::grabEntitiesFromRepository()
|
|
*/
|
|
public function grabEntitiesFromRepository($entity, $params = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabEntitiesFromRepository', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Selects a single entity from repository.
|
|
* It builds query based on array of parameters.
|
|
* You can use entity associations to build complex queries.
|
|
*
|
|
* Example:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $user = $I->grabEntityFromRepository(User::class, ['id' => '1234']);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @version 1.1
|
|
* @param $entity
|
|
* @param array $params. For `IS NULL`, use `['field' => null]`
|
|
* @return object
|
|
* @see \Codeception\Module\Doctrine2::grabEntityFromRepository()
|
|
*/
|
|
public function grabEntityFromRepository($entity, $params = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabEntityFromRepository', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks over the given HTTP header and (optionally)
|
|
* its value, asserting that are there
|
|
*
|
|
* @param $name
|
|
* @param $value
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeHttpHeader()
|
|
*/
|
|
public function seeHttpHeader($name, $value = NULL) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeHttpHeader', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks over the given HTTP header and (optionally)
|
|
* its value, asserting that are there
|
|
*
|
|
* @param $name
|
|
* @param $value
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeHttpHeader()
|
|
*/
|
|
public function canSeeHttpHeader($name, $value = NULL) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeHttpHeader', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks over the given HTTP header and (optionally)
|
|
* its value, asserting that are not there
|
|
*
|
|
* @param $name
|
|
* @param $value
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::dontSeeHttpHeader()
|
|
*/
|
|
public function dontSeeHttpHeader($name, $value = NULL) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeHttpHeader', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks over the given HTTP header and (optionally)
|
|
* its value, asserting that are not there
|
|
*
|
|
* @param $name
|
|
* @param $value
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::dontSeeHttpHeader()
|
|
*/
|
|
public function cantSeeHttpHeader($name, $value = NULL) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeHttpHeader', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that http response header is received only once.
|
|
* HTTP RFC2616 allows multiple response headers with the same name.
|
|
* You can check that you didn't accidentally sent the same header twice.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeHttpHeaderOnce('Cache-Control');
|
|
* ?>>
|
|
* ```
|
|
*
|
|
* @param $name
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeHttpHeaderOnce()
|
|
*/
|
|
public function seeHttpHeaderOnce($name) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeHttpHeaderOnce', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that http response header is received only once.
|
|
* HTTP RFC2616 allows multiple response headers with the same name.
|
|
* You can check that you didn't accidentally sent the same header twice.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeHttpHeaderOnce('Cache-Control');
|
|
* ?>>
|
|
* ```
|
|
*
|
|
* @param $name
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeHttpHeaderOnce()
|
|
*/
|
|
public function canSeeHttpHeaderOnce($name) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeHttpHeaderOnce', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Returns the value of the specified header name
|
|
*
|
|
* @param $name
|
|
* @param Boolean $first Whether to return the first value or all header values
|
|
*
|
|
* @return string|array The first header value if $first is true, an array of values otherwise
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::grabHttpHeader()
|
|
*/
|
|
public function grabHttpHeader($name, $first = true) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabHttpHeader', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Adds Digest authentication via username/password.
|
|
*
|
|
* @param $username
|
|
* @param $password
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::amDigestAuthenticated()
|
|
*/
|
|
public function amDigestAuthenticated($username, $password) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Condition('amDigestAuthenticated', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Adds Bearer authentication via access token.
|
|
*
|
|
* @param $accessToken
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::amBearerAuthenticated()
|
|
*/
|
|
public function amBearerAuthenticated($accessToken) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Condition('amBearerAuthenticated', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Adds NTLM authentication via username/password.
|
|
* Requires client to be Guzzle >=6.3.0
|
|
* Out of scope for functional modules.
|
|
*
|
|
* Example:
|
|
* ```php
|
|
* <?php
|
|
* $I->amNTLMAuthenticated('jon_snow', 'targaryen');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $username
|
|
* @param $password
|
|
* @throws ModuleException
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::amNTLMAuthenticated()
|
|
*/
|
|
public function amNTLMAuthenticated($username, $password) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Condition('amNTLMAuthenticated', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Allows to send REST request using AWS Authorization
|
|
*
|
|
* Only works with PhpBrowser
|
|
* Example Config:
|
|
* ```yml
|
|
* modules:
|
|
* enabled:
|
|
* - REST:
|
|
* aws:
|
|
* key: accessKey
|
|
* secret: accessSecret
|
|
* service: awsService
|
|
* region: awsRegion
|
|
* ```
|
|
* Code:
|
|
* ```php
|
|
* <?php
|
|
* $I->amAWSAuthenticated();
|
|
* ?>
|
|
* ```
|
|
* @param array $additionalAWSConfig
|
|
* @throws ModuleException
|
|
* @see \Codeception\Module\REST::amAWSAuthenticated()
|
|
*/
|
|
public function amAWSAuthenticated($additionalAWSConfig = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Condition('amAWSAuthenticated', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends a POST request to given uri. Parameters and files can be provided separately.
|
|
*
|
|
* Example:
|
|
* ```php
|
|
* <?php
|
|
* //simple POST call
|
|
* $I->sendPost('/message', ['subject' => 'Read this!', 'to' => 'johndoe@example.com']);
|
|
* //simple upload method
|
|
* $I->sendPost('/message/24', ['inline' => 0], ['attachmentFile' => codecept_data_dir('sample_file.pdf')]);
|
|
* //uploading a file with a custom name and mime-type. This is also useful to simulate upload errors.
|
|
* $I->sendPost('/message/24', ['inline' => 0], [
|
|
* 'attachmentFile' => [
|
|
* 'name' => 'document.pdf',
|
|
* 'type' => 'application/pdf',
|
|
* 'error' => UPLOAD_ERR_OK,
|
|
* 'size' => filesize(codecept_data_dir('sample_file.pdf')),
|
|
* 'tmp_name' => codecept_data_dir('sample_file.pdf')
|
|
* ]
|
|
* ]);
|
|
* // If your field names contain square brackets (e.g. `<input type="text" name="form[task]">`),
|
|
* // PHP parses them into an array. In this case you need to pass the fields like this:
|
|
* $I->sendPost('/add-task', ['form' => [
|
|
* 'task' => 'lorem ipsum',
|
|
* 'category' => 'miscellaneous',
|
|
* ]]);
|
|
* ```
|
|
*
|
|
* @param $url
|
|
* @param array|\JsonSerializable $params
|
|
* @param array $files A list of filenames or "mocks" of $_FILES (each entry being an array with the following
|
|
* keys: name, type, error, size, tmp_name (pointing to the real file path). Each key works
|
|
* as the "name" attribute of a file input field.
|
|
*
|
|
* @see http://php.net/manual/en/features.file-upload.post-method.php
|
|
* @see codecept_data_dir()
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::sendPost()
|
|
*/
|
|
public function sendPost($url, $params = [], $files = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('sendPost', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends a HEAD request to given uri.
|
|
*
|
|
* @param $url
|
|
* @param array $params
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::sendHead()
|
|
*/
|
|
public function sendHead($url, $params = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('sendHead', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends an OPTIONS request to given uri.
|
|
*
|
|
* @param $url
|
|
* @param array $params
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::sendOptions()
|
|
*/
|
|
public function sendOptions($url, $params = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('sendOptions', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends a GET request to given uri.
|
|
*
|
|
* @param $url
|
|
* @param array $params
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::sendGet()
|
|
*/
|
|
public function sendGet($url, $params = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('sendGet', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends PUT request to given uri.
|
|
*
|
|
* @param $url
|
|
* @param array $params
|
|
* @param array $files
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::sendPut()
|
|
*/
|
|
public function sendPut($url, $params = [], $files = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('sendPut', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends PATCH request to given uri.
|
|
*
|
|
* @param $url
|
|
* @param array $params
|
|
* @param array $files
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::sendPatch()
|
|
*/
|
|
public function sendPatch($url, $params = [], $files = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('sendPatch', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends DELETE request to given uri.
|
|
*
|
|
* @param $url
|
|
* @param array $params
|
|
* @param array $files
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::sendDelete()
|
|
*/
|
|
public function sendDelete($url, $params = [], $files = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('sendDelete', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends LINK request to given uri.
|
|
*
|
|
* @param $url
|
|
* @param array $linkEntries (entry is array with keys "uri" and "link-param")
|
|
*
|
|
* @link http://tools.ietf.org/html/rfc2068#section-19.6.2.4
|
|
*
|
|
* @author samva.ua@gmail.com
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::sendLink()
|
|
*/
|
|
public function sendLink($url, $linkEntries) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('sendLink', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends UNLINK request to given uri.
|
|
*
|
|
* @param $url
|
|
* @param array $linkEntries (entry is array with keys "uri" and "link-param")
|
|
* @link http://tools.ietf.org/html/rfc2068#section-19.6.2.4
|
|
* @author samva.ua@gmail.com
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::sendUnlink()
|
|
*/
|
|
public function sendUnlink($url, $linkEntries) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('sendUnlink', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether last response was valid JSON.
|
|
* This is done with json_last_error function.
|
|
*
|
|
* @part json
|
|
* @see \Codeception\Module\REST::seeResponseIsJson()
|
|
*/
|
|
public function seeResponseIsJson() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseIsJson', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks whether last response was valid JSON.
|
|
* This is done with json_last_error function.
|
|
*
|
|
* @part json
|
|
* @see \Codeception\Module\REST::seeResponseIsJson()
|
|
*/
|
|
public function canSeeResponseIsJson() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseIsJson', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether the last response contains text.
|
|
*
|
|
* @param $text
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeResponseContains()
|
|
*/
|
|
public function seeResponseContains($text) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseContains', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks whether the last response contains text.
|
|
*
|
|
* @param $text
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeResponseContains()
|
|
*/
|
|
public function canSeeResponseContains($text) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseContains', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether last response do not contain text.
|
|
*
|
|
* @param $text
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::dontSeeResponseContains()
|
|
*/
|
|
public function dontSeeResponseContains($text) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeResponseContains', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks whether last response do not contain text.
|
|
*
|
|
* @param $text
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::dontSeeResponseContains()
|
|
*/
|
|
public function cantSeeResponseContains($text) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseContains', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether the last JSON response contains provided array.
|
|
* The response is converted to array with json_decode($response, true)
|
|
* Thus, JSON is represented by associative array.
|
|
* This method matches that response array contains provided array.
|
|
*
|
|
* Examples:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // response: {name: john, email: john@gmail.com}
|
|
* $I->seeResponseContainsJson(array('name' => 'john'));
|
|
*
|
|
* // response {user: john, profile: { email: john@gmail.com }}
|
|
* $I->seeResponseContainsJson(array('email' => 'john@gmail.com'));
|
|
*
|
|
* ?>
|
|
* ```
|
|
*
|
|
* This method recursively checks if one array can be found inside of another.
|
|
*
|
|
* @param array $json
|
|
* @part json
|
|
* @see \Codeception\Module\REST::seeResponseContainsJson()
|
|
*/
|
|
public function seeResponseContainsJson($json = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseContainsJson', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks whether the last JSON response contains provided array.
|
|
* The response is converted to array with json_decode($response, true)
|
|
* Thus, JSON is represented by associative array.
|
|
* This method matches that response array contains provided array.
|
|
*
|
|
* Examples:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // response: {name: john, email: john@gmail.com}
|
|
* $I->seeResponseContainsJson(array('name' => 'john'));
|
|
*
|
|
* // response {user: john, profile: { email: john@gmail.com }}
|
|
* $I->seeResponseContainsJson(array('email' => 'john@gmail.com'));
|
|
*
|
|
* ?>
|
|
* ```
|
|
*
|
|
* This method recursively checks if one array can be found inside of another.
|
|
*
|
|
* @param array $json
|
|
* @part json
|
|
* @see \Codeception\Module\REST::seeResponseContainsJson()
|
|
*/
|
|
public function canSeeResponseContainsJson($json = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseContainsJson', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether last response matches the supplied json schema (https://json-schema.org/)
|
|
* Supply schema as json string.
|
|
*
|
|
* Examples:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // response: {"name": "john", "age": 20}
|
|
* $I->seeResponseIsValidOnJsonSchemaString('{"type": "object"}');
|
|
*
|
|
* // response {"name": "john", "age": 20}
|
|
* $schema = [
|
|
* "properties" => [
|
|
* "age" => [
|
|
* "type" => "integer",
|
|
* "minimum" => 18
|
|
* ]
|
|
* ]
|
|
* ];
|
|
* $I->seeResponseIsValidOnJsonSchemaString(json_encode($schema));
|
|
*
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param string $schema
|
|
* @part json
|
|
* @see \Codeception\Module\REST::seeResponseIsValidOnJsonSchemaString()
|
|
*/
|
|
public function seeResponseIsValidOnJsonSchemaString($schema) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseIsValidOnJsonSchemaString', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks whether last response matches the supplied json schema (https://json-schema.org/)
|
|
* Supply schema as json string.
|
|
*
|
|
* Examples:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // response: {"name": "john", "age": 20}
|
|
* $I->seeResponseIsValidOnJsonSchemaString('{"type": "object"}');
|
|
*
|
|
* // response {"name": "john", "age": 20}
|
|
* $schema = [
|
|
* "properties" => [
|
|
* "age" => [
|
|
* "type" => "integer",
|
|
* "minimum" => 18
|
|
* ]
|
|
* ]
|
|
* ];
|
|
* $I->seeResponseIsValidOnJsonSchemaString(json_encode($schema));
|
|
*
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param string $schema
|
|
* @part json
|
|
* @see \Codeception\Module\REST::seeResponseIsValidOnJsonSchemaString()
|
|
*/
|
|
public function canSeeResponseIsValidOnJsonSchemaString($schema) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseIsValidOnJsonSchemaString', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether last response matches the supplied json schema (https://json-schema.org/)
|
|
* Supply schema as relative file path in your project directory or an absolute path
|
|
*
|
|
* @see codecept_absolute_path()
|
|
*
|
|
* @param string $schemaFilename
|
|
* @part json
|
|
* @see \Codeception\Module\REST::seeResponseIsValidOnJsonSchema()
|
|
*/
|
|
public function seeResponseIsValidOnJsonSchema($schemaFilename) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseIsValidOnJsonSchema', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks whether last response matches the supplied json schema (https://json-schema.org/)
|
|
* Supply schema as relative file path in your project directory or an absolute path
|
|
*
|
|
* @see codecept_absolute_path()
|
|
*
|
|
* @param string $schemaFilename
|
|
* @part json
|
|
* @see \Codeception\Module\REST::seeResponseIsValidOnJsonSchema()
|
|
*/
|
|
public function canSeeResponseIsValidOnJsonSchema($schemaFilename) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseIsValidOnJsonSchema', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Returns current response so that it can be used in next scenario steps.
|
|
*
|
|
* Example:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $user_id = $I->grabResponse();
|
|
* $I->sendPut('/user', array('id' => $user_id, 'name' => 'davert'));
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @return string
|
|
* @part json
|
|
* @part xml
|
|
* @version 1.1
|
|
* @see \Codeception\Module\REST::grabResponse()
|
|
*/
|
|
public function grabResponse() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabResponse', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Returns data from the current JSON response using [JSONPath](http://goessner.net/articles/JsonPath/) as selector.
|
|
* JsonPath is XPath equivalent for querying Json structures.
|
|
* Try your JsonPath expressions [online](http://jsonpath.curiousconcept.com/).
|
|
* Even for a single value an array is returned.
|
|
*
|
|
* This method **require [`flow/jsonpath` > 0.2](https://github.com/FlowCommunications/JSONPath/) library to be installed**.
|
|
*
|
|
* Example:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // match the first `user.id` in json
|
|
* $firstUserId = $I->grabDataFromResponseByJsonPath('$..users[0].id');
|
|
* $I->sendPut('/user', array('id' => $firstUserId[0], 'name' => 'davert'));
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param string $jsonPath
|
|
* @return array Array of matching items
|
|
* @throws \Exception
|
|
* @part json
|
|
* @version 2.0.9
|
|
* @see \Codeception\Module\REST::grabDataFromResponseByJsonPath()
|
|
*/
|
|
public function grabDataFromResponseByJsonPath($jsonPath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabDataFromResponseByJsonPath', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks if json structure in response matches the xpath provided.
|
|
* JSON is not supposed to be checked against XPath, yet it can be converted to xml and used with XPath.
|
|
* This assertion allows you to check the structure of response json.
|
|
* *
|
|
* ```json
|
|
* { "store": {
|
|
* "book": [
|
|
* { "category": "reference",
|
|
* "author": "Nigel Rees",
|
|
* "title": "Sayings of the Century",
|
|
* "price": 8.95
|
|
* },
|
|
* { "category": "fiction",
|
|
* "author": "Evelyn Waugh",
|
|
* "title": "Sword of Honour",
|
|
* "price": 12.99
|
|
* }
|
|
* ],
|
|
* "bicycle": {
|
|
* "color": "red",
|
|
* "price": 19.95
|
|
* }
|
|
* }
|
|
* }
|
|
* ```
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* // at least one book in store has author
|
|
* $I->seeResponseJsonMatchesXpath('//store/book/author');
|
|
* // first book in store has author
|
|
* $I->seeResponseJsonMatchesXpath('//store/book[1]/author');
|
|
* // at least one item in store has price
|
|
* $I->seeResponseJsonMatchesXpath('/store//price');
|
|
* ?>
|
|
* ```
|
|
* @param string $xpath
|
|
* @part json
|
|
* @version 2.0.9
|
|
* @see \Codeception\Module\REST::seeResponseJsonMatchesXpath()
|
|
*/
|
|
public function seeResponseJsonMatchesXpath($xpath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseJsonMatchesXpath', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks if json structure in response matches the xpath provided.
|
|
* JSON is not supposed to be checked against XPath, yet it can be converted to xml and used with XPath.
|
|
* This assertion allows you to check the structure of response json.
|
|
* *
|
|
* ```json
|
|
* { "store": {
|
|
* "book": [
|
|
* { "category": "reference",
|
|
* "author": "Nigel Rees",
|
|
* "title": "Sayings of the Century",
|
|
* "price": 8.95
|
|
* },
|
|
* { "category": "fiction",
|
|
* "author": "Evelyn Waugh",
|
|
* "title": "Sword of Honour",
|
|
* "price": 12.99
|
|
* }
|
|
* ],
|
|
* "bicycle": {
|
|
* "color": "red",
|
|
* "price": 19.95
|
|
* }
|
|
* }
|
|
* }
|
|
* ```
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* // at least one book in store has author
|
|
* $I->seeResponseJsonMatchesXpath('//store/book/author');
|
|
* // first book in store has author
|
|
* $I->seeResponseJsonMatchesXpath('//store/book[1]/author');
|
|
* // at least one item in store has price
|
|
* $I->seeResponseJsonMatchesXpath('/store//price');
|
|
* ?>
|
|
* ```
|
|
* @param string $xpath
|
|
* @part json
|
|
* @version 2.0.9
|
|
* @see \Codeception\Module\REST::seeResponseJsonMatchesXpath()
|
|
*/
|
|
public function canSeeResponseJsonMatchesXpath($xpath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseJsonMatchesXpath', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Opposite to seeResponseJsonMatchesXpath
|
|
*
|
|
* @param string $xpath
|
|
* @part json
|
|
* @see \Codeception\Module\REST::dontSeeResponseJsonMatchesXpath()
|
|
*/
|
|
public function dontSeeResponseJsonMatchesXpath($xpath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeResponseJsonMatchesXpath', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Opposite to seeResponseJsonMatchesXpath
|
|
*
|
|
* @param string $xpath
|
|
* @part json
|
|
* @see \Codeception\Module\REST::dontSeeResponseJsonMatchesXpath()
|
|
*/
|
|
public function cantSeeResponseJsonMatchesXpath($xpath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseJsonMatchesXpath', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks if json structure in response matches [JsonPath](http://goessner.net/articles/JsonPath/).
|
|
* JsonPath is XPath equivalent for querying Json structures.
|
|
* Try your JsonPath expressions [online](http://jsonpath.curiousconcept.com/).
|
|
* This assertion allows you to check the structure of response json.
|
|
*
|
|
* This method **require [`flow/jsonpath` > 0.2](https://github.com/FlowCommunications/JSONPath/) library to be installed**.
|
|
*
|
|
* ```json
|
|
* { "store": {
|
|
* "book": [
|
|
* { "category": "reference",
|
|
* "author": "Nigel Rees",
|
|
* "title": "Sayings of the Century",
|
|
* "price": 8.95
|
|
* },
|
|
* { "category": "fiction",
|
|
* "author": "Evelyn Waugh",
|
|
* "title": "Sword of Honour",
|
|
* "price": 12.99
|
|
* }
|
|
* ],
|
|
* "bicycle": {
|
|
* "color": "red",
|
|
* "price": 19.95
|
|
* }
|
|
* }
|
|
* }
|
|
* ```
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* // at least one book in store has author
|
|
* $I->seeResponseJsonMatchesJsonPath('$.store.book[*].author');
|
|
* // first book in store has author
|
|
* $I->seeResponseJsonMatchesJsonPath('$.store.book[0].author');
|
|
* // at least one item in store has price
|
|
* $I->seeResponseJsonMatchesJsonPath('$.store..price');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param string $jsonPath
|
|
* @part json
|
|
* @version 2.0.9
|
|
* @see \Codeception\Module\REST::seeResponseJsonMatchesJsonPath()
|
|
*/
|
|
public function seeResponseJsonMatchesJsonPath($jsonPath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseJsonMatchesJsonPath', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks if json structure in response matches [JsonPath](http://goessner.net/articles/JsonPath/).
|
|
* JsonPath is XPath equivalent for querying Json structures.
|
|
* Try your JsonPath expressions [online](http://jsonpath.curiousconcept.com/).
|
|
* This assertion allows you to check the structure of response json.
|
|
*
|
|
* This method **require [`flow/jsonpath` > 0.2](https://github.com/FlowCommunications/JSONPath/) library to be installed**.
|
|
*
|
|
* ```json
|
|
* { "store": {
|
|
* "book": [
|
|
* { "category": "reference",
|
|
* "author": "Nigel Rees",
|
|
* "title": "Sayings of the Century",
|
|
* "price": 8.95
|
|
* },
|
|
* { "category": "fiction",
|
|
* "author": "Evelyn Waugh",
|
|
* "title": "Sword of Honour",
|
|
* "price": 12.99
|
|
* }
|
|
* ],
|
|
* "bicycle": {
|
|
* "color": "red",
|
|
* "price": 19.95
|
|
* }
|
|
* }
|
|
* }
|
|
* ```
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* // at least one book in store has author
|
|
* $I->seeResponseJsonMatchesJsonPath('$.store.book[*].author');
|
|
* // first book in store has author
|
|
* $I->seeResponseJsonMatchesJsonPath('$.store.book[0].author');
|
|
* // at least one item in store has price
|
|
* $I->seeResponseJsonMatchesJsonPath('$.store..price');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param string $jsonPath
|
|
* @part json
|
|
* @version 2.0.9
|
|
* @see \Codeception\Module\REST::seeResponseJsonMatchesJsonPath()
|
|
*/
|
|
public function canSeeResponseJsonMatchesJsonPath($jsonPath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseJsonMatchesJsonPath', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Opposite to seeResponseJsonMatchesJsonPath
|
|
*
|
|
* @param string $jsonPath
|
|
* @part json
|
|
* @see \Codeception\Module\REST::dontSeeResponseJsonMatchesJsonPath()
|
|
*/
|
|
public function dontSeeResponseJsonMatchesJsonPath($jsonPath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeResponseJsonMatchesJsonPath', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Opposite to seeResponseJsonMatchesJsonPath
|
|
*
|
|
* @param string $jsonPath
|
|
* @part json
|
|
* @see \Codeception\Module\REST::dontSeeResponseJsonMatchesJsonPath()
|
|
*/
|
|
public function cantSeeResponseJsonMatchesJsonPath($jsonPath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseJsonMatchesJsonPath', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Opposite to seeResponseContainsJson
|
|
*
|
|
* @part json
|
|
* @param array $json
|
|
* @see \Codeception\Module\REST::dontSeeResponseContainsJson()
|
|
*/
|
|
public function dontSeeResponseContainsJson($json = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeResponseContainsJson', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Opposite to seeResponseContainsJson
|
|
*
|
|
* @part json
|
|
* @param array $json
|
|
* @see \Codeception\Module\REST::dontSeeResponseContainsJson()
|
|
*/
|
|
public function cantSeeResponseContainsJson($json = []) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseContainsJson', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that JSON matches provided types.
|
|
* In case you don't know the actual values of JSON data returned you can match them by type.
|
|
* It starts the check with a root element. If JSON data is an array it will check all elements of it.
|
|
* You can specify the path in the json which should be checked with JsonPath
|
|
*
|
|
* Basic example:
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* // {'user_id': 1, 'name': 'davert', 'is_active': false}
|
|
* $I->seeResponseMatchesJsonType([
|
|
* 'user_id' => 'integer',
|
|
* 'name' => 'string|null',
|
|
* 'is_active' => 'boolean'
|
|
* ]);
|
|
*
|
|
* // narrow down matching with JsonPath:
|
|
* // {"users": [{ "name": "davert"}, {"id": 1}]}
|
|
* $I->seeResponseMatchesJsonType(['name' => 'string'], '$.users[0]');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* You can check if the record contains fields with the data types you expect.
|
|
* The list of possible data types:
|
|
*
|
|
* * string
|
|
* * integer
|
|
* * float
|
|
* * array (json object is array as well)
|
|
* * boolean
|
|
* * null
|
|
*
|
|
* You can also use nested data type structures, and define multiple types for the same field:
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* // {'user_id': 1, 'name': 'davert', 'company': {'name': 'Codegyre'}}
|
|
* $I->seeResponseMatchesJsonType([
|
|
* 'user_id' => 'integer|string', // multiple types
|
|
* 'company' => ['name' => 'string']
|
|
* ]);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* You can also apply filters to check values. Filter can be applied with a `:` char after the type declaration,
|
|
* or after another filter if you need more than one.
|
|
*
|
|
* Here is the list of possible filters:
|
|
*
|
|
* * `integer:>{val}` - checks that integer is greater than {val} (works with float and string types too).
|
|
* * `integer:<{val}` - checks that integer is lower than {val} (works with float and string types too).
|
|
* * `string:url` - checks that value is valid url.
|
|
* * `string:date` - checks that value is date in JavaScript format: https://weblog.west-wind.com/posts/2014/Jan/06/JavaScript-JSON-Date-Parsing-and-real-Dates
|
|
* * `string:email` - checks that value is a valid email according to http://emailregex.com/
|
|
* * `string:regex({val})` - checks that string matches a regex provided with {val}
|
|
*
|
|
* This is how filters can be used:
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* // {'user_id': 1, 'email' => 'davert@codeception.com'}
|
|
* $I->seeResponseMatchesJsonType([
|
|
* 'user_id' => 'string:>0:<1000', // multiple filters can be used
|
|
* 'email' => 'string:regex(~\@~)' // we just check that @ char is included
|
|
* ]);
|
|
*
|
|
* // {'user_id': '1'}
|
|
* $I->seeResponseMatchesJsonType([
|
|
* 'user_id' => 'string:>0', // works with strings as well
|
|
* ]);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* You can also add custom filters by using `{@link JsonType::addCustomFilter()}`.
|
|
* See [JsonType reference](http://codeception.com/docs/reference/JsonType).
|
|
*
|
|
* @part json
|
|
* @param array $jsonType
|
|
* @param string $jsonPath
|
|
* @see JsonType
|
|
* @version 2.1.3
|
|
* @see \Codeception\Module\REST::seeResponseMatchesJsonType()
|
|
*/
|
|
public function seeResponseMatchesJsonType($jsonType, $jsonPath = NULL) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseMatchesJsonType', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that JSON matches provided types.
|
|
* In case you don't know the actual values of JSON data returned you can match them by type.
|
|
* It starts the check with a root element. If JSON data is an array it will check all elements of it.
|
|
* You can specify the path in the json which should be checked with JsonPath
|
|
*
|
|
* Basic example:
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* // {'user_id': 1, 'name': 'davert', 'is_active': false}
|
|
* $I->seeResponseMatchesJsonType([
|
|
* 'user_id' => 'integer',
|
|
* 'name' => 'string|null',
|
|
* 'is_active' => 'boolean'
|
|
* ]);
|
|
*
|
|
* // narrow down matching with JsonPath:
|
|
* // {"users": [{ "name": "davert"}, {"id": 1}]}
|
|
* $I->seeResponseMatchesJsonType(['name' => 'string'], '$.users[0]');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* You can check if the record contains fields with the data types you expect.
|
|
* The list of possible data types:
|
|
*
|
|
* * string
|
|
* * integer
|
|
* * float
|
|
* * array (json object is array as well)
|
|
* * boolean
|
|
* * null
|
|
*
|
|
* You can also use nested data type structures, and define multiple types for the same field:
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* // {'user_id': 1, 'name': 'davert', 'company': {'name': 'Codegyre'}}
|
|
* $I->seeResponseMatchesJsonType([
|
|
* 'user_id' => 'integer|string', // multiple types
|
|
* 'company' => ['name' => 'string']
|
|
* ]);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* You can also apply filters to check values. Filter can be applied with a `:` char after the type declaration,
|
|
* or after another filter if you need more than one.
|
|
*
|
|
* Here is the list of possible filters:
|
|
*
|
|
* * `integer:>{val}` - checks that integer is greater than {val} (works with float and string types too).
|
|
* * `integer:<{val}` - checks that integer is lower than {val} (works with float and string types too).
|
|
* * `string:url` - checks that value is valid url.
|
|
* * `string:date` - checks that value is date in JavaScript format: https://weblog.west-wind.com/posts/2014/Jan/06/JavaScript-JSON-Date-Parsing-and-real-Dates
|
|
* * `string:email` - checks that value is a valid email according to http://emailregex.com/
|
|
* * `string:regex({val})` - checks that string matches a regex provided with {val}
|
|
*
|
|
* This is how filters can be used:
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* // {'user_id': 1, 'email' => 'davert@codeception.com'}
|
|
* $I->seeResponseMatchesJsonType([
|
|
* 'user_id' => 'string:>0:<1000', // multiple filters can be used
|
|
* 'email' => 'string:regex(~\@~)' // we just check that @ char is included
|
|
* ]);
|
|
*
|
|
* // {'user_id': '1'}
|
|
* $I->seeResponseMatchesJsonType([
|
|
* 'user_id' => 'string:>0', // works with strings as well
|
|
* ]);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* You can also add custom filters by using `{@link JsonType::addCustomFilter()}`.
|
|
* See [JsonType reference](http://codeception.com/docs/reference/JsonType).
|
|
*
|
|
* @part json
|
|
* @param array $jsonType
|
|
* @param string $jsonPath
|
|
* @see JsonType
|
|
* @version 2.1.3
|
|
* @see \Codeception\Module\REST::seeResponseMatchesJsonType()
|
|
*/
|
|
public function canSeeResponseMatchesJsonType($jsonType, $jsonPath = NULL) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseMatchesJsonType', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Opposite to `seeResponseMatchesJsonType`.
|
|
*
|
|
* @part json
|
|
* @param $jsonType jsonType structure
|
|
* @param null $jsonPath optionally set specific path to structure with JsonPath
|
|
* @see seeResponseMatchesJsonType
|
|
* @version 2.1.3
|
|
* @see \Codeception\Module\REST::dontSeeResponseMatchesJsonType()
|
|
*/
|
|
public function dontSeeResponseMatchesJsonType($jsonType, $jsonPath = NULL) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeResponseMatchesJsonType', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Opposite to `seeResponseMatchesJsonType`.
|
|
*
|
|
* @part json
|
|
* @param $jsonType jsonType structure
|
|
* @param null $jsonPath optionally set specific path to structure with JsonPath
|
|
* @see seeResponseMatchesJsonType
|
|
* @version 2.1.3
|
|
* @see \Codeception\Module\REST::dontSeeResponseMatchesJsonType()
|
|
*/
|
|
public function cantSeeResponseMatchesJsonType($jsonType, $jsonPath = NULL) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseMatchesJsonType', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks if response is exactly the same as provided.
|
|
*
|
|
* @part json
|
|
* @part xml
|
|
* @param $response
|
|
* @see \Codeception\Module\REST::seeResponseEquals()
|
|
*/
|
|
public function seeResponseEquals($expected) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseEquals', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks if response is exactly the same as provided.
|
|
*
|
|
* @part json
|
|
* @part xml
|
|
* @param $response
|
|
* @see \Codeception\Module\REST::seeResponseEquals()
|
|
*/
|
|
public function canSeeResponseEquals($expected) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseEquals', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether last response was valid XML.
|
|
* This is done with libxml_get_last_error function.
|
|
*
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeResponseIsXml()
|
|
*/
|
|
public function seeResponseIsXml() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseIsXml', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks whether last response was valid XML.
|
|
* This is done with libxml_get_last_error function.
|
|
*
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeResponseIsXml()
|
|
*/
|
|
public function canSeeResponseIsXml() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseIsXml', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether XML response matches XPath
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->seeXmlResponseMatchesXpath('//root/user[@id=1]');
|
|
* ```
|
|
* @part xml
|
|
* @param $xpath
|
|
* @see \Codeception\Module\REST::seeXmlResponseMatchesXpath()
|
|
*/
|
|
public function seeXmlResponseMatchesXpath($xpath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeXmlResponseMatchesXpath', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks whether XML response matches XPath
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->seeXmlResponseMatchesXpath('//root/user[@id=1]');
|
|
* ```
|
|
* @part xml
|
|
* @param $xpath
|
|
* @see \Codeception\Module\REST::seeXmlResponseMatchesXpath()
|
|
*/
|
|
public function canSeeXmlResponseMatchesXpath($xpath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeXmlResponseMatchesXpath', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether XML response does not match XPath
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->dontSeeXmlResponseMatchesXpath('//root/user[@id=1]');
|
|
* ```
|
|
* @part xml
|
|
* @param $xpath
|
|
* @see \Codeception\Module\REST::dontSeeXmlResponseMatchesXpath()
|
|
*/
|
|
public function dontSeeXmlResponseMatchesXpath($xpath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeXmlResponseMatchesXpath', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks whether XML response does not match XPath
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->dontSeeXmlResponseMatchesXpath('//root/user[@id=1]');
|
|
* ```
|
|
* @part xml
|
|
* @param $xpath
|
|
* @see \Codeception\Module\REST::dontSeeXmlResponseMatchesXpath()
|
|
*/
|
|
public function cantSeeXmlResponseMatchesXpath($xpath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeXmlResponseMatchesXpath', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Finds and returns text contents of element.
|
|
* Element is matched by either CSS or XPath
|
|
*
|
|
* @param $cssOrXPath
|
|
* @return string
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::grabTextContentFromXmlElement()
|
|
*/
|
|
public function grabTextContentFromXmlElement($cssOrXPath) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabTextContentFromXmlElement', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Finds and returns attribute of element.
|
|
* Element is matched by either CSS or XPath
|
|
*
|
|
* @param $cssOrXPath
|
|
* @param $attribute
|
|
* @return string
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::grabAttributeFromXmlElement()
|
|
*/
|
|
public function grabAttributeFromXmlElement($cssOrXPath, $attribute) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabAttributeFromXmlElement', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks XML response equals provided XML.
|
|
* Comparison is done by canonicalizing both xml`s.
|
|
*
|
|
* Parameters can be passed either as DOMDocument, DOMNode, XML string, or array (if no attributes).
|
|
*
|
|
* @param $xml
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeXmlResponseEquals()
|
|
*/
|
|
public function seeXmlResponseEquals($xml) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeXmlResponseEquals', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks XML response equals provided XML.
|
|
* Comparison is done by canonicalizing both xml`s.
|
|
*
|
|
* Parameters can be passed either as DOMDocument, DOMNode, XML string, or array (if no attributes).
|
|
*
|
|
* @param $xml
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeXmlResponseEquals()
|
|
*/
|
|
public function canSeeXmlResponseEquals($xml) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeXmlResponseEquals', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks XML response does not equal to provided XML.
|
|
* Comparison is done by canonicalizing both xml`s.
|
|
*
|
|
* Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes).
|
|
*
|
|
* @param $xml
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::dontSeeXmlResponseEquals()
|
|
*/
|
|
public function dontSeeXmlResponseEquals($xml) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeXmlResponseEquals', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks XML response does not equal to provided XML.
|
|
* Comparison is done by canonicalizing both xml`s.
|
|
*
|
|
* Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes).
|
|
*
|
|
* @param $xml
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::dontSeeXmlResponseEquals()
|
|
*/
|
|
public function cantSeeXmlResponseEquals($xml) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeXmlResponseEquals', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks XML response includes provided XML.
|
|
* Comparison is done by canonicalizing both xml`s.
|
|
* Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes).
|
|
*
|
|
* Example:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeXmlResponseIncludes("<result>1</result>");
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $xml
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeXmlResponseIncludes()
|
|
*/
|
|
public function seeXmlResponseIncludes($xml) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeXmlResponseIncludes', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks XML response includes provided XML.
|
|
* Comparison is done by canonicalizing both xml`s.
|
|
* Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes).
|
|
*
|
|
* Example:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeXmlResponseIncludes("<result>1</result>");
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $xml
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeXmlResponseIncludes()
|
|
*/
|
|
public function canSeeXmlResponseIncludes($xml) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeXmlResponseIncludes', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks XML response does not include provided XML.
|
|
* Comparison is done by canonicalizing both xml`s.
|
|
* Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes).
|
|
*
|
|
* @param $xml
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::dontSeeXmlResponseIncludes()
|
|
*/
|
|
public function dontSeeXmlResponseIncludes($xml) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeXmlResponseIncludes', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks XML response does not include provided XML.
|
|
* Comparison is done by canonicalizing both xml`s.
|
|
* Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes).
|
|
*
|
|
* @param $xml
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::dontSeeXmlResponseIncludes()
|
|
*/
|
|
public function cantSeeXmlResponseIncludes($xml) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeXmlResponseIncludes', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks if the hash of a binary response is exactly the same as provided.
|
|
* Parameter can be passed as any hash string supported by hash(), with an
|
|
* optional second parameter to specify the hash type, which defaults to md5.
|
|
*
|
|
* Example: Using md5 hash key
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->seeBinaryResponseEquals("8c90748342f19b195b9c6b4eff742ded");
|
|
* ?>
|
|
* ```
|
|
*
|
|
* Example: Using md5 for a file contents
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $fileData = file_get_contents("test_file.jpg");
|
|
* $I->seeBinaryResponseEquals(md5($fileData));
|
|
* ?>
|
|
* ```
|
|
* Example: Using sha256 hash
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $fileData = '/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k='; // very small jpeg
|
|
* $I->seeBinaryResponseEquals(hash("sha256", base64_decode($fileData)), 'sha256');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $hash the hashed data response expected
|
|
* @param $algo the hash algorithm to use. Default md5.
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeBinaryResponseEquals()
|
|
*/
|
|
public function seeBinaryResponseEquals($hash, $algo = "md5") {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeBinaryResponseEquals', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks if the hash of a binary response is exactly the same as provided.
|
|
* Parameter can be passed as any hash string supported by hash(), with an
|
|
* optional second parameter to specify the hash type, which defaults to md5.
|
|
*
|
|
* Example: Using md5 hash key
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->seeBinaryResponseEquals("8c90748342f19b195b9c6b4eff742ded");
|
|
* ?>
|
|
* ```
|
|
*
|
|
* Example: Using md5 for a file contents
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $fileData = file_get_contents("test_file.jpg");
|
|
* $I->seeBinaryResponseEquals(md5($fileData));
|
|
* ?>
|
|
* ```
|
|
* Example: Using sha256 hash
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $fileData = '/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k='; // very small jpeg
|
|
* $I->seeBinaryResponseEquals(hash("sha256", base64_decode($fileData)), 'sha256');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $hash the hashed data response expected
|
|
* @param $algo the hash algorithm to use. Default md5.
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::seeBinaryResponseEquals()
|
|
*/
|
|
public function canSeeBinaryResponseEquals($hash, $algo = "md5") {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeBinaryResponseEquals', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks if the hash of a binary response is not the same as provided.
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->dontSeeBinaryResponseEquals("8c90748342f19b195b9c6b4eff742ded");
|
|
* ?>
|
|
* ```
|
|
* Opposite to `seeBinaryResponseEquals`
|
|
*
|
|
* @param $hash the hashed data response expected
|
|
* @param $algo the hash algorithm to use. Default md5.
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::dontSeeBinaryResponseEquals()
|
|
*/
|
|
public function dontSeeBinaryResponseEquals($hash, $algo = "md5") {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeBinaryResponseEquals', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks if the hash of a binary response is not the same as provided.
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->dontSeeBinaryResponseEquals("8c90748342f19b195b9c6b4eff742ded");
|
|
* ?>
|
|
* ```
|
|
* Opposite to `seeBinaryResponseEquals`
|
|
*
|
|
* @param $hash the hashed data response expected
|
|
* @param $algo the hash algorithm to use. Default md5.
|
|
* @part json
|
|
* @part xml
|
|
* @see \Codeception\Module\REST::dontSeeBinaryResponseEquals()
|
|
*/
|
|
public function cantSeeBinaryResponseEquals($hash, $algo = "md5") {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeBinaryResponseEquals', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Executes a shell command.
|
|
* Fails if exit code is > 0. You can disable this by passing `false` as second argument
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->runShellCommand('phpunit');
|
|
*
|
|
* // do not fail test when command fails
|
|
* $I->runShellCommand('phpunit', false);
|
|
* ```
|
|
*
|
|
* @param $command
|
|
* @param bool $failNonZero
|
|
* @see \Codeception\Module\Cli::runShellCommand()
|
|
*/
|
|
public function runShellCommand($command, $failNonZero = true) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('runShellCommand', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that output from last executed command contains text
|
|
*
|
|
* @param $text
|
|
* @see \Codeception\Module\Cli::seeInShellOutput()
|
|
*/
|
|
public function seeInShellOutput($text) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInShellOutput', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that output from last executed command contains text
|
|
*
|
|
* @param $text
|
|
* @see \Codeception\Module\Cli::seeInShellOutput()
|
|
*/
|
|
public function canSeeInShellOutput($text) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInShellOutput', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that output from latest command doesn't contain text
|
|
*
|
|
* @param $text
|
|
*
|
|
* @see \Codeception\Module\Cli::dontSeeInShellOutput()
|
|
*/
|
|
public function dontSeeInShellOutput($text) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeInShellOutput', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks that output from latest command doesn't contain text
|
|
*
|
|
* @param $text
|
|
*
|
|
* @see \Codeception\Module\Cli::dontSeeInShellOutput()
|
|
*/
|
|
public function cantSeeInShellOutput($text) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInShellOutput', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* @param $regex
|
|
* @see \Codeception\Module\Cli::seeShellOutputMatches()
|
|
*/
|
|
public function seeShellOutputMatches($regex) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeShellOutputMatches', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* @param $regex
|
|
* @see \Codeception\Module\Cli::seeShellOutputMatches()
|
|
*/
|
|
public function canSeeShellOutputMatches($regex) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeShellOutputMatches', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Returns the output from latest command
|
|
* @see \Codeception\Module\Cli::grabShellOutput()
|
|
*/
|
|
public function grabShellOutput() {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabShellOutput', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks result code. To verify a result code > 0, you need to pass `false` as second argument to `runShellCommand()`
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->seeResultCodeIs(0);
|
|
* ```
|
|
*
|
|
* @param $code
|
|
* @see \Codeception\Module\Cli::seeResultCodeIs()
|
|
*/
|
|
public function seeResultCodeIs($code) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResultCodeIs', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks result code. To verify a result code > 0, you need to pass `false` as second argument to `runShellCommand()`
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->seeResultCodeIs(0);
|
|
* ```
|
|
*
|
|
* @param $code
|
|
* @see \Codeception\Module\Cli::seeResultCodeIs()
|
|
*/
|
|
public function canSeeResultCodeIs($code) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResultCodeIs', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks result code
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->seeResultCodeIsNot(0);
|
|
* ```
|
|
*
|
|
* @param $code
|
|
* @see \Codeception\Module\Cli::seeResultCodeIsNot()
|
|
*/
|
|
public function seeResultCodeIsNot($code) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResultCodeIsNot', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* [!] Conditional Assertion: Test won't be stopped on fail
|
|
* Checks result code
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->seeResultCodeIsNot(0);
|
|
* ```
|
|
*
|
|
* @param $code
|
|
* @see \Codeception\Module\Cli::seeResultCodeIsNot()
|
|
*/
|
|
public function canSeeResultCodeIsNot($code) {
|
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResultCodeIsNot', func_get_args()));
|
|
}
|
|
}
|