diff --git a/.gitignore b/.gitignore index 16ad3316..a182edbf 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ /examples/nosql/vendor /examples/nosql/config/oauth2.sqlite3 /examples/relational/composer.lock -/tests/functional/tests/_log \ No newline at end of file +/tests/functional/tests/_log +tests/_output/* \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index d703777b..6e5e9a0f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,14 +19,13 @@ before_script: - php -S localhost:8000 & - sleep 3 - cd ../.. - - wget http://codeception.com/codecept.phar - - mkdir tests/codecept/tests/_log - - chmod -R 777 tests/codecept/tests/_log + - mkdir tests/functional/tests/_log + - chmod -R 777 tests/functional/tests/_log script: - mkdir -p build/logs - phpunit --coverage-text - - php codecept.phar run api -c tests/codecept/codeception.yml + - ./vendor/bin/codecept run api -d - ./vendor/bin/phpcs src --standard=psr2 after_script: diff --git a/tests/functional/codeception.yml b/codeception.yml similarity index 71% rename from tests/functional/codeception.yml rename to codeception.yml index 5b1f4413..306e7396 100644 --- a/tests/functional/codeception.yml +++ b/codeception.yml @@ -1,14 +1,13 @@ +actor: Tester paths: tests: tests - log: tests/_log + log: tests/_output data: tests/_data - helpers: tests/_helpers + helpers: tests/_support settings: bootstrap: _bootstrap.php - suite_class: \PHPUnit_Framework_TestSuite colors: true memory_limit: 1024M - log: true modules: config: Db: diff --git a/composer.json b/composer.json index d4be2a1d..5d40377e 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "mockery/mockery": "~0.9", "league/phpunit-coverage-listener": "~1.0", "squizlabs/php_codesniffer": "1.*", - "codeception/codeception": "2.0.2" + "codeception/codeception": "2.0.*" }, "repositories": [ { diff --git a/examples/relational/Storage/AccessTokenStorage.php b/examples/relational/Storage/AccessTokenStorage.php index 7339118c..96481de5 100644 --- a/examples/relational/Storage/AccessTokenStorage.php +++ b/examples/relational/Storage/AccessTokenStorage.php @@ -24,9 +24,9 @@ class AccessTokenStorage extends Adapter implements AccessTokenInterface ->get(); if (count($result) === 1) { - $token = new AccessTokenEntity($this->server); - $token->setExpireTime($result[0]['expire_time']); - $token->setToken($result[0]['access_token']); + $token = (new AccessTokenEntity($this->server)) + ->setId($result[0]['access_token']) + ->setExpireTime($result[0]['expire_time']); return $token; } @@ -50,16 +50,17 @@ class AccessTokenStorage extends Adapter implements AccessTokenInterface $result = Capsule::table('oauth_access_token_scopes') ->select(['oauth_scopes.id', 'oauth_scopes.description']) ->join('oauth_scopes', 'oauth_access_token_scopes.scope', '=', 'oauth_scopes.id') - ->where('access_token', $token->getToken()) + ->where('access_token', $token->getId()) ->get(); $response = []; if (count($result) > 0) { foreach ($result as $row) { - $scope = new ScopeEntity($this->server); - $scope->setId($row['id']); - $scope->setDescription($row['description']); + $scope = (new ScopeEntity($this->server))->hydrate([ + 'id' => $row['id'], + 'description' => $row['description'] + ]); $response[] = $scope; } } diff --git a/examples/relational/Storage/AuthCodeStorage.php b/examples/relational/Storage/AuthCodeStorage.php index 856d852d..77126240 100644 --- a/examples/relational/Storage/AuthCodeStorage.php +++ b/examples/relational/Storage/AuthCodeStorage.php @@ -23,7 +23,7 @@ class AuthCodeStorage extends Adapter implements AuthCodeInterface if (count($result) === 1) { $token = new AuthCodeEntity($this->server); - $token->setToken($result[0]['auth_code']); + $token->setId($result[0]['auth_code']); return $token; } diff --git a/examples/relational/api.php b/examples/relational/api.php index 93e9f24e..69463f4e 100644 --- a/examples/relational/api.php +++ b/examples/relational/api.php @@ -10,6 +10,7 @@ use \League\OAuth2\Server\ResourceServer; use \RelationalExample\Storage; use \RelationalExample\Model; use Illuminate\Database\Capsule\Manager as Capsule; +use \League\Event\Emitter; include __DIR__.'/vendor/autoload.php'; diff --git a/examples/relational/composer.json b/examples/relational/composer.json index 3140738c..34bd57cf 100644 --- a/examples/relational/composer.json +++ b/examples/relational/composer.json @@ -2,7 +2,8 @@ "require": { "illuminate/database": "4.1.*", "orno/route": "1.*", - "ircmaxell/password-compat": "1.0.2" + "ircmaxell/password-compat": "1.0.2", + "league/event": "0.2.0" }, "autoload": { "psr-4": { diff --git a/tests/functional/tests/_bootstrap.php b/tests/_bootstrap.php similarity index 100% rename from tests/functional/tests/_bootstrap.php rename to tests/_bootstrap.php diff --git a/tests/_support/ApiHelper.php b/tests/_support/ApiHelper.php new file mode 100644 index 00000000..22b8bbfc --- /dev/null +++ b/tests/_support/ApiHelper.php @@ -0,0 +1,10 @@ +scenario->runStep(new \Codeception\Step\Action('setHeader', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Sets 'url' configuration parameter to hosts subdomain. + * It does not open a page on subdomain. Use `amOnPage` for that + * + * ``` php + * amOnSubdomain('user'); + * $I->amOnPage('/'); + * // moves to http://user.mysite.com/ + * ?> + * ``` + * + * @param $subdomain + * + * @return mixed + * @see \Codeception\Module\PhpBrowser::amOnSubdomain() + */ + public function amOnSubdomain($subdomain) { + return $this->scenario->runStep(new \Codeception\Step\Condition('amOnSubdomain', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Low-level API method. + * If Codeception commands are not enough, use [Guzzle HTTP Client](http://guzzlephp.org/) methods directly + * + * Example: + * + * ``` php + * executeInGuzzle(function (\GuzzleHttp\Client $client) { + * $client->get('/get', ['query' => ['foo' => 'bar']]); + * }); + * ?> + * ``` + * + * It is not recommended to use this command on a regular basis. + * If Codeception lacks important Guzzle Client methods, implement them and submit patches. + * + * @param callable $function + * @see \Codeception\Module\PhpBrowser::executeInGuzzle() + */ + public function executeInGuzzle($function) { + return $this->scenario->runStep(new \Codeception\Step\Action('executeInGuzzle', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Adds HTTP authentication via username/password. + * + * @param $username + * @param $password + * @see \Codeception\Module\REST::amHttpAuthenticated() + */ + public function amHttpAuthenticated($username, $password) { + return $this->scenario->runStep(new \Codeception\Step\Condition('amHttpAuthenticated', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Opens the page. + * Requires relative uri as parameter + * + * Example: + * + * ``` php + * amOnPage('/'); + * // opens /register page + * $I->amOnPage('/register'); + * ?> + * ``` + * + * @param $page + * @see \Codeception\Lib\InnerBrowser::amOnPage() + */ + public function amOnPage($page) { + return $this->scenario->runStep(new \Codeception\Step\Condition('amOnPage', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Perform a click on link or button. + * Link or button are found by their names or CSS selector. + * Submits a form if button is a submit type. + * + * If link is an image it's found by alt attribute value of image. + * If button is image button is found by it's value + * If link or button can't be found by name they are searched by CSS selector. + * + * The second parameter is a context: CSS or XPath locator to narrow the search. + * + * Examples: + * + * ``` php + * 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->scenario->runStep(new \Codeception\Step\Action('click', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Check if current page contains the text specified. + * Specify the css selector to match only specific region. + * + * Examples: + * + * ``` php + * 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 + * ?> + * ``` + * + * @param $text + * @param null $selector + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::see() + */ + public function canSee($text, $selector = null) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('see', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Check if current page contains the text specified. + * Specify the css selector to match only specific region. + * + * Examples: + * + * ``` php + * 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 + * ?> + * ``` + * + * @param $text + * @param null $selector + * @see \Codeception\Lib\InnerBrowser::see() + */ + public function see($text, $selector = null) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('see', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Check if current page doesn't contain the text specified. + * Specify the css selector to match only specific region. + * + * Examples: + * + * ```php + * 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 + * ?> + * ``` + * + * @param $text + * @param null $selector + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSee() + */ + public function cantSee($text, $selector = null) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSee', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Check if current page doesn't contain the text specified. + * Specify the css selector to match only specific region. + * + * Examples: + * + * ```php + * 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 + * ?> + * ``` + * + * @param $text + * @param null $selector + * @see \Codeception\Lib\InnerBrowser::dontSee() + */ + public function dontSee($text, $selector = null) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSee', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if there is a link with text specified. + * Specify url to match link with exact this url. + * + * Examples: + * + * ``` php + * seeLink('Logout'); // matches Logout + * $I->seeLink('Logout','/logout'); // matches Logout + * ?> + * ``` + * + * @param $text + * @param null $url + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeLink() + */ + public function canSeeLink($text, $url = null) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeLink', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if there is a link with text specified. + * Specify url to match link with exact this url. + * + * Examples: + * + * ``` php + * seeLink('Logout'); // matches Logout + * $I->seeLink('Logout','/logout'); // matches Logout + * ?> + * ``` + * + * @param $text + * @param null $url + * @see \Codeception\Lib\InnerBrowser::seeLink() + */ + public function seeLink($text, $url = null) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeLink', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if page doesn't contain the link with text specified. + * Specify url to narrow the results. + * + * Examples: + * + * ``` php + * dontSeeLink('Logout'); // I suppose user is not logged in + * ?> + * ``` + * + * @param $text + * @param null $url + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeLink() + */ + public function cantSeeLink($text, $url = null) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeLink', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if page doesn't contain the link with text specified. + * Specify url to narrow the results. + * + * Examples: + * + * ``` php + * dontSeeLink('Logout'); // I suppose user is not logged in + * ?> + * ``` + * + * @param $text + * @param null $url + * @see \Codeception\Lib\InnerBrowser::dontSeeLink() + */ + public function dontSeeLink($text, $url = null) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeLink', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that current uri contains a value + * + * ``` php + * seeInCurrentUrl('home'); + * // to match: /users/1 + * $I->seeInCurrentUrl('/users/'); + * ?> + * ``` + * + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl() + */ + public function canSeeInCurrentUrl($uri) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeInCurrentUrl', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that current uri contains a value + * + * ``` php + * seeInCurrentUrl('home'); + * // to match: /users/1 + * $I->seeInCurrentUrl('/users/'); + * ?> + * ``` + * + * @param $uri + * @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl() + */ + public function seeInCurrentUrl($uri) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeInCurrentUrl', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that current uri does not contain a value + * + * ``` php + * dontSeeInCurrentUrl('/users/'); + * ?> + * ``` + * + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl() + */ + public function cantSeeInCurrentUrl($uri) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInCurrentUrl', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that current uri does not contain a value + * + * ``` php + * dontSeeInCurrentUrl('/users/'); + * ?> + * ``` + * + * @param $uri + * @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl() + */ + public function dontSeeInCurrentUrl($uri) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeInCurrentUrl', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that current url is equal to value. + * Unlike `seeInCurrentUrl` performs a strict check. + * + * ``` php + * seeCurrentUrlEquals('/'); + * ?> + * ``` + * + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals() + */ + public function canSeeCurrentUrlEquals($uri) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlEquals', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that current url is equal to value. + * Unlike `seeInCurrentUrl` performs a strict check. + * + * ``` php + * seeCurrentUrlEquals('/'); + * ?> + * ``` + * + * @param $uri + * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals() + */ + public function seeCurrentUrlEquals($uri) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeCurrentUrlEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that current url is not equal to value. + * Unlike `dontSeeInCurrentUrl` performs a strict check. + * + * ``` php + * dontSeeCurrentUrlEquals('/'); + * ?> + * ``` + * + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals() + */ + public function cantSeeCurrentUrlEquals($uri) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlEquals', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that current url is not equal to value. + * Unlike `dontSeeInCurrentUrl` performs a strict check. + * + * ``` php + * dontSeeCurrentUrlEquals('/'); + * ?> + * ``` + * + * @param $uri + * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals() + */ + public function dontSeeCurrentUrlEquals($uri) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that current url is matches a RegEx value + * + * ``` php + * seeCurrentUrlMatches('~$/users/(\d+)~'); + * ?> + * ``` + * + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches() + */ + public function canSeeCurrentUrlMatches($uri) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlMatches', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that current url is matches a RegEx value + * + * ``` php + * seeCurrentUrlMatches('~$/users/(\d+)~'); + * ?> + * ``` + * + * @param $uri + * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches() + */ + public function seeCurrentUrlMatches($uri) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeCurrentUrlMatches', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that current url does not match a RegEx value + * + * ``` php + * dontSeeCurrentUrlMatches('~$/users/(\d+)~'); + * ?> + * ``` + * + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches() + */ + public function cantSeeCurrentUrlMatches($uri) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlMatches', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that current url does not match a RegEx value + * + * ``` php + * dontSeeCurrentUrlMatches('~$/users/(\d+)~'); + * ?> + * ``` + * + * @param $uri + * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches() + */ + public function dontSeeCurrentUrlMatches($uri) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlMatches', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Takes a parameters from current URI by RegEx. + * If no url provided returns full URI. + * + * ``` php + * grabFromCurrentUrl('~$/user/(\d+)/~'); + * $uri = $I->grabFromCurrentUrl(); + * ?> + * ``` + * + * @param null $uri + * + * @internal param $url + * @return mixed + * @see \Codeception\Lib\InnerBrowser::grabFromCurrentUrl() + */ + public function grabFromCurrentUrl($uri = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('grabFromCurrentUrl', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Assert if the specified checkbox is checked. + * Use css selector or xpath to match. + * + * Example: + * + * ``` php + * 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 + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeCheckboxIsChecked() + */ + public function canSeeCheckboxIsChecked($checkbox) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeCheckboxIsChecked', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Assert if the specified checkbox is checked. + * Use css selector or xpath to match. + * + * Example: + * + * ``` php + * 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->scenario->runStep(new \Codeception\Step\Assertion('seeCheckboxIsChecked', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Assert if the specified checkbox is unchecked. + * Use css selector or xpath to match. + * + * Example: + * + * ``` php + * 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 + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeCheckboxIsChecked() + */ + public function cantSeeCheckboxIsChecked($checkbox) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCheckboxIsChecked', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Assert if the specified checkbox is unchecked. + * Use css selector or xpath to match. + * + * Example: + * + * ``` php + * 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->scenario->runStep(new \Codeception\Step\Assertion('dontSeeCheckboxIsChecked', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that an input field or textarea contains value. + * Field is matched either by label or CSS or Xpath + * + * Example: + * + * ``` php + * 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 + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeInField() + */ + public function canSeeInField($field, $value) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeInField', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that an input field or textarea contains value. + * Field is matched either by label or CSS or Xpath + * + * Example: + * + * ``` php + * 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->scenario->runStep(new \Codeception\Step\Assertion('seeInField', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that an input field or textarea doesn't contain value. + * Field is matched either by label or CSS or Xpath + * Example: + * + * ``` php + * 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->seeInField(['name' => 'search'], 'Search'); + * ?> + * ``` + * + * @param $field + * @param $value + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeInField() + */ + public function cantSeeInField($field, $value) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInField', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that an input field or textarea doesn't contain value. + * Field is matched either by label or CSS or Xpath + * Example: + * + * ``` php + * 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->seeInField(['name' => 'search'], 'Search'); + * ?> + * ``` + * + * @param $field + * @param $value + * @see \Codeception\Lib\InnerBrowser::dontSeeInField() + */ + public function dontSeeInField($field, $value) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeInField', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Submits a form located on page. + * Specify the form by it's css or xpath selector. + * Fill the form fields values as array. + * + * Skipped fields will be filled by their values from page. + * You don't need to click the 'Submit' button afterwards. + * This command itself triggers the request to form's action. + * + * Examples: + * + * ``` php + * submitForm('#login', array('login' => 'davert', 'password' => '123456')); + * + * ``` + * + * For sample Sign Up form: + * + * ``` html + *
+ * ``` + * I can write this: + * + * ``` php + * submitForm('#userForm', array('user' => array('login' => 'Davert', 'password' => '123456', 'agree' => true))); + * + * ``` + * Note, that pricing plan will be set to Paid, as it's selected on page. + * + * @param $selector + * @param $params + * @see \Codeception\Lib\InnerBrowser::submitForm() + */ + public function submitForm($selector, $params) { + return $this->scenario->runStep(new \Codeception\Step\Action('submitForm', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Fills a text field or textarea with value. + * + * Example: + * + * ``` php + * 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->scenario->runStep(new \Codeception\Step\Action('fillField', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Selects an option in select tag or in radio button group. + * + * Example: + * + * ``` php + * selectOption('form select[name=account]', 'Premium'); + * $I->selectOption('form input[name=payment]', 'Monthly'); + * $I->selectOption('//form/select[@name=account]', 'Monthly'); + * ?> + * ``` + * + * Can select multiple options if second argument is array: + * + * ``` php + * selectOption('Which OS do you use?', array('Windows','Linux')); + * ?> + * ``` + * + * @param $select + * @param $option + * @see \Codeception\Lib\InnerBrowser::selectOption() + */ + public function selectOption($select, $option) { + return $this->scenario->runStep(new \Codeception\Step\Action('selectOption', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Ticks a checkbox. + * For radio buttons use `selectOption` method. + * + * Example: + * + * ``` php + * checkOption('#agree'); + * ?> + * ``` + * + * @param $option + * @see \Codeception\Lib\InnerBrowser::checkOption() + */ + public function checkOption($option) { + return $this->scenario->runStep(new \Codeception\Step\Action('checkOption', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Unticks a checkbox. + * + * Example: + * + * ``` php + * uncheckOption('#notify'); + * ?> + * ``` + * + * @param $option + * @see \Codeception\Lib\InnerBrowser::uncheckOption() + */ + public function uncheckOption($option) { + return $this->scenario->runStep(new \Codeception\Step\Action('uncheckOption', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Attaches file from Codeception data directory to upload field. + * + * Example: + * + * ``` php + * attachFile('input[@type="file"]', 'prices.xls'); + * ?> + * ``` + * + * @param $field + * @param $filename + * @see \Codeception\Lib\InnerBrowser::attachFile() + */ + public function attachFile($field, $filename) { + return $this->scenario->runStep(new \Codeception\Step\Action('attachFile', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * If your page triggers an ajax request, you can perform it manually. + * This action sends a GET ajax request with specified params. + * + * See ->sendAjaxPostRequest for examples. + * + * @param $uri + * @param $params + * @see \Codeception\Lib\InnerBrowser::sendAjaxGetRequest() + */ + public function sendAjaxGetRequest($uri, $params = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('sendAjaxGetRequest', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * If your page triggers an ajax request, you can perform it manually. + * This action sends a POST ajax request with specified params. + * Additional params can be passed as array. + * + * Example: + * + * Imagine that by clicking checkbox you trigger ajax request which updates user settings. + * We emulate that click by running this ajax request manually. + * + * ``` php + * sendAjaxPostRequest('/updateSettings', array('notifications' => true)); // POST + * $I->sendAjaxGetRequest('/updateSettings', array('notifications' => true)); // GET + * + * ``` + * + * @param $uri + * @param $params + * @see \Codeception\Lib\InnerBrowser::sendAjaxPostRequest() + */ + public function sendAjaxPostRequest($uri, $params = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('sendAjaxPostRequest', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * If your page triggers an ajax request, you can perform it manually. + * This action sends an ajax request with specified method and params. + * + * Example: + * + * You need to perform an ajax request specifying the HTTP method. + * + * ``` php + * sendAjaxRequest('PUT', /posts/7', array('title' => 'new title'); + * + * ``` + * + * @param $method + * @param $uri + * @param $params + * @see \Codeception\Lib\InnerBrowser::sendAjaxRequest() + */ + public function sendAjaxRequest($method, $uri, $params = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('sendAjaxRequest', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Finds and returns text contents of element. + * Element is searched by CSS selector, XPath or matcher by regex. + * + * Example: + * + * ``` php + * grabTextFrom('h1'); + * $heading = $I->grabTextFrom('descendant-or-self::h1'); + * $value = $I->grabTextFrom('~ + * ``` + * + * @param $cssOrXPathOrRegex + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::grabTextFrom() + */ + public function grabTextFrom($cssOrXPathOrRegex) { + return $this->scenario->runStep(new \Codeception\Step\Action('grabTextFrom', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Grabs attribute value from an element. + * Fails if element is not found. + * + * ``` php + * grabAttributeFrom('#tooltip', 'title'); + * ?> + * ``` + * + * + * @param $cssOrXpath + * @param $attribute + * @internal param $element + * @return mixed + * @see \Codeception\Lib\InnerBrowser::grabAttributeFrom() + */ + public function grabAttributeFrom($cssOrXpath, $attribute) { + return $this->scenario->runStep(new \Codeception\Step\Action('grabAttributeFrom', 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->scenario->runStep(new \Codeception\Step\Action('grabValueFrom', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Sets a cookie. + * + * @param $cookie + * @param $value + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::setCookie() + */ + public function setCookie($name, $val) { + return $this->scenario->runStep(new \Codeception\Step\Action('setCookie', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Grabs a cookie value. + * + * @param $cookie + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::grabCookie() + */ + public function grabCookie($name) { + return $this->scenario->runStep(new \Codeception\Step\Action('grabCookie', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that cookie is set. + * + * @param $cookie + * + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeCookie() + */ + public function canSeeCookie($name) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeCookie', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that cookie is set. + * + * @param $cookie + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::seeCookie() + */ + public function seeCookie($name) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeCookie', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that cookie doesn't exist + * + * @param $cookie + * + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeCookie() + */ + public function cantSeeCookie($name) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCookie', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that cookie doesn't exist + * + * @param $cookie + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::dontSeeCookie() + */ + public function dontSeeCookie($name) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeCookie', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Unsets cookie + * + * @param $cookie + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::resetCookie() + */ + public function resetCookie($name) { + return $this->scenario->runStep(new \Codeception\Step\Action('resetCookie', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if element exists on a page, matching it by CSS or XPath. + * You can also specify expected attributes of this element. + * + * ``` php + * 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 + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeElement() + */ + public function canSeeElement($selector, $attributes = null) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeElement', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if element exists on a page, matching it by CSS or XPath. + * You can also specify expected attributes of this element. + * + * ``` php + * 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 = null) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeElement', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if element does not exist (or is visible) on a page, matching it by CSS or XPath + * You can also specify expected attributes of this element. + * + * Example: + * + * ``` php + * dontSeeElement('.error'); + * $I->dontSeeElement('//form/input[1]'); + * $I->dontSeeElement('input', ['name' => 'login']); + * $I->dontSeeElement('input', ['value' => '123456']); + * ?> + * ``` + * + * @param $selector + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeElement() + */ + public function cantSeeElement($selector, $attributes = null) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeElement', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if element does not exist (or is visible) on a page, matching it by CSS or XPath + * You can also specify expected attributes of this element. + * + * Example: + * + * ``` php + * dontSeeElement('.error'); + * $I->dontSeeElement('//form/input[1]'); + * $I->dontSeeElement('input', ['name' => 'login']); + * $I->dontSeeElement('input', ['value' => '123456']); + * ?> + * ``` + * + * @param $selector + * @see \Codeception\Lib\InnerBrowser::dontSeeElement() + */ + public function dontSeeElement($selector, $attributes = null) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeElement', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if option is selected in select field. + * + * ``` php + * seeOptionIsSelected('#form input[name=payment]', 'Visa'); + * ?> + * ``` + * + * @param $selector + * @param $optionText + * + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected() + */ + public function canSeeOptionIsSelected($select, $optionText) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeOptionIsSelected', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if option is selected in select field. + * + * ``` php + * seeOptionIsSelected('#form input[name=payment]', 'Visa'); + * ?> + * ``` + * + * @param $selector + * @param $optionText + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected() + */ + public function seeOptionIsSelected($select, $optionText) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeOptionIsSelected', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if option is not selected in select field. + * + * ``` php + * dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); + * ?> + * ``` + * + * @param $selector + * @param $optionText + * + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected() + */ + public function cantSeeOptionIsSelected($select, $optionText) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeOptionIsSelected', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if option is not selected in select field. + * + * ``` php + * dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); + * ?> + * ``` + * + * @param $selector + * @param $optionText + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected() + */ + public function dontSeeOptionIsSelected($select, $optionText) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeOptionIsSelected', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that current page has 404 response status code. + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seePageNotFound() + */ + public function canSeePageNotFound() { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seePageNotFound', 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->scenario->runStep(new \Codeception\Step\Assertion('seePageNotFound', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks response code equals to provided value. + * + * @param $code + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeResponseCodeIs() + */ + public function canSeeResponseCodeIs($code) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIs', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks response code equals to provided value. + * + * @param $code + * @see \Codeception\Module\REST::seeResponseCodeIs() + */ + public function seeResponseCodeIs($code) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeResponseCodeIs', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that page title contains text. + * + * ``` php + * seeInTitle('Blog - Post #1'); + * ?> + * ``` + * + * @param $title + * + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeInTitle() + */ + public function canSeeInTitle($title) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeInTitle', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that page title contains text. + * + * ``` php + * seeInTitle('Blog - Post #1'); + * ?> + * ``` + * + * @param $title + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::seeInTitle() + */ + public function seeInTitle($title) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeInTitle', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that page title does not contain text. + * + * @param $title + * + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeInTitle() + */ + public function cantSeeInTitle($title) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInTitle', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that page title does not contain text. + * + * @param $title + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::dontSeeInTitle() + */ + public function dontSeeInTitle($title) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeInTitle', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Sets HTTP header + * + * @param $name + * @param $value + * @see \Codeception\Module\REST::haveHttpHeader() + */ + public function haveHttpHeader($name, $value) { + return $this->scenario->runStep(new \Codeception\Step\Action('haveHttpHeader', 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 + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeHttpHeader() + */ + public function canSeeHttpHeader($name, $value = null) { + return $this->scenario->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 there + * + * @param $name + * @param $value + * @see \Codeception\Module\REST::seeHttpHeader() + */ + public function seeHttpHeader($name, $value = null) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('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 + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::dontSeeHttpHeader() + */ + public function cantSeeHttpHeader($name, $value = null) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeHttpHeader', 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 + * @see \Codeception\Module\REST::dontSeeHttpHeader() + */ + public function dontSeeHttpHeader($name, $value = null) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('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 + * seeHttpHeaderOnce('Cache-Control'); + * ?>> + * ``` + * + * @param $name + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeHttpHeaderOnce() + */ + public function canSeeHttpHeaderOnce($name) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeHttpHeaderOnce', 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 + * seeHttpHeaderOnce('Cache-Control'); + * ?>> + * ``` + * + * @param $name + * @see \Codeception\Module\REST::seeHttpHeaderOnce() + */ + public function seeHttpHeaderOnce($name) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('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 + * @see \Codeception\Module\REST::grabHttpHeader() + */ + public function grabHttpHeader($name, $first = null) { + return $this->scenario->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 + * @see \Codeception\Module\REST::amDigestAuthenticated() + */ + public function amDigestAuthenticated($username, $password) { + return $this->scenario->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 + * @see \Codeception\Module\REST::amBearerAuthenticated() + */ + public function amBearerAuthenticated($accessToken) { + return $this->scenario->runStep(new \Codeception\Step\Condition('amBearerAuthenticated', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Sends a POST request to given uri. + * + * Parameters and files (as array of filenames) can be provided. + * + * @param $url + * @param array $params + * @param array $files + * @see \Codeception\Module\REST::sendPOST() + */ + public function sendPOST($url, $params = null, $files = null) { + return $this->scenario->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 + * @see \Codeception\Module\REST::sendHEAD() + */ + public function sendHEAD($url, $params = null) { + return $this->scenario->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 + * @see \Codeception\Module\REST::sendOPTIONS() + */ + public function sendOPTIONS($url, $params = null) { + return $this->scenario->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 + * @see \Codeception\Module\REST::sendGET() + */ + public function sendGET($url, $params = null) { + return $this->scenario->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 + * @see \Codeception\Module\REST::sendPUT() + */ + public function sendPUT($url, $params = null, $files = null) { + return $this->scenario->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 + * @see \Codeception\Module\REST::sendPATCH() + */ + public function sendPATCH($url, $params = null, $files = null) { + return $this->scenario->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 + * @see \Codeception\Module\REST::sendDELETE() + */ + public function sendDELETE($url, $params = null, $files = null) { + return $this->scenario->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 + * @see \Codeception\Module\REST::sendLINK() + */ + public function sendLINK($url, $linkEntries) { + return $this->scenario->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 + * @see \Codeception\Module\REST::sendUNLINK() + */ + public function sendUNLINK($url, $linkEntries) { + return $this->scenario->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. + * + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeResponseIsJson() + */ + public function canSeeResponseIsJson() { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseIsJson', 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. + * + * @see \Codeception\Module\REST::seeResponseIsJson() + */ + public function seeResponseIsJson() { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeResponseIsJson', 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. + * + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeResponseIsXml() + */ + public function canSeeResponseIsXml() { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseIsXml', 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. + * + * @see \Codeception\Module\REST::seeResponseIsXml() + */ + public function seeResponseIsXml() { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeResponseIsXml', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks whether the last response contains text. + * + * @param $text + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeResponseContains() + */ + public function canSeeResponseContains($text) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseContains', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks whether the last response contains text. + * + * @param $text + * @see \Codeception\Module\REST::seeResponseContains() + */ + public function seeResponseContains($text) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeResponseContains', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks whether last response do not contain text. + * + * @param $text + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::dontSeeResponseContains() + */ + public function cantSeeResponseContains($text) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseContains', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks whether last response do not contain text. + * + * @param $text + * @see \Codeception\Module\REST::dontSeeResponseContains() + */ + public function dontSeeResponseContains($text) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('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 + * 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 + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeResponseContainsJson() + */ + public function canSeeResponseContainsJson($json = null) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseContainsJson', 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 + * 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 + * @see \Codeception\Module\REST::seeResponseContainsJson() + */ + public function seeResponseContainsJson($json = null) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeResponseContainsJson', 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 + * grabResponse(); + * $I->sendPUT('/user', array('id' => $user_id, 'name' => 'davert')); + * ?> + * ``` + * + * @version 1.1 + * @return string + * @see \Codeception\Module\REST::grabResponse() + */ + public function grabResponse() { + return $this->scenario->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 specified path + * so that it can be used in next scenario steps + * + * Example: + * + * ``` php + * grabDataFromJsonResponse('user.user_id'); + * $I->sendPUT('/user', array('id' => $user_id, 'name' => 'davert')); + * ?> + * ``` + * + * @param string $path + * + * @since 1.1.2 + * @return string + * + * @author tiger.seo@gmail.com + * @see \Codeception\Module\REST::grabDataFromJsonResponse() + */ + public function grabDataFromJsonResponse($path) { + return $this->scenario->runStep(new \Codeception\Step\Action('grabDataFromJsonResponse', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Opposite to seeResponseContainsJson + * + * @param array $json + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::dontSeeResponseContainsJson() + */ + public function cantSeeResponseContainsJson($json = null) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseContainsJson', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Opposite to seeResponseContainsJson + * + * @param array $json + * @see \Codeception\Module\REST::dontSeeResponseContainsJson() + */ + public function dontSeeResponseContainsJson($json = null) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeResponseContainsJson', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if response is exactly the same as provided. + * + * @param $response + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeResponseEquals() + */ + public function canSeeResponseEquals($response) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseEquals', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if response is exactly the same as provided. + * + * @param $response + * @see \Codeception\Module\REST::seeResponseEquals() + */ + public function seeResponseEquals($response) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeResponseEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that response code is not equal to provided value. + * + * @param $code + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::dontSeeResponseCodeIs() + */ + public function cantSeeResponseCodeIs($code) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseCodeIs', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that response code is not equal to provided value. + * + * @param $code + * @see \Codeception\Module\REST::dontSeeResponseCodeIs() + */ + public function dontSeeResponseCodeIs($code) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeResponseCodeIs', func_get_args())); + } +} diff --git a/tests/functional/tests/api/GetUsersAllFieldsCept.php b/tests/api/GetUsersAllFieldsCept.php similarity index 95% rename from tests/functional/tests/api/GetUsersAllFieldsCept.php rename to tests/api/GetUsersAllFieldsCept.php index 7dd93369..7f72fad2 100644 --- a/tests/functional/tests/api/GetUsersAllFieldsCept.php +++ b/tests/api/GetUsersAllFieldsCept.php @@ -1,5 +1,5 @@ wantTo('get all users with all fields'); $I->sendGET('api.php/users?access_token=iamgod'); $I->seeResponseCodeIs(200); diff --git a/tests/functional/tests/api/GetUsersBasicEmailFieldsCept.php b/tests/api/GetUsersBasicEmailFieldsCept.php similarity index 94% rename from tests/functional/tests/api/GetUsersBasicEmailFieldsCept.php rename to tests/api/GetUsersBasicEmailFieldsCept.php index f6619dbf..cb1211a8 100644 --- a/tests/functional/tests/api/GetUsersBasicEmailFieldsCept.php +++ b/tests/api/GetUsersBasicEmailFieldsCept.php @@ -1,5 +1,5 @@ wantTo('get all users with all basic and email fields'); $I->sendGET('api.php/users?access_token=iamphil'); $I->seeResponseCodeIs(200); diff --git a/tests/functional/tests/api/GetUsersBasicPhotoFieldsCept.php b/tests/api/GetUsersBasicPhotoFieldsCept.php similarity index 94% rename from tests/functional/tests/api/GetUsersBasicPhotoFieldsCept.php rename to tests/api/GetUsersBasicPhotoFieldsCept.php index 69745d95..4ee082ea 100644 --- a/tests/functional/tests/api/GetUsersBasicPhotoFieldsCept.php +++ b/tests/api/GetUsersBasicPhotoFieldsCept.php @@ -1,5 +1,5 @@ wantTo('get all users with basic and photo fields'); $I->sendGET('api.php/users?access_token=iamalex'); $I->seeResponseCodeIs(200); diff --git a/tests/functional/tests/api/GetUsersInvalidTokenCept.php b/tests/api/GetUsersInvalidTokenCept.php similarity index 84% rename from tests/functional/tests/api/GetUsersInvalidTokenCept.php rename to tests/api/GetUsersInvalidTokenCept.php index 1ca507e6..e7192460 100644 --- a/tests/functional/tests/api/GetUsersInvalidTokenCept.php +++ b/tests/api/GetUsersInvalidTokenCept.php @@ -1,5 +1,5 @@ wantTo('get all users with an invalid access token'); $I->sendGET('api.php/users?access_token=foobar'); $I->seeResponseCodeIs(401); diff --git a/tests/functional/tests/api/GetUsersNoTokenCept.php b/tests/api/GetUsersNoTokenCept.php similarity index 82% rename from tests/functional/tests/api/GetUsersNoTokenCept.php rename to tests/api/GetUsersNoTokenCept.php index 6d3ae875..93d25c81 100644 --- a/tests/functional/tests/api/GetUsersNoTokenCept.php +++ b/tests/api/GetUsersNoTokenCept.php @@ -1,5 +1,5 @@ wantTo('get all users without an access token'); $I->sendGET('api.php/users'); $I->seeResponseCodeIs(400); diff --git a/tests/functional/tests/api/GetUsersTokenHeaderCept.php b/tests/api/GetUsersTokenHeaderCept.php similarity index 95% rename from tests/functional/tests/api/GetUsersTokenHeaderCept.php rename to tests/api/GetUsersTokenHeaderCept.php index 5a8317e2..31473aba 100644 --- a/tests/functional/tests/api/GetUsersTokenHeaderCept.php +++ b/tests/api/GetUsersTokenHeaderCept.php @@ -1,5 +1,5 @@ wantTo('get all users with header access token'); $I->haveHttpHeader('Authorization', 'Bearer iamgod'); $I->sendGET('api.php/users'); diff --git a/tests/api/_bootstrap.php b/tests/api/_bootstrap.php new file mode 100644 index 00000000..8a885558 --- /dev/null +++ b/tests/api/_bootstrap.php @@ -0,0 +1,2 @@ +submitForm('#login', array('login' => 'davert', 'password' => '123456')); - * - * ``` - * - * For sample Sign Up form: - * - * ``` html - * - * ``` - * I can write this: - * - * ``` php - * submitForm('#userForm', array('user' => array('login' => 'Davert', 'password' => '123456', 'agree' => true))); - * - * ``` - * Note, that pricing plan will be set to Paid, as it's selected on page. - * - * @param $selector - * @param $params - * @see Codeception\Module\PhpBrowser::submitForm() - * @return \Codeception\Maybe - */ - public function submitForm($selector, $params) { - $this->scenario->addStep(new \Codeception\Step\Action('submitForm', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * If your page triggers an ajax request, you can perform it manually. - * This action sends a POST ajax request with specified params. - * Additional params can be passed as array. - * - * Example: - * - * Imagine that by clicking checkbox you trigger ajax request which updates user settings. - * We emulate that click by running this ajax request manually. - * - * ``` php - * sendAjaxPostRequest('/updateSettings', array('notifications' => true)); // POST - * $I->sendAjaxGetRequest('/updateSettings', array('notifications' => true)); // GET - * - * ``` - * - * @param $uri - * @param $params - * @see Codeception\Module\PhpBrowser::sendAjaxPostRequest() - * @return \Codeception\Maybe - */ - public function sendAjaxPostRequest($uri, $params = null) { - $this->scenario->addStep(new \Codeception\Step\Action('sendAjaxPostRequest', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * If your page triggers an ajax request, you can perform it manually. - * This action sends a GET ajax request with specified params. - * - * See ->sendAjaxPostRequest for examples. - * - * @param $uri - * @param $params - * @see Codeception\Module\PhpBrowser::sendAjaxGetRequest() - * @return \Codeception\Maybe - */ - public function sendAjaxGetRequest($uri, $params = null) { - $this->scenario->addStep(new \Codeception\Step\Action('sendAjaxGetRequest', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * If your page triggers an ajax request, you can perform it manually. - * This action sends an ajax request with specified method and params. - * - * Example: - * - * You need to perform an ajax request specifying the HTTP method. - * - * ``` php - * sendAjaxRequest('PUT', /posts/7', array('title' => 'new title'); - * - * ``` - * - * @param $method - * @param $uri - * @param $params - * @see Codeception\Module\PhpBrowser::sendAjaxRequest() - * @return \Codeception\Maybe - */ - public function sendAjaxRequest($method, $uri, $params = null) { - $this->scenario->addStep(new \Codeception\Step\Action('sendAjaxRequest', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Asserts that current page has 404 response status code. - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Module\PhpBrowser::seePageNotFound() - * @return \Codeception\Maybe - */ - public function canSeePageNotFound() { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seePageNotFound', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Asserts that current page has 404 response status code. - * @see Codeception\Module\PhpBrowser::seePageNotFound() - * @return \Codeception\Maybe - */ - public function seePageNotFound() { - $this->scenario->addStep(new \Codeception\Step\Assertion('seePageNotFound', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks response code equals to provided value. - * - * @param $code - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Module\REST::seeResponseCodeIs() - * @return \Codeception\Maybe - */ - public function canSeeResponseCodeIs($code) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIs', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks response code equals to provided value. - * - * @param $code - * @see Codeception\Module\REST::seeResponseCodeIs() - * @return \Codeception\Maybe - */ - public function seeResponseCodeIs($code) { - $this->scenario->addStep(new \Codeception\Step\Assertion('seeResponseCodeIs', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Adds HTTP authentication via username/password. - * - * @param $username - * @param $password - * @see Codeception\Module\REST::amHttpAuthenticated() - * @return \Codeception\Maybe - */ - public function amHttpAuthenticated($username, $password) { - $this->scenario->addStep(new \Codeception\Step\Condition('amHttpAuthenticated', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Low-level API method. - * If Codeception commands are not enough, use [Guzzle HTTP Client](http://guzzlephp.org/) methods directly - * - * Example: - * - * ``` php - * amGoingTo('Sign all requests with OAuth'); - * $I->executeInGuzzle(function (\Guzzle\Http\Client $client) { - * $client->addSubscriber(new Guzzle\Plugin\Oauth\OauthPlugin(array( - * 'consumer_key' => '***', - * 'consumer_secret' => '***', - * 'token' => '***', - * 'token_secret' => '***' - * ))); - * }); - * ?> - * ``` - * - * It is not recommended to use this command on a regular basis. - * If Codeception lacks important Guzzle Client methods, implement them and submit patches. - * - * @param callable $function - * @see Codeception\Module\PhpBrowser::executeInGuzzle() - * @return \Codeception\Maybe - */ - public function executeInGuzzle($function) { - $this->scenario->addStep(new \Codeception\Step\Action('executeInGuzzle', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Assert if the specified checkbox is checked. - * Use css selector or xpath to match. - * - * Example: - * - * ``` php - * 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 - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Module\PhpBrowser::seeCheckboxIsChecked() - * @return \Codeception\Maybe - */ - public function canSeeCheckboxIsChecked($checkbox) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeCheckboxIsChecked', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Assert if the specified checkbox is checked. - * Use css selector or xpath to match. - * - * Example: - * - * ``` php - * 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\Module\PhpBrowser::seeCheckboxIsChecked() - * @return \Codeception\Maybe - */ - public function seeCheckboxIsChecked($checkbox) { - $this->scenario->addStep(new \Codeception\Step\Assertion('seeCheckboxIsChecked', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Assert if the specified checkbox is unchecked. - * Use css selector or xpath to match. - * - * Example: - * - * ``` php - * 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 - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Module\PhpBrowser::dontSeeCheckboxIsChecked() - * @return \Codeception\Maybe - */ - public function cantSeeCheckboxIsChecked($checkbox) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeCheckboxIsChecked', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Assert if the specified checkbox is unchecked. - * Use css selector or xpath to match. - * - * Example: - * - * ``` php - * 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\Module\PhpBrowser::dontSeeCheckboxIsChecked() - * @return \Codeception\Maybe - */ - public function dontSeeCheckboxIsChecked($checkbox) { - $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeCheckboxIsChecked', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Opens the page. - * - * @param $page - * @see Codeception\Util\Mink::amOnPage() - * @return \Codeception\Maybe - */ - public function amOnPage($page) { - $this->scenario->addStep(new \Codeception\Step\Condition('amOnPage', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Sets 'url' configuration parameter to hosts subdomain. - * It does not open a page on subdomain. Use `amOnPage` for that - * - * ``` php - * amOnSubdomain('user'); - * $I->amOnPage('/'); - * // moves to http://user.mysite.com/ - * ?> - * ``` - * @param $subdomain - * @return mixed - * @see Codeception\Util\Mink::amOnSubdomain() - * @return \Codeception\Maybe - */ - public function amOnSubdomain($subdomain) { - $this->scenario->addStep(new \Codeception\Step\Condition('amOnSubdomain', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * @param string $text - * @param string $selector - * - * @return void - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::dontSee() - * @return \Codeception\Maybe - */ - public function cantSee($text, $selector = null) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSee', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * @param string $text - * @param string $selector - * - * @return void - * @see Codeception\Util\Mink::dontSee() - * @return \Codeception\Maybe - */ - public function dontSee($text, $selector = null) { - $this->scenario->addStep(new \Codeception\Step\Assertion('dontSee', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Check if current page contains the text specified. - * Specify the css selector to match only specific region. - * - * Examples: - * - * ``` php - * 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 - * ?> - * ``` - * - * @param $text - * @param null $selector - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::see() - * @return \Codeception\Maybe - */ - public function canSee($text, $selector = null) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('see', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Check if current page contains the text specified. - * Specify the css selector to match only specific region. - * - * Examples: - * - * ``` php - * 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 - * ?> - * ``` - * - * @param $text - * @param null $selector - * @see Codeception\Util\Mink::see() - * @return \Codeception\Maybe - */ - public function see($text, $selector = null) { - $this->scenario->addStep(new \Codeception\Step\Assertion('see', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks if there is a link with text specified. - * Specify url to match link with exact this url. - * - * Examples: - * - * ``` php - * seeLink('Logout'); // matches Logout - * $I->seeLink('Logout','/logout'); // matches Logout - * ?> - * ``` - * - * @param $text - * @param null $url - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::seeLink() - * @return \Codeception\Maybe - */ - public function canSeeLink($text, $url = null) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeLink', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks if there is a link with text specified. - * Specify url to match link with exact this url. - * - * Examples: - * - * ``` php - * seeLink('Logout'); // matches Logout - * $I->seeLink('Logout','/logout'); // matches Logout - * ?> - * ``` - * - * @param $text - * @param null $url - * @see Codeception\Util\Mink::seeLink() - * @return \Codeception\Maybe - */ - public function seeLink($text, $url = null) { - $this->scenario->addStep(new \Codeception\Step\Assertion('seeLink', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks if page doesn't contain the link with text specified. - * Specify url to narrow the results. - * - * Examples: - * - * ``` php - * dontSeeLink('Logout'); // I suppose user is not logged in - * ?> - * ``` - * - * @param $text - * @param null $url - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::dontSeeLink() - * @return \Codeception\Maybe - */ - public function cantSeeLink($text, $url = null) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeLink', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks if page doesn't contain the link with text specified. - * Specify url to narrow the results. - * - * Examples: - * - * ``` php - * dontSeeLink('Logout'); // I suppose user is not logged in - * ?> - * ``` - * - * @param $text - * @param null $url - * @see Codeception\Util\Mink::dontSeeLink() - * @return \Codeception\Maybe - */ - public function dontSeeLink($text, $url = null) { - $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeLink', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Perform a click on link or button. - * Link or button are found by their names or CSS selector. - * Submits a form if button is a submit type. - * - * If link is an image it's found by alt attribute value of image. - * If button is image button is found by it's value - * If link or button can't be found by name they are searched by CSS selector. - * - * The second parameter is a context: CSS or XPath locator to narrow the search. - * - * Examples: - * - * ``` php - * 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'); - * ?> - * ``` - * @param $link - * @param $context - * @see Codeception\Util\Mink::click() - * @return \Codeception\Maybe - */ - public function click($link, $context = null) { - $this->scenario->addStep(new \Codeception\Step\Action('click', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks if element exists on a page, matching it by CSS or XPath - * - * ``` php - * seeElement('.error'); - * $I->seeElement('//form/input[1]'); - * ?> - * ``` - * @param $selector - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::seeElement() - * @return \Codeception\Maybe - */ - public function canSeeElement($selector) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeElement', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks if element exists on a page, matching it by CSS or XPath - * - * ``` php - * seeElement('.error'); - * $I->seeElement('//form/input[1]'); - * ?> - * ``` - * @param $selector - * @see Codeception\Util\Mink::seeElement() - * @return \Codeception\Maybe - */ - public function seeElement($selector) { - $this->scenario->addStep(new \Codeception\Step\Assertion('seeElement', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks if element does not exist (or is visible) on a page, matching it by CSS or XPath - * - * Example: - * - * ``` php - * dontSeeElement('.error'); - * $I->dontSeeElement('//form/input[1]'); - * ?> - * ``` - * @param $selector - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::dontSeeElement() - * @return \Codeception\Maybe - */ - public function cantSeeElement($selector) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeElement', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks if element does not exist (or is visible) on a page, matching it by CSS or XPath - * - * Example: - * - * ``` php - * dontSeeElement('.error'); - * $I->dontSeeElement('//form/input[1]'); - * ?> - * ``` - * @param $selector - * @see Codeception\Util\Mink::dontSeeElement() - * @return \Codeception\Maybe - */ - public function dontSeeElement($selector) { - $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeElement', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Reloads current page - * @see Codeception\Util\Mink::reloadPage() - * @return \Codeception\Maybe - */ - public function reloadPage() { - $this->scenario->addStep(new \Codeception\Step\Action('reloadPage', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Moves back in history - * @see Codeception\Util\Mink::moveBack() - * @return \Codeception\Maybe - */ - public function moveBack() { - $this->scenario->addStep(new \Codeception\Step\Action('moveBack', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Moves forward in history - * @see Codeception\Util\Mink::moveForward() - * @return \Codeception\Maybe - */ - public function moveForward() { - $this->scenario->addStep(new \Codeception\Step\Action('moveForward', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Fills a text field or textarea with value. - * - * Example: - * - * ``` php - * fillField("//input[@type='text']", "Hello World!"); - * ?> - * ``` - * - * @param $field - * @param $value - * @see Codeception\Util\Mink::fillField() - * @return \Codeception\Maybe - */ - public function fillField($field, $value) { - $this->scenario->addStep(new \Codeception\Step\Action('fillField', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Selects an option in select tag or in radio button group. - * - * Example: - * - * ``` php - * selectOption('form select[name=account]', 'Premium'); - * $I->selectOption('form input[name=payment]', 'Monthly'); - * $I->selectOption('//form/select[@name=account]', 'Monthly'); - * ?> - * ``` - * - * Can select multiple options if second argument is array: - * - * ``` php - * selectOption('Which OS do you use?', array('Windows','Linux')); - * ?> - * ``` - * - * @param $select - * @param $option - * @see Codeception\Util\Mink::selectOption() - * @return \Codeception\Maybe - */ - public function selectOption($select, $option) { - $this->scenario->addStep(new \Codeception\Step\Action('selectOption', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Ticks a checkbox. - * For radio buttons use `selectOption` method. - * - * Example: - * - * ``` php - * checkOption('#agree'); - * ?> - * ``` - * - * @param $option - * @see Codeception\Util\Mink::checkOption() - * @return \Codeception\Maybe - */ - public function checkOption($option) { - $this->scenario->addStep(new \Codeception\Step\Action('checkOption', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Unticks a checkbox. - * - * Example: - * - * ``` php - * uncheckOption('#notify'); - * ?> - * ``` - * - * @param $option - * @see Codeception\Util\Mink::uncheckOption() - * @return \Codeception\Maybe - */ - public function uncheckOption($option) { - $this->scenario->addStep(new \Codeception\Step\Action('uncheckOption', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks that current uri contains a value - * - * ``` php - * seeInCurrentUrl('home'); - * // to match: /users/1 - * $I->seeInCurrentUrl('/users/'); - * ?> - * ``` - * - * @param $uri - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::seeInCurrentUrl() - * @return \Codeception\Maybe - */ - public function canSeeInCurrentUrl($uri) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeInCurrentUrl', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks that current uri contains a value - * - * ``` php - * seeInCurrentUrl('home'); - * // to match: /users/1 - * $I->seeInCurrentUrl('/users/'); - * ?> - * ``` - * - * @param $uri - * @see Codeception\Util\Mink::seeInCurrentUrl() - * @return \Codeception\Maybe - */ - public function seeInCurrentUrl($uri) { - $this->scenario->addStep(new \Codeception\Step\Assertion('seeInCurrentUrl', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks that current uri does not contain a value - * - * ``` php - * dontSeeInCurrentUrl('/users/'); - * ?> - * ``` - * - * @param $uri - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::dontSeeInCurrentUrl() - * @return \Codeception\Maybe - */ - public function cantSeeInCurrentUrl($uri) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeInCurrentUrl', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks that current uri does not contain a value - * - * ``` php - * dontSeeInCurrentUrl('/users/'); - * ?> - * ``` - * - * @param $uri - * @see Codeception\Util\Mink::dontSeeInCurrentUrl() - * @return \Codeception\Maybe - */ - public function dontSeeInCurrentUrl($uri) { - $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeInCurrentUrl', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks that current url is equal to value. - * Unlike `seeInCurrentUrl` performs a strict check. - * - * ``` php - * seeCurrentUrlEquals('/'); - * ?> - * ``` - * - * @param $uri - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::seeCurrentUrlEquals() - * @return \Codeception\Maybe - */ - public function canSeeCurrentUrlEquals($uri) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlEquals', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks that current url is equal to value. - * Unlike `seeInCurrentUrl` performs a strict check. - * - * ``` php - * seeCurrentUrlEquals('/'); - * ?> - * ``` - * - * @param $uri - * @see Codeception\Util\Mink::seeCurrentUrlEquals() - * @return \Codeception\Maybe - */ - public function seeCurrentUrlEquals($uri) { - $this->scenario->addStep(new \Codeception\Step\Assertion('seeCurrentUrlEquals', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks that current url is not equal to value. - * Unlike `dontSeeInCurrentUrl` performs a strict check. - * - * ``` php - * dontSeeCurrentUrlEquals('/'); - * ?> - * ``` - * - * @param $uri - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::dontSeeCurrentUrlEquals() - * @return \Codeception\Maybe - */ - public function cantSeeCurrentUrlEquals($uri) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlEquals', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks that current url is not equal to value. - * Unlike `dontSeeInCurrentUrl` performs a strict check. - * - * ``` php - * dontSeeCurrentUrlEquals('/'); - * ?> - * ``` - * - * @param $uri - * @see Codeception\Util\Mink::dontSeeCurrentUrlEquals() - * @return \Codeception\Maybe - */ - public function dontSeeCurrentUrlEquals($uri) { - $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlEquals', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks that current url is matches a RegEx value - * - * ``` php - * seeCurrentUrlMatches('~$/users/(\d+)~'); - * ?> - * ``` - * - * @param $uri - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::seeCurrentUrlMatches() - * @return \Codeception\Maybe - */ - public function canSeeCurrentUrlMatches($uri) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlMatches', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks that current url is matches a RegEx value - * - * ``` php - * seeCurrentUrlMatches('~$/users/(\d+)~'); - * ?> - * ``` - * - * @param $uri - * @see Codeception\Util\Mink::seeCurrentUrlMatches() - * @return \Codeception\Maybe - */ - public function seeCurrentUrlMatches($uri) { - $this->scenario->addStep(new \Codeception\Step\Assertion('seeCurrentUrlMatches', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks that current url does not match a RegEx value - * - * ``` php - * dontSeeCurrentUrlMatches('~$/users/(\d+)~'); - * ?> - * ``` - * - * @param $uri - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::dontSeeCurrentUrlMatches() - * @return \Codeception\Maybe - */ - public function cantSeeCurrentUrlMatches($uri) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlMatches', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks that current url does not match a RegEx value - * - * ``` php - * dontSeeCurrentUrlMatches('~$/users/(\d+)~'); - * ?> - * ``` - * - * @param $uri - * @see Codeception\Util\Mink::dontSeeCurrentUrlMatches() - * @return \Codeception\Maybe - */ - public function dontSeeCurrentUrlMatches($uri) { - $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlMatches', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks that cookie is set. - * - * @param $cookie - * @return mixed - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::seeCookie() - * @return \Codeception\Maybe - */ - public function canSeeCookie($cookie) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeCookie', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks that cookie is set. - * - * @param $cookie - * @return mixed - * @see Codeception\Util\Mink::seeCookie() - * @return \Codeception\Maybe - */ - public function seeCookie($cookie) { - $this->scenario->addStep(new \Codeception\Step\Assertion('seeCookie', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks that cookie doesn't exist - * - * @param $cookie - * @return mixed - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::dontSeeCookie() - * @return \Codeception\Maybe - */ - public function cantSeeCookie($cookie) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeCookie', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks that cookie doesn't exist - * - * @param $cookie - * @return mixed - * @see Codeception\Util\Mink::dontSeeCookie() - * @return \Codeception\Maybe - */ - public function dontSeeCookie($cookie) { - $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeCookie', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Sets a cookie. - * - * @param $cookie - * @param $value - * @return mixed - * @see Codeception\Util\Mink::setCookie() - * @return \Codeception\Maybe - */ - public function setCookie($cookie, $value) { - $this->scenario->addStep(new \Codeception\Step\Action('setCookie', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Unsets cookie - * - * @param $cookie - * @return mixed - * @see Codeception\Util\Mink::resetCookie() - * @return \Codeception\Maybe - */ - public function resetCookie($cookie) { - $this->scenario->addStep(new \Codeception\Step\Action('resetCookie', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Grabs a cookie value. - * - * @param $cookie - * @return mixed - * @see Codeception\Util\Mink::grabCookie() - * @return \Codeception\Maybe - */ - public function grabCookie($cookie) { - $this->scenario->addStep(new \Codeception\Step\Action('grabCookie', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Takes a parameters from current URI by RegEx. - * If no url provided returns full URI. - * - * ``` php - * grabFromCurrentUrl('~$/user/(\d+)/~'); - * $uri = $I->grabFromCurrentUrl(); - * ?> - * ``` - * - * @param null $uri - * @internal param $url - * @return mixed - * @see Codeception\Util\Mink::grabFromCurrentUrl() - * @return \Codeception\Maybe - */ - public function grabFromCurrentUrl($uri = null) { - $this->scenario->addStep(new \Codeception\Step\Action('grabFromCurrentUrl', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Attaches file from Codeception data directory to upload field. - * - * Example: - * - * ``` php - * attachFile('input[@type="file"]', 'prices.xls'); - * ?> - * ``` - * - * @param $field - * @param $filename - * @see Codeception\Util\Mink::attachFile() - * @return \Codeception\Maybe - */ - public function attachFile($field, $filename) { - $this->scenario->addStep(new \Codeception\Step\Action('attachFile', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks if option is selected in select field. - * - * ``` php - * seeOptionIsSelected('#form input[name=payment]', 'Visa'); - * ?> - * ``` - * - * @param $selector - * @param $optionText - * @return mixed - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::seeOptionIsSelected() - * @return \Codeception\Maybe - */ - public function canSeeOptionIsSelected($select, $text) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeOptionIsSelected', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks if option is selected in select field. - * - * ``` php - * seeOptionIsSelected('#form input[name=payment]', 'Visa'); - * ?> - * ``` - * - * @param $selector - * @param $optionText - * @return mixed - * @see Codeception\Util\Mink::seeOptionIsSelected() - * @return \Codeception\Maybe - */ - public function seeOptionIsSelected($select, $text) { - $this->scenario->addStep(new \Codeception\Step\Assertion('seeOptionIsSelected', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks if option is not selected in select field. - * - * ``` php - * dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); - * ?> - * ``` - * - * @param $selector - * @param $optionText - * @return mixed - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::dontSeeOptionIsSelected() - * @return \Codeception\Maybe - */ - public function cantSeeOptionIsSelected($select, $text) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeOptionIsSelected', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks if option is not selected in select field. - * - * ``` php - * dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); - * ?> - * ``` - * - * @param $selector - * @param $optionText - * @return mixed - * @see Codeception\Util\Mink::dontSeeOptionIsSelected() - * @return \Codeception\Maybe - */ - public function dontSeeOptionIsSelected($select, $text) { - $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeOptionIsSelected', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks that an input field or textarea contains value. - * Field is matched either by label or CSS or Xpath - * - * Example: - * - * ``` php - * 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'); - * ?> - * ``` - * - * @param $field - * @param $value - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::seeInField() - * @return \Codeception\Maybe - */ - public function canSeeInField($field, $value) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeInField', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks that an input field or textarea contains value. - * Field is matched either by label or CSS or Xpath - * - * Example: - * - * ``` php - * 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'); - * ?> - * ``` - * - * @param $field - * @param $value - * @see Codeception\Util\Mink::seeInField() - * @return \Codeception\Maybe - */ - public function seeInField($field, $value) { - $this->scenario->addStep(new \Codeception\Step\Assertion('seeInField', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks that an input field or textarea doesn't contain value. - * Field is matched either by label or CSS or Xpath - * Example: - * - * ``` php - * 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'); - * ?> - * ``` - * - * @param $field - * @param $value - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::dontSeeInField() - * @return \Codeception\Maybe - */ - public function cantSeeInField($field, $value) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeInField', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks that an input field or textarea doesn't contain value. - * Field is matched either by label or CSS or Xpath - * Example: - * - * ``` php - * 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'); - * ?> - * ``` - * - * @param $field - * @param $value - * @see Codeception\Util\Mink::dontSeeInField() - * @return \Codeception\Maybe - */ - public function dontSeeInField($field, $value) { - $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeInField', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Finds and returns text contents of element. - * Element is searched by CSS selector, XPath or matcher by regex. - * - * Example: - * - * ``` php - * grabTextFrom('h1'); - * $heading = $I->grabTextFrom('descendant-or-self::h1'); - * $value = $I->grabTextFrom('~ - * ``` - * - * @param $cssOrXPathOrRegex - * @return mixed - * @see Codeception\Util\Mink::grabTextFrom() - * @return \Codeception\Maybe - */ - public function grabTextFrom($cssOrXPathOrRegex) { - $this->scenario->addStep(new \Codeception\Step\Action('grabTextFrom', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Finds and returns field and returns it's value. - * Searches by field name, then by CSS, then by XPath - * - * Example: - * - * ``` php - * grabValueFrom('Name'); - * $name = $I->grabValueFrom('input[name=username]'); - * $name = $I->grabValueFrom('descendant-or-self::form/descendant::input[@name = 'username']'); - * ?> - * ``` - * - * @param $field - * @return mixed - * @see Codeception\Util\Mink::grabValueFrom() - * @return \Codeception\Maybe - */ - public function grabValueFrom($field) { - $this->scenario->addStep(new \Codeception\Step\Action('grabValueFrom', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks that page title contains text. - * - * ``` php - * seeInTitle('Blog - Post #1'); - * ?> - * ``` - * - * @param $title - * @return mixed - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::seeInTitle() - * @return \Codeception\Maybe - */ - public function canSeeInTitle($title) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeInTitle', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks that page title contains text. - * - * ``` php - * seeInTitle('Blog - Post #1'); - * ?> - * ``` - * - * @param $title - * @return mixed - * @see Codeception\Util\Mink::seeInTitle() - * @return \Codeception\Maybe - */ - public function seeInTitle($title) { - $this->scenario->addStep(new \Codeception\Step\Assertion('seeInTitle', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks that page title does not contain text. - * - * @param $title - * @return mixed - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::dontSeeInTitle() - * @return \Codeception\Maybe - */ - public function cantSeeInTitle($title) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeInTitle', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks that page title does not contain text. - * - * @param $title - * @return mixed - * @see Codeception\Util\Mink::dontSeeInTitle() - * @return \Codeception\Maybe - */ - public function dontSeeInTitle($title) { - $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeInTitle', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * - * @see Codeception\Module::getName() - * @return \Codeception\Maybe - */ - public function getName() { - $this->scenario->addStep(new \Codeception\Step\Action('getName', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Sets HTTP header - * - * @param $name - * @param $value - * @see Codeception\Module\REST::haveHttpHeader() - * @return \Codeception\Maybe - */ - public function haveHttpHeader($name, $value) { - $this->scenario->addStep(new \Codeception\Step\Action('haveHttpHeader', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This 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 - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Module\REST::seeHttpHeader() - * @return \Codeception\Maybe - */ - public function canSeeHttpHeader($name, $value = null) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeHttpHeader', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This 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 - * @see Codeception\Module\REST::seeHttpHeader() - * @return \Codeception\Maybe - */ - public function seeHttpHeader($name, $value = null) { - $this->scenario->addStep(new \Codeception\Step\Assertion('seeHttpHeader', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This 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 - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Module\REST::dontSeeHttpHeader() - * @return \Codeception\Maybe - */ - public function cantSeeHttpHeader($name, $value = null) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeHttpHeader', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This 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 - * @see Codeception\Module\REST::dontSeeHttpHeader() - * @return \Codeception\Maybe - */ - public function dontSeeHttpHeader($name, $value = null) { - $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeHttpHeader', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This 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 - * seeHttpHeaderOnce('Cache-Control'); - * ?>> - * ``` - * - * @param $name - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Module\REST::seeHttpHeaderOnce() - * @return \Codeception\Maybe - */ - public function canSeeHttpHeaderOnce($name) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeHttpHeaderOnce', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This 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 - * seeHttpHeaderOnce('Cache-Control'); - * ?>> - * ``` - * - * @param $name - * @see Codeception\Module\REST::seeHttpHeaderOnce() - * @return \Codeception\Maybe - */ - public function seeHttpHeaderOnce($name) { - $this->scenario->addStep(new \Codeception\Step\Assertion('seeHttpHeaderOnce', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This 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 - * @see Codeception\Module\REST::grabHttpHeader() - * @return \Codeception\Maybe - */ - public function grabHttpHeader($name, $first = null) { - $this->scenario->addStep(new \Codeception\Step\Action('grabHttpHeader', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Adds Digest authentication via username/password. - * - * @param $username - * @param $password - * @see Codeception\Module\REST::amDigestAuthenticated() - * @return \Codeception\Maybe - */ - public function amDigestAuthenticated($username, $password) { - $this->scenario->addStep(new \Codeception\Step\Condition('amDigestAuthenticated', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Sends a POST request to given uri. - * - * Parameters and files (as array of filenames) can be provided. - * - * @param $url - * @param array $params - * @param array $files - * @see Codeception\Module\REST::sendPOST() - * @return \Codeception\Maybe - */ - public function sendPOST($url, $params = null, $files = null) { - $this->scenario->addStep(new \Codeception\Step\Action('sendPOST', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Sends a HEAD request to given uri. - * - * @param $url - * @param array $params - * @see Codeception\Module\REST::sendHEAD() - * @return \Codeception\Maybe - */ - public function sendHEAD($url, $params = null) { - $this->scenario->addStep(new \Codeception\Step\Action('sendHEAD', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Sends an OPTIONS request to given uri. - * - * @param $url - * @param array $params - * @see Codeception\Module\REST::sendOPTIONS() - * @return \Codeception\Maybe - */ - public function sendOPTIONS($url, $params = null) { - $this->scenario->addStep(new \Codeception\Step\Action('sendOPTIONS', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Sends a GET request to given uri. - * - * @param $url - * @param array $params - * @see Codeception\Module\REST::sendGET() - * @return \Codeception\Maybe - */ - public function sendGET($url, $params = null) { - $this->scenario->addStep(new \Codeception\Step\Action('sendGET', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Sends PUT request to given uri. - * - * @param $url - * @param array $params - * @param array $files - * @see Codeception\Module\REST::sendPUT() - * @return \Codeception\Maybe - */ - public function sendPUT($url, $params = null, $files = null) { - $this->scenario->addStep(new \Codeception\Step\Action('sendPUT', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Sends PATCH request to given uri. - * - * @param $url - * @param array $params - * @param array $files - * @see Codeception\Module\REST::sendPATCH() - * @return \Codeception\Maybe - */ - public function sendPATCH($url, $params = null, $files = null) { - $this->scenario->addStep(new \Codeception\Step\Action('sendPATCH', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Sends DELETE request to given uri. - * - * @param $url - * @param array $params - * @param array $files - * @see Codeception\Module\REST::sendDELETE() - * @return \Codeception\Maybe - */ - public function sendDELETE($url, $params = null, $files = null) { - $this->scenario->addStep(new \Codeception\Step\Action('sendDELETE', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This 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 - * @see Codeception\Module\REST::sendLINK() - * @return \Codeception\Maybe - */ - public function sendLINK($url, $linkEntries) { - $this->scenario->addStep(new \Codeception\Step\Action('sendLINK', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This 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 - * @see Codeception\Module\REST::sendUNLINK() - * @return \Codeception\Maybe - */ - public function sendUNLINK($url, $linkEntries) { - $this->scenario->addStep(new \Codeception\Step\Action('sendUNLINK', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks whether last response was valid JSON. - * This is done with json_last_error function. - * - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Module\REST::seeResponseIsJson() - * @return \Codeception\Maybe - */ - public function canSeeResponseIsJson() { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeResponseIsJson', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks whether last response was valid JSON. - * This is done with json_last_error function. - * - * @see Codeception\Module\REST::seeResponseIsJson() - * @return \Codeception\Maybe - */ - public function seeResponseIsJson() { - $this->scenario->addStep(new \Codeception\Step\Assertion('seeResponseIsJson', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks whether last response was valid XML. - * This is done with libxml_get_last_error function. - * - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Module\REST::seeResponseIsXml() - * @return \Codeception\Maybe - */ - public function canSeeResponseIsXml() { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeResponseIsXml', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks whether last response was valid XML. - * This is done with libxml_get_last_error function. - * - * @see Codeception\Module\REST::seeResponseIsXml() - * @return \Codeception\Maybe - */ - public function seeResponseIsXml() { - $this->scenario->addStep(new \Codeception\Step\Assertion('seeResponseIsXml', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks whether the last response contains text. - * - * @param $text - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Module\REST::seeResponseContains() - * @return \Codeception\Maybe - */ - public function canSeeResponseContains($text) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeResponseContains', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks whether the last response contains text. - * - * @param $text - * @see Codeception\Module\REST::seeResponseContains() - * @return \Codeception\Maybe - */ - public function seeResponseContains($text) { - $this->scenario->addStep(new \Codeception\Step\Assertion('seeResponseContains', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks whether last response do not contain text. - * - * @param $text - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Module\REST::dontSeeResponseContains() - * @return \Codeception\Maybe - */ - public function cantSeeResponseContains($text) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseContains', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks whether last response do not contain text. - * - * @param $text - * @see Codeception\Module\REST::dontSeeResponseContains() - * @return \Codeception\Maybe - */ - public function dontSeeResponseContains($text) { - $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeResponseContains', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This 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 - * 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 - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Module\REST::seeResponseContainsJson() - * @return \Codeception\Maybe - */ - public function canSeeResponseContainsJson($json = null) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeResponseContainsJson', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This 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 - * 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 - * @see Codeception\Module\REST::seeResponseContainsJson() - * @return \Codeception\Maybe - */ - public function seeResponseContainsJson($json = null) { - $this->scenario->addStep(new \Codeception\Step\Assertion('seeResponseContainsJson', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Returns current response so that it can be used in next scenario steps. - * - * Example: - * - * ``` php - * grabResponse(); - * $I->sendPUT('/user', array('id' => $user_id, 'name' => 'davert')); - * ?> - * ``` - * - * @version 1.1 - * @return string - * @see Codeception\Module\REST::grabResponse() - * @return \Codeception\Maybe - */ - public function grabResponse() { - $this->scenario->addStep(new \Codeception\Step\Action('grabResponse', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Returns data from the current JSON response using specified path - * so that it can be used in next scenario steps - * - * Example: - * - * ``` php - * grabDataFromJsonResponse('user.user_id'); - * $I->sendPUT('/user', array('id' => $user_id, 'name' => 'davert')); - * ?> - * ``` - * - * @param string $path - * - * @since 1.1.2 - * @return string - * - * @author tiger.seo@gmail.com - * @see Codeception\Module\REST::grabDataFromJsonResponse() - * @return \Codeception\Maybe - */ - public function grabDataFromJsonResponse($path) { - $this->scenario->addStep(new \Codeception\Step\Action('grabDataFromJsonResponse', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Opposite to seeResponseContainsJson - * - * @param array $json - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Module\REST::dontSeeResponseContainsJson() - * @return \Codeception\Maybe - */ - public function cantSeeResponseContainsJson($json = null) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseContainsJson', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Opposite to seeResponseContainsJson - * - * @param array $json - * @see Codeception\Module\REST::dontSeeResponseContainsJson() - * @return \Codeception\Maybe - */ - public function dontSeeResponseContainsJson($json = null) { - $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeResponseContainsJson', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks if response is exactly the same as provided. - * - * @param $response - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Module\REST::seeResponseEquals() - * @return \Codeception\Maybe - */ - public function canSeeResponseEquals($response) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeResponseEquals', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks if response is exactly the same as provided. - * - * @param $response - * @see Codeception\Module\REST::seeResponseEquals() - * @return \Codeception\Maybe - */ - public function seeResponseEquals($response) { - $this->scenario->addStep(new \Codeception\Step\Assertion('seeResponseEquals', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks that response code is not equal to provided value. - * - * @param $code - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Module\REST::dontSeeResponseCodeIs() - * @return \Codeception\Maybe - */ - public function cantSeeResponseCodeIs($code) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseCodeIs', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks that response code is not equal to provided value. - * - * @param $code - * @see Codeception\Module\REST::dontSeeResponseCodeIs() - * @return \Codeception\Maybe - */ - public function dontSeeResponseCodeIs($code) { - $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeResponseCodeIs', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } -} - diff --git a/tests/functional/tests/api/_bootstrap.php b/tests/functional/tests/api/_bootstrap.php deleted file mode 100644 index 7dfa7c30..00000000 --- a/tests/functional/tests/api/_bootstrap.php +++ /dev/null @@ -1,2 +0,0 @@ -