diff --git a/.gitignore b/.gitignore index 8ce5024..a8084be 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ composer.phar vendor -package/codecept.phar \ No newline at end of file +package/codecept.phar +composer.lock diff --git a/App/Config/codeception.php b/App/Config/codeception.php index 772ec04..d2128e2 100644 --- a/App/Config/codeception.php +++ b/App/Config/codeception.php @@ -21,8 +21,9 @@ 'sites' => array( - 'Webception' => dirname(__FILE__) .'/../../codeception.yml', - + //'cm5 staff' => dirname(__FILE__) .'\..\..\..\2picrm/modules\staff\codeception.yml', + 'Webception' => dirname(__FILE__) .'/../../codeception.yml' + ), /* @@ -63,6 +64,7 @@ 'CodeGuy.php', '_bootstrap.php', '.DS_Store', + '_steps', ), /* diff --git a/App/Lib/Codeception.php b/App/Lib/Codeception.php index 76971be..d96760d 100644 --- a/App/Lib/Codeception.php +++ b/App/Lib/Codeception.php @@ -112,6 +112,22 @@ public function loadConfig($path, $file) realpath($path . $test_path) : $path . $test_path; } + $config['env'] = array(); + + if (isset($this->config['tests'])) { + foreach ($this->config['tests'] as $type => $active) { + + if (! $active) + break; + + if ($suite = \Symfony\Component\Yaml\Yaml::parse($config['paths']['tests'] . "/$type.suite.yml")) { + if (isset($suite['env'])) { + $config['env'][$type] = array_keys($suite['env']); + } + } + } + } + return $config; } @@ -130,16 +146,29 @@ public function loadTests() if (! $active) break; - $files = new \RecursiveIteratorIterator( - new \RecursiveDirectoryIterator("{$this->config['paths']['tests']}/{$type}/", \FilesystemIterator::SKIP_DOTS), + $testdir = $this->config['paths']['tests'].DIRECTORY_SEPARATOR.$type.DIRECTORY_SEPARATOR; + + if (!is_dir($testdir)) { + // If no directory exists for the test type, continue + continue; + } + + $files = new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator($testdir, \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST ); // Iterate through all the files, and filter out // any files that are in the ignore list. + foreach ($files as $file) { - - if (! in_array($file->getFilename(), $this->config['ignore']) + $pathMatch=false; + foreach($this->config['ignore'] as $k=>$ignorePattern) { + if (strpos($file->getPathname(),$ignorePattern)!==false) { + $pathMatch=true; + } + } + if (!$pathMatch && !in_array($file->getFilename(), $this->config['ignore']) && $file->isFile()) { // Declare a new test and add it to the list. @@ -209,8 +238,10 @@ public function getTestTally() */ public function run(Test $test) { + $env = $this->getEnvironments($test->getType()); + // Get the full command path to run the test. - $command = $this->getCommandPath($test->getType(), $test->getFilename()); + $command = $this->getCommandPath($test->getType(), $test->getFilename(), $env); // Attempt to set the correct writes to Codeceptions Log path. @chmod($this->getLogPath(), 0777); @@ -225,6 +256,26 @@ public function run(Test $test) return $test; } + public function getEnvironments($type) + { + $env = array(); + if (isset($_GET['env'])) { + + foreach(explode(' ', $_GET['env']) as $value){ + if ($value) { + + $value = str_replace($type . '_', '', $value); + if (isset($this->config['env'][$type]) && in_array($value, $this->config['env'][$type])) { + $env[] = '--env=' . $value; + } + + } + } + } + + return $env; + } + /** * Get the Codeception log path * @@ -242,17 +293,22 @@ public function getLogPath() * @param string $filename Name of the Test * @return string Full command to execute Codeception with requred parameters. */ - public function getCommandPath($type, $filename) + public function getCommandPath($type, $filename, $env) { // Build all the different parameters as part of the console command - $params = array( - $this->config['executable'], // Codeception Executable - "run", // Command to Codeception - "--no-colors", // Forcing Codeception to not use colors, if enabled in codeception.yml - "--config=\"{$this->site->getConfig()}\"", // Full path & file of Codeception - $type, // Test Type (Acceptance, Unit, Functional) - $filename, // Filename of the Codeception test - "2>&1" // Added to force output of running executable to be streamed out + $params = array_merge( + array( + $this->config['executable'], // Codeception Executable + "run", // Command to Codeception + "--no-colors", // Forcing Codeception to not use colors, if enabled in codeception.yml + "--config=\"{$this->site->getConfig()}\"", // Full path & file of Codeception + ), + $env, + array( + $type, // Test Type (Acceptance, Unit, Functional) + $filename, // Filename of the Codeception test + "2>&1" // Added to force output of running executable to be streamed out + ) ); // Build the command to be run. @@ -295,6 +351,7 @@ public function getRunResponse($type, $hash) $response['passed'] = $test->passed(); $response['state'] = $test->getState(); $response['title'] = $test->getTitle(); + $response['outputurl'] = "".$test->getTitle().""; } return $response; diff --git a/App/Lib/Test.php b/App/Lib/Test.php index 756bc5b..ebfd635 100644 --- a/App/Lib/Test.php +++ b/App/Lib/Test.php @@ -140,7 +140,7 @@ public function __construct() public function init($type, $file) { $filename = $this->filterFileName($file->getFileName()); - $posTypePath = strpos($file->getPathname(), "/{$type}/") + strlen("/{$type}/"); + $posTypePath = strpos($file->getPathname(), DIRECTORY_SEPARATOR.$type.DIRECTORY_SEPARATOR) + strlen(DIRECTORY_SEPARATOR.$type.DIRECTORY_SEPARATOR); $this->hash = $this->makeHash($type . $filename); $this->title = $this->filterTitle($filename); diff --git a/App/Lib/Test.php.orig b/App/Lib/Test.php.orig new file mode 100644 index 0000000..ebfd635 --- /dev/null +++ b/App/Lib/Test.php.orig @@ -0,0 +1,356 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +class Test +{ + /** + * MD5 of the file name + * + * @var string + */ + private $hash; + + /** + * Filename of the test. + * + * @var string + */ + private $filename; + + /** + * Readable version of the filename + * + * @var string + */ + private $title; + + /** + * The file object. + * + * @var SplFileInfo + */ + private $file; + + /** + * Test Type: Functional, Acceptance or Unit. + * + * @var string + */ + private $type; + + /** + * Log of the test result + * + * @var array Each array entry is a console log line. + */ + private $log = array(); + + /** + * Result of running the test. + * + * @var bool + */ + private $passed = FALSE; + + /** + * Possible test states + */ + const STATE_PASSED = 'passed'; + const STATE_FAILED = 'failed'; + const STATE_ERROR = 'error'; + const STATE_READY = 'ready'; + + /** + * List of responses that can occur from Codeception. + * + * Using these, we scan the result when log is added to the test. + * + * @var array + */ + private $responses = array( + 'timeout' => 'Operation timed out after', + 'writeable' => 'Path for logs is not writable', + 'passed' => array( + 'PASSED', // Functional & Acceptance Test + 'OK \(' // Unit Test + ), + 'failed' => 'FAILURES', + ); + + /** + * On Test __construct, the passed matches are turned into a regex. + * + * @var string + */ + private $passed_regex; + + /** + * Colour tags from Codeception's coloured output. + * + * @var array + */ + private $colour_codes = array( + "[37;45m", + "[2K", + "[1m", + "[0m", + "[30;42m", + "[37;41m", + "[33m", + "[36m", + "[35;1m", + "-", + ); + + /** + * File extensions to remove from the output. + * + * @var array + */ + private $filtered_files = array( + 'Cept.php', + 'Cest.php', + 'Test.php', + ); + + public function __construct() + { + // Declare the regex string containing all the responses that + // can indicate that as a passed test. + $this->passed_regex = implode('|', $this->responses['passed']); + + // maybe there will be any more failures? Then we are going to need this + $this->failure_regex = $this->responses['failed']; + } + + /** + * Initialization of the Test + * + * @param string $type Type of Test + * @param object $file File for the Test + */ + public function init($type, $file) + { + $filename = $this->filterFileName($file->getFileName()); + $posTypePath = strpos($file->getPathname(), DIRECTORY_SEPARATOR.$type.DIRECTORY_SEPARATOR) + strlen(DIRECTORY_SEPARATOR.$type.DIRECTORY_SEPARATOR); + + $this->hash = $this->makeHash($type . $filename); + $this->title = $this->filterTitle($filename); + $this->filename = substr($file->getPathname(), $posTypePath); + $this->file = $file; + $this->type = $type; + $this->state = self::STATE_READY; // Not used yet. + } + + /** + * Filter out content from a title any to improve readability of the test name + * + * @param string $filename + * @return string + */ + public function filterFileName($filename) + { + return str_ireplace($this->filtered_files, '', $filename); + } + + /** + * Generate a unique hash for the test. + * + * @param string $string + * @return string MD5 of $string + */ + public function makeHash($string) + { + return md5($string); + } + + /** + * Turn a "CamelCasedString" into "Camel Cased String". + * This is to improve readability of the test list. + * + * @param string $title + * @return string + */ + public function filterTitle($title) + { + return camel_to_sentance($title); + } + + /** + * Get the Test title + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Get the Test Hash + * + * The hash is the Test title that's been md5'd. + * + * @return string + */ + public function getHash() + { + return $this->hash; + } + + /** + * Get the Test type + * + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Get the file Filename + * + * @return string + */ + public function getFilename() + { + return $this->filename; + } + + /** + * Set if the test has been passed. + * + * @return boolean + */ + public function setPassed() + { + $this->passed = TRUE; + } + + /** + * Sets passed to false if test fails + */ + public function setFailed() + { + $this->passed = false; + } + + /** + * Return if the test was run and passed + * + * @return boolean + */ + public function passed() + { + return $this->passed; + } + + /** + * Return if the test was successfully run. + * + * This is deteremined by simply checking the length of the log. + * + * @return boolean + */ + public function ran() + { + return sizeof($this->log) > 0; + } + + /** + * Get the Test state based on if the test has run or passed. + * + * @return boolean + */ + public function getState() + { + return ($this->passed() ? self::STATE_PASSED : + ($this->ran() ? self::STATE_FAILED : self::STATE_ERROR)); + } + + /** + * Add a new line entry to the Test log. + * + * Also check the log line may indicate if the Test has passed. + * + * @param String $line + */ + public function setLog($lines = array()) + { + $failed = false; + foreach ($lines as $line) { + + if ($this->checkLogForTestPass($line) && $failed==false) + $this->setPassed(); + + if ($this->checkLogForTestFailure($line)) { + $this->setFailed(); + $failed = true; + } + + // Filter the line of any junk and add to the log. + $this->log[] = $this->filterLog($line); + } + } + + /** + * Return the log as a HTML string. + * + * @param $format Split the array into HTML with linebreaks or return as-is if false. + * @return HTML/Array + */ + public function getLog($format = TRUE) + { + return $format ? implode($this->log, PHP_EOL) : $this->log; + } + + /** + * Filter out junk content from a log line. + * + * @param String $line + */ + private function filterLog($line) + { + return str_replace($this->colour_codes, '', $line); + } + + /** + * Check if it contains any text that indiciates that the test has passed. + * + * @param string $line + * @return boolean + */ + public function checkLogForTestPass($line) + { + return count(preg_grep("/({$this->passed_regex})/", array($line))) > 0; + } + + /** + * Checks if line contains failure regex + * + * @param string $line + * @return bool + */ + public function checkLogForTestFailure($line) + { + return count(preg_grep("/({$this->failure_regex})/", array($line))) > 0; + } + + /** + * Reset a Test back to default. + */ + public function reset() + { + $this->log = array(); + $this->passed = FALSE; + } +} diff --git a/App/Routes/webception.route.php b/App/Routes/webception.route.php index a7b78c2..2050457 100644 --- a/App/Routes/webception.route.php +++ b/App/Routes/webception.route.php @@ -25,10 +25,14 @@ $test_count = 0; $webception = $app->config('webception'); $codeception = $app->codeception; + $environments = array(); if ($codeception->ready()) { $tests = $codeception->getTests(); $test_count = $codeception->getTestTally(); + if (isset($codeception->config['env'])) { + $environments = $codeception->config['env']; + } } $app->render('dashboard.html', array( @@ -37,5 +41,6 @@ 'codeception' => $codeception, 'tests' => $tests, 'test_count' => $test_count, + 'environments'=> $environments )); }); diff --git a/App/Routes/webception.route.php.orig b/App/Routes/webception.route.php.orig new file mode 100644 index 0000000..a7b78c2 --- /dev/null +++ b/App/Routes/webception.route.php.orig @@ -0,0 +1,41 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* +|-------------------------------------------------------------------------- +| Route: Dashboard +|-------------------------------------------------------------------------- +| +| The dashboard is the homepage of Webception. It loads all the +| configuration and shows what tests are available to run. +| +*/ + +$app->get('/', function ($site = null) use ($app) { + + $tests = FALSE; + $test_count = 0; + $webception = $app->config('webception'); + $codeception = $app->codeception; + + if ($codeception->ready()) { + $tests = $codeception->getTests(); + $test_count = $codeception->getTestTally(); + } + + $app->render('dashboard.html', array( + 'name' => $app->getName(), + 'webception' => $webception, + 'codeception' => $codeception, + 'tests' => $tests, + 'test_count' => $test_count, + )); +}); diff --git a/App/Templates/dashboard.html b/App/Templates/dashboard.html index 5a9bcaf..4884632 100755 --- a/App/Templates/dashboard.html +++ b/App/Templates/dashboard.html @@ -40,6 +40,25 @@

{{ type|capitalize }} Tests ({{ files|length }} available)

+ {% if attribute(environments, type)|length > 0 %} + +
+
Environments:
+ + {% for env in attribute(environments, type) %} + + + + + {% endfor %} + +
+
+ + {% endif %} +
diff --git a/App/Templates/dashboard.html.orig b/App/Templates/dashboard.html.orig new file mode 100644 index 0000000..5a9bcaf --- /dev/null +++ b/App/Templates/dashboard.html.orig @@ -0,0 +1,128 @@ +{% extends "layout/master.html" %} + +{% block content %} + +{% if codeception.ready() %} + + + +
+
+ + +
+
+

+
+
+
    +
  • +
  • +
+
+
+ + + +
+ +
+ + + +
+ + {% for type, files in tests %} + +
+ +
+ +

{{ type|capitalize }} Tests ({{ files|length }} available)

+ +
+
+ + + + +
+
+ + {% for row in files|batch(2, '') %} + +
+ + {% for file in row %} + + {% if file %} + +
+ +
+ + + + + + + READY + +
+
+ + {% endif %} + + {% endfor %} + +
+ + {% endfor %} + + {# end: for row in files|batch(2, '') #} + +
+ + {% endfor %} + +
+ +
+
+

Console Results

+ +
+
+
+ +
+ + +
+ +{% endif %} + +{% endblock %} \ No newline at end of file diff --git a/App/Tests/acceptance/WebGuy.php b/App/Tests/acceptance/WebGuy.php index 732ab35..d56c3f9 100755 --- a/App/Tests/acceptance/WebGuy.php +++ b/App/Tests/acceptance/WebGuy.php @@ -1,988 +1,902 @@ -scenario->runStep(new \Codeception\Step\Action('setHeader', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. * - * Examples: + * 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 for the given relative URI. * * ``` php * submitForm('#login', array('login' => 'davert', 'password' => '123456')); - * + * // opens front page + * $I->amOnPage('/'); + * // opens /register page + * $I->amOnPage('/register'); + * ?> * ``` * - * For sample Sign Up form: + * @param $page + * @see \Codeception\Module\PhpBrowser::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. * - * ``` html - *
- * Login:
- * Password:
- * Do you agree to out terms?
- * Select pricing plan - * - *
+ * Open web page at the given absolute URL and sets its hostname as the base host. + * + * ``` php + * amOnUrl('http://codeception.com'); + * $I->amOnPage('/quickstart'); // moves to http://codeception.com/quickstart + * ?> * ``` - * I can write this: + * @see \Codeception\Module\PhpBrowser::amOnUrl() + */ + public function amOnUrl($url) { + return $this->scenario->runStep(new \Codeception\Step\Condition('amOnUrl', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Changes the subdomain for the 'url' configuration parameter. + * Does not open a page; use `amOnPage` for that. * * ``` php * submitForm('#userForm', array('user' => array('login' => 'Davert', 'password' => '123456', 'agree' => true))); + * // If config is: 'http://mysite.com' + * // or config is: 'http://www.mysite.com' + * // or config is: 'http://company.mysite.com' * + * $I->amOnSubdomain('user'); + * $I->amOnPage('/'); + * // moves to http://user.mysite.com/ + * ?> * ``` - * 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 + * @param $subdomain + * + * @return mixed + * @see \Codeception\Module\PhpBrowser::amOnSubdomain() */ - 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(); + public function amOnSubdomain($subdomain) { + return $this->scenario->runStep(new \Codeception\Step\Condition('amOnSubdomain', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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. + * Low-level API method. + * If Codeception commands are not enough, use [Guzzle HTTP Client](http://guzzlephp.org/) methods directly * * 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 - * + * $I->executeInGuzzle(function (\GuzzleHttp\Client $client) { + * $client->get('/get', ['query' => ['foo' => 'bar']]); + * }); + * ?> * ``` * - * @param $uri - * @param $params - * @see Codeception\Module\PhpBrowser::sendAjaxPostRequest() - * @return \Codeception\Maybe + * 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 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(); + public function executeInGuzzle($function) { + return $this->scenario->runStep(new \Codeception\Step\Action('executeInGuzzle', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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. + * Perform a click on a link or a button, given by a locator. + * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string. + * For buttons, the "value" attribute, "name" attribute, and inner text are searched. + * For links, the link text is searched. + * For images, the "alt" attribute and inner text of any parent links are searched. * - * See ->sendAjaxPostRequest for examples. + * The second parameter is a context (CSS or XPath locator) to narrow the search. * - * @param $uri - * @param $params - * @see Codeception\Module\PhpBrowser::sendAjaxGetRequest() - * @return \Codeception\Maybe + * Note that if the locator matches a button of type `submit`, the form will be submitted. + * + * ``` 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 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(); + public function click($link, $context = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('click', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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. + * Checks that the current page contains the given string. + * Specify a locator as the second parameter to match a specific region. * - * Example: + * ``` 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 + * ?> + * ``` * - * You need to perform an ajax request specifying the HTTP method. + * @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. + * + * Checks that the current page contains the given string. + * Specify a locator as the second parameter to match a specific region. * * ``` php * sendAjaxRequest('PUT', /posts/7', array('title' => 'new title'); - * + * $I->see('Logout'); // I can suppose user is logged in + * $I->see('Sign Up','h1'); // I can suppose it's a signup page + * $I->see('Sign Up','//body/h1'); // with XPath + * ?> * ``` * - * @param $method - * @param $uri - * @param $params - * @see Codeception\Module\PhpBrowser::sendAjaxRequest() - * @return \Codeception\Maybe + * @param $text + * @param null $selector + * @see \Codeception\Lib\InnerBrowser::see() */ - 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(); + public function see($text, $selector = null) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('see', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * Checks that the current page doesn't contain the text specified. + * Give a locator as the second parameter to match a specific region. + * + * ```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 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(); + public function cantSee($text, $selector = null) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSee', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * Checks that the current page doesn't contain the text specified. + * Give a locator as the second parameter to match a specific region. + * + * ```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 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(); + public function dontSee($text, $selector = null) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSee', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Checks response code equals to provided value. + * Checks that there's a link with the specified text. + * Give a full URL as the second parameter to match links with that exact URL. * - * @param $code - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Module\REST::seeResponseCodeIs() - * @return \Codeception\Maybe + * ``` 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 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(); + public function canSeeLink($text, $url = null) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeLink', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Checks response code equals to provided value. + * Checks that there's a link with the specified text. + * Give a full URL as the second parameter to match links with that exact URL. * - * @param $code - * @see Codeception\Module\REST::seeResponseCodeIs() - * @return \Codeception\Maybe + * ``` php + * seeLink('Logout'); // matches Logout + * $I->seeLink('Logout','/logout'); // matches Logout + * ?> + * ``` + * + * @param $text + * @param null $url + * @see \Codeception\Lib\InnerBrowser::seeLink() */ - 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(); + public function seeLink($text, $url = null) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeLink', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Adds HTTP authentication via username/password. + * Checks that the page doesn't contain a link with the given string. + * If the second parameter is given, only links with a matching "href" attribute will be checked. * - * @param $username - * @param $password - * @see Codeception\Module\REST::amHttpAuthenticated() - * @return \Codeception\Maybe + * ``` php + * dontSeeLink('Logout'); // I suppose user is not logged in + * $I->dontSeeLink('Checkout now', '/store/cart.php'); + * ?> + * ``` + * + * @param $text + * @param null $url + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeLink() */ - 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(); + public function cantSeeLink($text, $url = null) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeLink', func_get_args())); } - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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: + * Checks that the page doesn't contain a link with the given string. + * If the second parameter is given, only links with a matching "href" attribute will be checked. * * ``` php * 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' => '***' - * ))); - * }); + * $I->dontSeeLink('Logout'); // I suppose user is not logged in + * $I->dontSeeLink('Checkout now', '/store/cart.php'); * ?> * ``` * - * Not recommended this command too be used on regular basis. - * If Codeception lacks important Guzzle Client methods implement then and submit patches. - * - * @param callable $function - * @see Codeception\Module\PhpBrowser::executeInGuzzle() - * @return \Codeception\Maybe + * @param $text + * @param null $url + * @see \Codeception\Lib\InnerBrowser::dontSeeLink() */ - 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(); + public function dontSeeLink($text, $url = null) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeLink', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Assert if the specified checkbox is checked. - * Use css selector or xpath to match. - * - * Example: + * Checks that current URI contains the given string. * * ``` 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]'); + * // to match: /home/dashboard + * $I->seeInCurrentUrl('home'); + * // to match: /users/1 + * $I->seeInCurrentUrl('/users/'); * ?> * ``` * - * @param $checkbox - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Module\PhpBrowser::seeCheckboxIsChecked() - * @return \Codeception\Maybe + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl() */ - 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(); + public function canSeeInCurrentUrl($uri) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeInCurrentUrl', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Assert if the specified checkbox is checked. - * Use css selector or xpath to match. - * - * Example: + * Checks that current URI contains the given string. * * ``` 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]'); + * // to match: /home/dashboard + * $I->seeInCurrentUrl('home'); + * // to match: /users/1 + * $I->seeInCurrentUrl('/users/'); * ?> * ``` * - * @param $checkbox - * @see Codeception\Module\PhpBrowser::seeCheckboxIsChecked() - * @return \Codeception\Maybe + * @param $uri + * @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl() */ - 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(); + public function seeInCurrentUrl($uri) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeInCurrentUrl', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Assert if the specified checkbox is unchecked. - * Use css selector or xpath to match. + * [!] Method is generated. Documentation taken from corresponding module. * - * Example: + * Checks that the current URI doesn't contain the given string. * * ``` 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. + * $I->dontSeeInCurrentUrl('/users/'); * ?> * ``` * - * @param $checkbox - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Module\PhpBrowser::dontSeeCheckboxIsChecked() - * @return \Codeception\Maybe + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl() */ - 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(); + public function cantSeeInCurrentUrl($uri) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInCurrentUrl', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Assert if the specified checkbox is unchecked. - * Use css selector or xpath to match. + * [!] Method is generated. Documentation taken from corresponding module. * - * Example: + * Checks that the current URI doesn't contain the given string. * * ``` 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. + * $I->dontSeeInCurrentUrl('/users/'); * ?> * ``` * - * @param $checkbox - * @see Codeception\Module\PhpBrowser::dontSeeCheckboxIsChecked() - * @return \Codeception\Maybe + * @param $uri + * @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl() */ - 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(); + public function dontSeeInCurrentUrl($uri) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeInCurrentUrl', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Opens the page. + * Checks that the current URL is equal to the given string. + * Unlike `seeInCurrentUrl`, this only matches the full URL. * - * @param $page - * @see Codeception\Util\Mink::amOnPage() - * @return \Codeception\Maybe + * ``` php + * seeCurrentUrlEquals('/'); + * ?> + * ``` + * + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals() */ - 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(); + public function canSeeCurrentUrlEquals($uri) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlEquals', func_get_args())); } - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * Checks that the current URL is equal to the given string. + * Unlike `seeInCurrentUrl`, this only matches the full URL. * * ``` php * amOnSubdomain('user'); - * $I->amOnPage('/'); - * // moves to http://user.mysite.com/ + * // to match root url + * $I->seeCurrentUrlEquals('/'); * ?> * ``` - * @param $subdomain - * @return mixed - * @see Codeception\Util\Mink::amOnSubdomain() - * @return \Codeception\Maybe + * + * @param $uri + * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals() */ - 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(); + public function seeCurrentUrlEquals($uri) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeCurrentUrlEquals', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current URL doesn't equal the given string. + * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. * - * @param string $text - * @param string $selector + * ``` php + * dontSeeCurrentUrlEquals('/'); + * ?> + * ``` * - * @return void - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::dontSee() - * @return \Codeception\Maybe + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals() */ - 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(); + public function cantSeeCurrentUrlEquals($uri) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlEquals', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * @param string $text - * @param string $selector + * Checks that the current URL doesn't equal the given string. + * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. * - * @return void - * @see Codeception\Util\Mink::dontSee() - * @return \Codeception\Maybe + * ``` php + * dontSeeCurrentUrlEquals('/'); + * ?> + * ``` + * + * @param $uri + * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals() */ - 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(); + public function dontSeeCurrentUrlEquals($uri) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlEquals', func_get_args())); } /** - * 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. + * [!] Method is generated. Documentation taken from corresponding module. * - * Examples: + * Checks that the current URL matches the given regular expression. * * ``` 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 + * // to match root url + * $I->seeCurrentUrlMatches('~$/users/(\d+)~'); * ?> * ``` * - * @param $text - * @param null $selector - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::see() - * @return \Codeception\Maybe + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches() */ - 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(); + public function canSeeCurrentUrlMatches($uri) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlMatches', func_get_args())); } /** - * 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. + * [!] Method is generated. Documentation taken from corresponding module. * - * Examples: + * Checks that the current URL matches the given regular expression. * * ``` 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 + * // to match root url + * $I->seeCurrentUrlMatches('~$/users/(\d+)~'); * ?> * ``` * - * @param $text - * @param null $selector - * @see Codeception\Util\Mink::see() - * @return \Codeception\Maybe + * @param $uri + * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches() */ - 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(); + public function seeCurrentUrlMatches($uri) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeCurrentUrlMatches', func_get_args())); } /** - * 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. + * [!] Method is generated. Documentation taken from corresponding module. * - * Examples: + * Checks that current url doesn't match the given regular expression. * * ``` php * seeLink('Logout'); // matches Logout - * $I->seeLink('Logout','/logout'); // matches Logout + * // to match root url + * $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~'); * ?> * ``` * - * @param $text - * @param null $url - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::seeLink() - * @return \Codeception\Maybe + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches() */ - 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(); + public function cantSeeCurrentUrlMatches($uri) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlMatches', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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. + * Checks that current url doesn't match the given regular expression. * - * Examples: + * ``` 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. + * + * Executes the given regular expression against the current URI and returns the first match. + * If no parameters are provided, the full URI is returned. * * ``` php * seeLink('Logout'); // matches Logout - * $I->seeLink('Logout','/logout'); // matches Logout + * $user_id = $I->grabFromCurrentUrl('~$/user/(\d+)/~'); + * $uri = $I->grabFromCurrentUrl(); * ?> * ``` * - * @param $text - * @param null $url - * @see Codeception\Util\Mink::seeLink() - * @return \Codeception\Maybe + * @param null $uri + * + * @internal param $url + * @return mixed + * @see \Codeception\Lib\InnerBrowser::grabFromCurrentUrl() */ - 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(); + public function grabFromCurrentUrl($uri = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('grabFromCurrentUrl', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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. + * Checks that the specified checkbox is checked. * - * Examples: + * ``` 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. + * + * Checks that the specified checkbox is checked. * * ``` php * dontSeeLink('Logout'); // I suppose user is not logged in + * $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms + * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form. + * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); * ?> * ``` * - * @param $text - * @param null $url - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::dontSeeLink() - * @return \Codeception\Maybe + * @param $checkbox + * @see \Codeception\Lib\InnerBrowser::seeCheckboxIsChecked() */ - 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(); + public function seeCheckboxIsChecked($checkbox) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeCheckboxIsChecked', func_get_args())); } + + /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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: + * Check that the specified checkbox is unchecked. * * ``` php * dontSeeLink('Logout'); // I suppose user is not logged in + * $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms + * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form. * ?> * ``` * - * @param $text - * @param null $url - * @see Codeception\Util\Mink::dontSeeLink() - * @return \Codeception\Maybe + * @param $checkbox + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeCheckboxIsChecked() */ - 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(); + public function cantSeeCheckboxIsChecked($checkbox) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCheckboxIsChecked', func_get_args())); } - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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: + * Check that the specified checkbox is unchecked. * * ``` 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'); + * $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms + * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form. * ?> * ``` - * @param $link - * @param $context - * @see Codeception\Util\Mink::click() - * @return \Codeception\Maybe + * + * @param $checkbox + * @see \Codeception\Lib\InnerBrowser::dontSeeCheckboxIsChecked() */ - 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(); + public function dontSeeCheckboxIsChecked($checkbox) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeCheckboxIsChecked', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Checks if element exists on a page, matching it by CSS or XPath + * Checks that the given input field or textarea contains the given value. + * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath. * * ``` php * seeElement('.error'); - * $I->seeElement('//form/input[1]'); + * $I->seeInField('Body','Type your comment here'); + * $I->seeInField('form textarea[name=body]','Type your comment here'); + * $I->seeInField('form input[type=hidden]','hidden_value'); + * $I->seeInField('#searchform input','Search'); + * $I->seeInField('//form/*[@name=search]','Search'); + * $I->seeInField(['name' => 'search'], 'Search'); * ?> * ``` - * @param $selector - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::seeElement() - * @return \Codeception\Maybe + * + * @param $field + * @param $value + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeInField() */ - 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(); + public function canSeeInField($field, $value) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeInField', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Checks if element exists on a page, matching it by CSS or XPath + * Checks that the given input field or textarea contains the given value. + * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath. * * ``` php * seeElement('.error'); - * $I->seeElement('//form/input[1]'); + * $I->seeInField('Body','Type your comment here'); + * $I->seeInField('form textarea[name=body]','Type your comment here'); + * $I->seeInField('form input[type=hidden]','hidden_value'); + * $I->seeInField('#searchform input','Search'); + * $I->seeInField('//form/*[@name=search]','Search'); + * $I->seeInField(['name' => 'search'], 'Search'); * ?> * ``` - * @param $selector - * @see Codeception\Util\Mink::seeElement() - * @return \Codeception\Maybe + * + * @param $field + * @param $value + * @see \Codeception\Lib\InnerBrowser::seeInField() */ - 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(); + public function seeInField($field, $value) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeInField', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * Checks that an input field or textarea doesn't contain the given value. + * For fuzzy locators, the field is matched by label text, CSS and XPath. * - * Example: - * * ``` php * dontSeeElement('.error'); - * $I->dontSeeElement('//form/input[1]'); + * $I->dontSeeInField('Body','Type your comment here'); + * $I->dontSeeInField('form textarea[name=body]','Type your comment here'); + * $I->dontSeeInField('form input[type=hidden]','hidden_value'); + * $I->dontSeeInField('#searchform input','Search'); + * $I->dontSeeInField('//form/*[@name=search]','Search'); + * $I->dontSeeInField(['name' => 'search'], 'Search'); * ?> * ``` - * @param $selector - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::dontSeeElement() - * @return \Codeception\Maybe + * + * @param $field + * @param $value + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeInField() */ - 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(); + public function cantSeeInField($field, $value) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInField', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * Checks that an input field or textarea doesn't contain the given value. + * For fuzzy locators, the field is matched by label text, CSS and XPath. * - * Example: - * * ``` php * dontSeeElement('.error'); - * $I->dontSeeElement('//form/input[1]'); + * $I->dontSeeInField('Body','Type your comment here'); + * $I->dontSeeInField('form textarea[name=body]','Type your comment here'); + * $I->dontSeeInField('form input[type=hidden]','hidden_value'); + * $I->dontSeeInField('#searchform input','Search'); + * $I->dontSeeInField('//form/*[@name=search]','Search'); + * $I->dontSeeInField(['name' => 'search'], 'Search'); * ?> * ``` - * @param $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 + * @param $field + * @param $value + * @see \Codeception\Lib\InnerBrowser::dontSeeInField() */ - 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(); + public function dontSeeInField($field, $value) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeInField', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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. - * ---------------------------------------------- + * Submits the given form on the page, optionally with the given form values. + * Give the form fields values as an array. + * + * Skipped fields will be filled by their values from the page. + * You don't need to click the 'Submit' button afterwards. + * This command itself triggers the request to form's action. + * + * You can optionally specify what button's value to include + * in the request with the last parameter as an alternative to + * explicitly setting its value in the second parameter, as + * button values are not otherwise included in the request. + * + * Examples: + * + * ``` php + * submitForm('#login', array('login' => 'davert', 'password' => '123456')); + * // or + * $I->submitForm('#login', array('login' => 'davert', 'password' => '123456'), 'submitButtonName'); + * + * ``` + * + * For example, given this sample "Sign Up" form: + * + * ``` html + *
+ * Login:
+ * Password:
+ * Do you agree to out terms?
+ * Select pricing plan + * + *
+ * ``` + * + * You could write the following to submit it: + * + * ``` php + * submitForm('#userForm', array('user' => array('login' => 'Davert', 'password' => '123456', 'agree' => true)), 'submitButton'); + * + * ``` + * Note that "2" will be the submitted value for the "plan" field, as it is the selected option. + * + * You can also emulate a JavaScript submission by not specifying any buttons in the third parameter to submitForm. + * + * ```php + * submitForm('#userForm', array('user' => array('login' => 'Davert', 'password' => '123456', 'agree' => true))); + * + * ``` * - * Moves forward in history - * @see Codeception\Util\Mink::moveForward() - * @return \Codeception\Maybe + * @param $selector + * @param $params + * @param $button + * @see \Codeception\Lib\InnerBrowser::submitForm() */ - 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(); + public function submitForm($selector, $params, $button = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('submitForm', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. + * + * Fills a text field or textarea with the given string. * - * 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\Util\Mink::fillField() - * @return \Codeception\Maybe + * @see \Codeception\Lib\InnerBrowser::fillField() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\Action('fillField', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Selects an option in select tag or in radio button group. - * - * Example: + * Selects an option in a select tag or in radio button group. * * ``` php * * ``` * - * Can select multiple options if second argument is array: + * Provide an array for the second argument to select multiple options: * * ``` php * 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(); + return $this->scenario->runStep(new \Codeception\Step\Action('selectOption', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Ticks a checkbox. - * For radio buttons use `selectOption` method. - * - * Example: + * Ticks a checkbox. For radio buttons, use the `selectOption` method instead. * * ``` php * 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(); + return $this->scenario->runStep(new \Codeception\Step\Action('checkOption', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * * Unticks a checkbox. * - * Example: - * * ``` php * uncheckOption('#notify'); @@ -1061,892 +954,569 @@ public function checkOption($option) { * ``` * * @param $option - * @see Codeception\Util\Mink::uncheckOption() - * @return \Codeception\Maybe + * @see \Codeception\Lib\InnerBrowser::uncheckOption() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\Action('uncheckOption', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Checks that current uri contains a value + * Attaches a file relative to the Codeception data directory to the given file upload field. * * ``` php * seeInCurrentUrl('home'); - * // to match: /users/1 - * $I->seeInCurrentUrl('/users/'); + * // file is stored in 'tests/_data/prices.xls' + * $I->attachFile('input[@type="file"]', 'prices.xls'); * ?> * ``` * - * @param $uri - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::seeInCurrentUrl() - * @return \Codeception\Maybe + * @param $field + * @param $filename + * @see \Codeception\Lib\InnerBrowser::attachFile() */ - 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(); + public function attachFile($field, $filename) { + return $this->scenario->runStep(new \Codeception\Step\Action('attachFile', func_get_args())); } + + /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Checks that current uri contains a value + * If your page triggers an ajax request, you can perform it manually. + * This action sends a GET ajax request with specified params. * - * ``` php - * seeInCurrentUrl('home'); - * // to match: /users/1 - * $I->seeInCurrentUrl('/users/'); - * ?> - * ``` + * See ->sendAjaxPostRequest for examples. * * @param $uri - * @see Codeception\Util\Mink::seeInCurrentUrl() - * @return \Codeception\Maybe + * @param $params + * @see \Codeception\Lib\InnerBrowser::sendAjaxGetRequest() */ - 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(); + public function sendAjaxGetRequest($uri, $params = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('sendAjaxGetRequest', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks that current uri does not contain a value + * [!] Method is generated. Documentation taken from corresponding module. * - * ``` php - * dontSeeInCurrentUrl('/users/'); - * ?> - * ``` + * 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. * - * @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. - * ---------------------------------------------- + * Example: * - * Checks that current uri does not contain a value + * Imagine that by clicking checkbox you trigger ajax request which updates user settings. + * We emulate that click by running this ajax request manually. * * ``` php * dontSeeInCurrentUrl('/users/'); - * ?> + * $I->sendAjaxPostRequest('/updateSettings', array('notifications' => true)); // POST + * $I->sendAjaxGetRequest('/updateSettings', array('notifications' => true)); // GET + * * ``` * * @param $uri - * @see Codeception\Util\Mink::dontSeeInCurrentUrl() - * @return \Codeception\Maybe + * @param $params + * @see \Codeception\Lib\InnerBrowser::sendAjaxPostRequest() */ - 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(); + public function sendAjaxPostRequest($uri, $params = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('sendAjaxPostRequest', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Checks that current url is equal to value. - * Unlike `seeInCurrentUrl` performs a strict check. - * - * ``` php - * seeCurrentUrlEquals('/'); - * ?> - * ``` + * If your page triggers an ajax request, you can perform it manually. + * This action sends an ajax request with specified method and params. * - * @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. - * ---------------------------------------------- + * Example: * - * Checks that current url is equal to value. - * Unlike `seeInCurrentUrl` performs a strict check. + * You need to perform an ajax request specifying the HTTP method. * * ``` php * seeCurrentUrlEquals('/'); - * ?> + * $I->sendAjaxRequest('PUT', '/posts/7', array('title' => 'new title')); + * * ``` * + * @param $method * @param $uri - * @see Codeception\Util\Mink::seeCurrentUrlEquals() - * @return \Codeception\Maybe + * @param $params + * @see \Codeception\Lib\InnerBrowser::sendAjaxRequest() */ - 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(); + public function sendAjaxRequest($method, $uri, $params = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('sendAjaxRequest', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Checks that current url is not equal to value. - * Unlike `dontSeeInCurrentUrl` performs a strict check. + * Finds and returns the text contents of the given element. + * If a fuzzy locator is used, the element is found using CSS, XPath, and by matching the full page source by regular expression. * * ``` php * dontSeeCurrentUrlEquals('/'); + * $heading = $I->grabTextFrom('h1'); + * $heading = $I->grabTextFrom('descendant-or-self::h1'); + * $value = $I->grabTextFrom('~ * ``` * - * @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 $cssOrXPathOrRegex * - * @param $uri - * @see Codeception\Util\Mink::dontSeeCurrentUrlEquals() - * @return \Codeception\Maybe + * @return mixed + * @see \Codeception\Lib\InnerBrowser::grabTextFrom() */ - 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(); + public function grabTextFrom($cssOrXPathOrRegex) { + return $this->scenario->runStep(new \Codeception\Step\Action('grabTextFrom', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Checks that current url is matches a RegEx value + * Grabs the value of the given attribute value from the given element. + * Fails if element is not found. * * ``` php * seeCurrentUrlMatches('~$/users/(\d+)~'); + * $I->grabAttributeFrom('#tooltip', 'title'); * ?> * ``` * - * @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 + * @param $cssOrXpath + * @param $attribute + * @internal param $element + * @return mixed + * @see \Codeception\Lib\InnerBrowser::grabAttributeFrom() */ - 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(); + public function grabAttributeFrom($cssOrXpath, $attribute) { + return $this->scenario->runStep(new \Codeception\Step\Action('grabAttributeFrom', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Checks that current url does not match a RegEx value - * - * ``` php - * dontSeeCurrentUrlMatches('~$/users/(\d+)~'); - * ?> - * ``` + * @param $field * - * @param $uri - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::dontSeeCurrentUrlMatches() - * @return \Codeception\Maybe + * @return array|mixed|null|string + * @see \Codeception\Lib\InnerBrowser::grabValueFrom() */ - 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(); + public function grabValueFrom($field) { + return $this->scenario->runStep(new \Codeception\Step\Action('grabValueFrom', func_get_args())); } + + /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Checks that current url does not match a RegEx value + * Sets a cookie with the given name and value. * * ``` php * dontSeeCurrentUrlMatches('~$/users/(\d+)~'); + * $I->setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3'); * ?> * ``` * - * @param $uri - * @see Codeception\Util\Mink::dontSeeCurrentUrlMatches() - * @return \Codeception\Maybe + * @param $cookie + * @param $value + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::setCookie() */ - 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(); + public function setCookie($name, $val) { + return $this->scenario->runStep(new \Codeception\Step\Action('setCookie', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Checks that cookie is set. + * Grabs a cookie value. * * @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 + * @see \Codeception\Lib\InnerBrowser::grabCookie() */ - 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(); + public function grabCookie($name) { + return $this->scenario->runStep(new \Codeception\Step\Action('grabCookie', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Checks that cookie doesn't exist + * Checks that a cookie with the given name is set. + * + * ``` php + * seeCookie('PHPSESSID'); + * ?> + * ``` * * @param $cookie + * * @return mixed - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::dontSeeCookie() - * @return \Codeception\Maybe + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeCookie() */ - 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(); + public function canSeeCookie($name) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeCookie', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Checks that cookie doesn't exist + * Checks that a cookie with the given name is set. + * + * ``` php + * seeCookie('PHPSESSID'); + * ?> + * ``` * * @param $cookie + * * @return mixed - * @see Codeception\Util\Mink::dontSeeCookie() - * @return \Codeception\Maybe + * @see \Codeception\Lib\InnerBrowser::seeCookie() */ - 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(); + public function seeCookie($name) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeCookie', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Sets a cookie. + * Checks that there isn't a cookie with the given name. * * @param $cookie - * @param $value + * * @return mixed - * @see Codeception\Util\Mink::setCookie() - * @return \Codeception\Maybe + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeCookie() */ - 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(); + public function cantSeeCookie($name) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCookie', func_get_args())); } - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Unsets cookie + * Checks that there isn't a cookie with the given name. * * @param $cookie + * * @return mixed - * @see Codeception\Util\Mink::resetCookie() - * @return \Codeception\Maybe + * @see \Codeception\Lib\InnerBrowser::dontSeeCookie() */ - 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(); + public function dontSeeCookie($name) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeCookie', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Grabs a cookie value. + * Unsets cookie with the given name. * * @param $cookie + * * @return mixed - * @see Codeception\Util\Mink::grabCookie() - * @return \Codeception\Maybe + * @see \Codeception\Lib\InnerBrowser::resetCookie() */ - 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(); + public function resetCookie($name) { + return $this->scenario->runStep(new \Codeception\Step\Action('resetCookie', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Takes a parameters from current URI by RegEx. - * If no url provided returns full URI. + * Checks that the given element exists on the page and is visible. + * You can also specify expected attributes of this element. * * ``` php * grabFromCurrentUrl('~$/user/(\d+)/~'); - * $uri = $I->grabFromCurrentUrl(); + * $I->seeElement('.error'); + * $I->seeElement('//form/input[1]'); + * $I->seeElement('input', ['name' => 'login']); + * $I->seeElement('input', ['value' => '123456']); + * + * // strict locator in first arg, attributes in second + * $I->seeElement(['css' => 'form input'], ['name' => 'login']); * ?> * ``` * - * @param null $uri - * @internal param $url - * @return mixed - * @see Codeception\Util\Mink::grabFromCurrentUrl() - * @return \Codeception\Maybe + * @param $selector + * @param array $attributes + * @return + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeElement() */ - 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(); + public function canSeeElement($selector, $attributes = null) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeElement', func_get_args())); } - - /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Attaches file from Codeception data directory to upload field. + * [!] Method is generated. Documentation taken from corresponding module. * - * Example: + * Checks that the given element exists on the page and is visible. + * You can also specify expected attributes of this element. * * ``` php * attachFile('input[@type="file"]', 'prices.xls'); + * $I->seeElement('.error'); + * $I->seeElement('//form/input[1]'); + * $I->seeElement('input', ['name' => 'login']); + * $I->seeElement('input', ['value' => '123456']); + * + * // strict locator in first arg, attributes in second + * $I->seeElement(['css' => 'form input'], ['name' => 'login']); * ?> * ``` * - * @param $field - * @param $filename - * @see Codeception\Util\Mink::attachFile() - * @return \Codeception\Maybe + * @param $selector + * @param array $attributes + * @return + * @see \Codeception\Lib\InnerBrowser::seeElement() */ - 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(); + public function seeElement($selector, $attributes = null) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeElement', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Checks if option is selected in select field. + * Checks that the given element is invisible or not present on the page. + * You can also specify expected attributes of this element. * * ``` php * seeOptionIsSelected('#form input[name=payment]', 'Visa'); + * $I->dontSeeElement('.error'); + * $I->dontSeeElement('//form/input[1]'); + * $I->dontSeeElement('input', ['name' => 'login']); + * $I->dontSeeElement('input', ['value' => '123456']); * ?> * ``` * * @param $selector - * @param $optionText - * @return mixed - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::seeOptionIsSelected() - * @return \Codeception\Maybe + * @param array $attributes + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeElement() */ - 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(); + public function cantSeeElement($selector, $attributes = null) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeElement', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Checks if option is selected in select field. + * Checks that the given element is invisible or not present on the page. + * You can also specify expected attributes of this element. * * ``` php * seeOptionIsSelected('#form input[name=payment]', 'Visa'); + * $I->dontSeeElement('.error'); + * $I->dontSeeElement('//form/input[1]'); + * $I->dontSeeElement('input', ['name' => 'login']); + * $I->dontSeeElement('input', ['value' => '123456']); * ?> * ``` * * @param $selector - * @param $optionText - * @return mixed - * @see Codeception\Util\Mink::seeOptionIsSelected() - * @return \Codeception\Maybe + * @param array $attributes + * @see \Codeception\Lib\InnerBrowser::dontSeeElement() */ - 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(); + public function dontSeeElement($selector, $attributes = null) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeElement', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks if option is not selected in select field. + * [!] Method is generated. Documentation taken from corresponding module. * + * Checks that there are a certain number of elements matched by the given locator on the page. + * * ``` php * dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); + * $I->seeNumberOfElements('tr', 10); + * $I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements * ?> * ``` - * * @param $selector - * @param $optionText - * @return mixed - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::dontSeeOptionIsSelected() - * @return \Codeception\Maybe + * @param mixed $expected: + * - string: strict number + * - array: range of numbers [0,10] + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeNumberOfElements() */ - 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(); + public function canSeeNumberOfElements($selector, $expected) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeNumberOfElements', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- - * - * Checks if option is not selected in select field. + * [!] Method is generated. Documentation taken from corresponding module. * + * Checks that there are a certain number of elements matched by the given locator on the page. + * * ``` php * dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); + * $I->seeNumberOfElements('tr', 10); + * $I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements * ?> * ``` - * * @param $selector - * @param $optionText - * @return mixed - * @see Codeception\Util\Mink::dontSeeOptionIsSelected() - * @return \Codeception\Maybe + * @param mixed $expected: + * - string: strict number + * - array: range of numbers [0,10] + * @see \Codeception\Lib\InnerBrowser::seeNumberOfElements() */ - 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(); + public function seeNumberOfElements($selector, $expected) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeNumberOfElements', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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: + * Checks that the given option is selected. * * ``` 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->seeOptionIsSelected('#form input[name=payment]', 'Visa'); * ?> * ``` * - * @param $field - * @param $value - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::seeInField() - * @return \Codeception\Maybe + * @param $selector + * @param $optionText + * + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected() */ - 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(); + public function canSeeOptionIsSelected($select, $optionText) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeOptionIsSelected', func_get_args())); } /** - * 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 + * [!] Method is generated. Documentation taken from corresponding module. * - * Example: + * Checks that the given option is selected. * * ``` 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->seeOptionIsSelected('#form input[name=payment]', 'Visa'); * ?> * ``` * - * @param $field - * @param $value - * @see Codeception\Util\Mink::seeInField() - * @return \Codeception\Maybe + * @param $selector + * @param $optionText + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected() */ - 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(); + public function seeOptionIsSelected($select, $optionText) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeOptionIsSelected', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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: + * Checks that the given option is not selected. * * ``` 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->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); * ?> * ``` * - * @param $field - * @param $value - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::dontSeeInField() - * @return \Codeception\Maybe + * @param $selector + * @param $optionText + * + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected() */ - 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(); + public function cantSeeOptionIsSelected($select, $optionText) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeOptionIsSelected', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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: + * Checks that the given option is not selected. * * ``` 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->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); * ?> * ``` * - * @param $field - * @param $value - * @see Codeception\Util\Mink::dontSeeInField() - * @return \Codeception\Maybe + * @param $selector + * @param $optionText + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected() */ - 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(); + public function dontSeeOptionIsSelected($select, $optionText) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeOptionIsSelected', func_get_args())); } /** - * 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: + * [!] Method is generated. Documentation taken from corresponding module. * - * ``` php - * grabTextFrom('h1'); - * $heading = $I->grabTextFrom('descendant-or-self::h1'); - * $value = $I->grabTextFrom('~ - * ``` + * 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. * - * @param $cssOrXPathOrRegex - * @return mixed - * @see Codeception\Util\Mink::grabTextFrom() - * @return \Codeception\Maybe + * Asserts that current page has 404 response status code. + * @see \Codeception\Lib\InnerBrowser::seePageNotFound() */ - 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(); + public function seePageNotFound() { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seePageNotFound', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * Checks response code equals to provided value. * - * Example: + * @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. * - * ``` php - * grabValueFrom('Name'); - * $name = $I->grabValueFrom('input[name=username]'); - * $name = $I->grabValueFrom('descendant-or-self::form/descendant::input[@name = 'username']'); - * ?> - * ``` + * Checks response code equals to provided value. * - * @param $field - * @return mixed - * @see Codeception\Util\Mink::grabValueFrom() - * @return \Codeception\Maybe + * @param $code + * @see \Codeception\Module\REST::seeResponseCodeIs() */ - 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(); + public function seeResponseCodeIs($code) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeResponseCodeIs', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Checks that page title contains text. + * Checks that the page title contains the given string. * * ``` php * 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(); + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeInTitle', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Checks that page title contains text. + * Checks that the page title contains the given string. * * ``` php * 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(); + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeInTitle', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Checks that page title does not contain text. + * Checks that the page title does not contain the given string. * * @param $title + * * @return mixed - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Util\Mink::dontSeeInTitle() - * @return \Codeception\Maybe + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeInTitle() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInTitle', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * - * Checks that page title does not contain text. + * Checks that the page title does not contain the given string. * * @param $title + * * @return mixed - * @see Codeception\Util\Mink::dontSeeInTitle() - * @return \Codeception\Maybe + * @see \Codeception\Lib\InnerBrowser::dontSeeInTitle() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeInTitle', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * * Sets HTTP header * * @param $name * @param $value - * @see Codeception\Module\REST::haveHttpHeader() - * @return \Codeception\Maybe + * @see \Codeception\Module\REST::haveHttpHeader() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\Action('haveHttpHeader', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeHttpHeader() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeHttpHeader', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * @see \Codeception\Module\REST::seeHttpHeader() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeHttpHeader', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::dontSeeHttpHeader() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeHttpHeader', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * @see \Codeception\Module\REST::dontSeeHttpHeader() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeHttpHeader', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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. @@ -2186,22 +1669,14 @@ public function dontSeeHttpHeader($name, $value = null) { * ``` * * @param $name - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Module\REST::seeHttpHeaderOnce() - * @return \Codeception\Maybe + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeHttpHeaderOnce() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeHttpHeaderOnce', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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. @@ -2214,23 +1689,15 @@ public function canSeeHttpHeaderOnce($name) { * ``` * * @param $name - * @see Codeception\Module\REST::seeHttpHeaderOnce() - * @return \Codeception\Maybe + * @see \Codeception\Module\REST::seeHttpHeaderOnce() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeHttpHeaderOnce', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * * Returns the value of the specified header name * @@ -2238,205 +1705,146 @@ public function seeHttpHeaderOnce($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 + * @see \Codeception\Module\REST::grabHttpHeader() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\Action('grabHttpHeader', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * @see \Codeception\Module\REST::amDigestAuthenticated() */ 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(); + 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())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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|\JsonSerializable $params * @param array $files - * @see Codeception\Module\REST::sendPOST() - * @return \Codeception\Maybe + * @see \Codeception\Module\REST::sendPOST() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\Action('sendPOST', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * @see \Codeception\Module\REST::sendHEAD() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\Action('sendHEAD', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * @see \Codeception\Module\REST::sendOPTIONS() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\Action('sendOPTIONS', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * @see \Codeception\Module\REST::sendGET() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\Action('sendGET', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * @see \Codeception\Module\REST::sendPUT() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\Action('sendPUT', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * @see \Codeception\Module\REST::sendPATCH() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\Action('sendPATCH', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * @see \Codeception\Module\REST::sendDELETE() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\Action('sendDELETE', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * * Sends LINK request to given uri. * @@ -2446,213 +1854,131 @@ public function sendDELETE($url, $params = null, $files = null) { * @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 + * @see \Codeception\Module\REST::sendLINK() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\Action('sendLINK', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * @see \Codeception\Module\REST::sendUNLINK() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\Action('sendUNLINK', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeResponseIsJson() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseIsJson', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * @see \Codeception\Module\REST::seeResponseIsJson() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeResponseIsJson', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeResponseIsXml() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseIsXml', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * @see \Codeception\Module\REST::seeResponseIsXml() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeResponseIsXml', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeResponseContains() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseContains', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * @see \Codeception\Module\REST::seeResponseContains() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeResponseContains', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::dontSeeResponseContains() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseContains', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * @see \Codeception\Module\REST::dontSeeResponseContains() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeResponseContains', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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) @@ -2675,22 +2001,14 @@ public function dontSeeResponseContains($text) { * 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 + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeResponseContainsJson() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseContainsJson', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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) @@ -2713,23 +2031,15 @@ public function canSeeResponseContainsJson($json = null) { * This method recursively checks if one array can be found inside of another. * * @param array $json - * @see Codeception\Module\REST::seeResponseContainsJson() - * @return \Codeception\Maybe + * @see \Codeception\Module\REST::seeResponseContainsJson() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeResponseContainsJson', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * * Returns current response so that it can be used in next scenario steps. * @@ -2744,26 +2054,20 @@ public function seeResponseContainsJson($json = null) { * * @version 1.1 * @return string - * @see Codeception\Module\REST::grabResponse() - * @return \Codeception\Maybe + * @see \Codeception\Module\REST::grabResponse() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\Action('grabResponse', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * so that it can be used in next scenario steps. + * + * **this method is deprecated in favor of `grabDataFromResponseByJsonPath`** * * Example: * @@ -2774,145 +2078,313 @@ public function grabResponse() { * ?> * ``` * + * @deprecated please use `grabDataFromResponseByJsonPath` * @param string $path - * - * @since 1.1.2 * @return string + * @see \Codeception\Module\REST::grabDataFromJsonResponse() + */ + public function grabDataFromJsonResponse($path = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('grabDataFromJsonResponse', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Returns data from the current JSON response using [JSONPath](http://goessner.net/articles/JsonPath/) as selector. + * JsonPath is XPath equivalent for querying Json structures. Try your JsonPath expressions [online](http://jsonpath.curiousconcept.com/). + * Even for a single value an array is returned. + * + * This method **require [`flow/jsonpath`](https://github.com/FlowCommunications/JSONPath/) library to be installed**. + * + * Example: + * + * ``` php + * grabDataFromJsonResponse('$..users[0].id'); + * $I->sendPUT('/user', array('id' => $firstUser[0], 'name' => 'davert')); + * ?> + * ``` + * + * @param $jsonPath + * @return array + * @version 2.0.9 + * @throws \Exception + * @see \Codeception\Module\REST::grabDataFromResponseByJsonPath() + */ + public function grabDataFromResponseByJsonPath($jsonPath) { + return $this->scenario->runStep(new \Codeception\Step\Action('grabDataFromResponseByJsonPath', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if json structure in response matches the xpath provided. + * JSON is not supposed to be checked against XPath, yet it can be converted to xml and used with XPath. + * This assertion allows you to check the structure of response json. + * * + * ```json + * ```json + * { "store": { + * "book": [ + * { "category": "reference", + * "author": "Nigel Rees", + * "title": "Sayings of the Century", + * "price": 8.95 + * }, + * { "category": "fiction", + * "author": "Evelyn Waugh", + * "title": "Sword of Honour", + * "price": 12.99 + * } + * ], + * "bicycle": { + * "color": "red", + * "price": 19.95 + * } + * } + * } + * ``` + * + * ```php + * seeResponseJsonMatchesXpath('//store/book/author'); + * // first book in store has author + * $I->seeResponseJsonMatchesXpath('//store/book[1]/author'); + * // at least one item in store has price + * $I->seeResponseJsonMatchesXpath('/store//price'); + * ?> + * ``` + * + * @version 2.0.9 + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeResponseJsonMatchesXpath() + */ + public function canSeeResponseJsonMatchesXpath($xpath) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseJsonMatchesXpath', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if json structure in response matches the xpath provided. + * JSON is not supposed to be checked against XPath, yet it can be converted to xml and used with XPath. + * This assertion allows you to check the structure of response json. + * * + * ```json + * ```json + * { "store": { + * "book": [ + * { "category": "reference", + * "author": "Nigel Rees", + * "title": "Sayings of the Century", + * "price": 8.95 + * }, + * { "category": "fiction", + * "author": "Evelyn Waugh", + * "title": "Sword of Honour", + * "price": 12.99 + * } + * ], + * "bicycle": { + * "color": "red", + * "price": 19.95 + * } + * } + * } + * ``` + * + * ```php + * seeResponseJsonMatchesXpath('//store/book/author'); + * // first book in store has author + * $I->seeResponseJsonMatchesXpath('//store/book[1]/author'); + * // at least one item in store has price + * $I->seeResponseJsonMatchesXpath('/store//price'); + * ?> + * ``` + * + * @version 2.0.9 + * @see \Codeception\Module\REST::seeResponseJsonMatchesXpath() + */ + public function seeResponseJsonMatchesXpath($xpath) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeResponseJsonMatchesXpath', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if json structure in response matches [JsonPath](http://goessner.net/articles/JsonPath/). + * JsonPath is XPath equivalent for querying Json structures. Try your JsonPath expressions [online](http://jsonpath.curiousconcept.com/). + * This assertion allows you to check the structure of response json. + * + * This method **require [`flow/jsonpath`](https://github.com/FlowCommunications/JSONPath/) library to be installed**. + * + * ```json + * { "store": { + * "book": [ + * { "category": "reference", + * "author": "Nigel Rees", + * "title": "Sayings of the Century", + * "price": 8.95 + * }, + * { "category": "fiction", + * "author": "Evelyn Waugh", + * "title": "Sword of Honour", + * "price": 12.99 + * } + * ], + * "bicycle": { + * "color": "red", + * "price": 19.95 + * } + * } + * } + * ``` + * + * ```php + * seeResponseJsonMatchesJsonPath('$.store.book[*].author'); + * // first book in store has author + * $I->seeResponseJsonMatchesJsonPath('$.store.book[0].author'); + * // at least one item in store has price + * $I->seeResponseJsonMatchesJsonPath('$.store..price'); + * ?> + * ``` + * + * @version 2.0.9 + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeResponseJsonMatchesJsonPath() + */ + public function canSeeResponseJsonMatchesJsonPath($jsonPath) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseJsonMatchesJsonPath', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if json structure in response matches [JsonPath](http://goessner.net/articles/JsonPath/). + * JsonPath is XPath equivalent for querying Json structures. Try your JsonPath expressions [online](http://jsonpath.curiousconcept.com/). + * This assertion allows you to check the structure of response json. + * + * This method **require [`flow/jsonpath`](https://github.com/FlowCommunications/JSONPath/) library to be installed**. + * + * ```json + * { "store": { + * "book": [ + * { "category": "reference", + * "author": "Nigel Rees", + * "title": "Sayings of the Century", + * "price": 8.95 + * }, + * { "category": "fiction", + * "author": "Evelyn Waugh", + * "title": "Sword of Honour", + * "price": 12.99 + * } + * ], + * "bicycle": { + * "color": "red", + * "price": 19.95 + * } + * } + * } + * ``` + * + * ```php + * seeResponseJsonMatchesJsonPath('$.store.book[*].author'); + * // first book in store has author + * $I->seeResponseJsonMatchesJsonPath('$.store.book[0].author'); + * // at least one item in store has price + * $I->seeResponseJsonMatchesJsonPath('$.store..price'); + * ?> + * ``` * - * @author tiger.seo@gmail.com - * @see Codeception\Module\REST::grabDataFromJsonResponse() - * @return \Codeception\Maybe + * @version 2.0.9 + * @see \Codeception\Module\REST::seeResponseJsonMatchesJsonPath() */ - 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(); + public function seeResponseJsonMatchesJsonPath($jsonPath) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeResponseJsonMatchesJsonPath', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::dontSeeResponseContainsJson() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseContainsJson', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * * Opposite to seeResponseContainsJson * * @param array $json - * @see Codeception\Module\REST::dontSeeResponseContainsJson() - * @return \Codeception\Maybe + * @see \Codeception\Module\REST::dontSeeResponseContainsJson() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeResponseContainsJson', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeResponseEquals() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseEquals', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * @see \Codeception\Module\REST::seeResponseEquals() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeResponseEquals', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::dontSeeResponseCodeIs() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseCodeIs', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] 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 + * @see \Codeception\Module\REST::dontSeeResponseCodeIs() */ 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(); + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeResponseCodeIs', func_get_args())); } } - diff --git a/App/Tests/functional/TestGuy.php b/App/Tests/functional/TestGuy.php index 3352206..bef585b 100755 --- a/App/Tests/functional/TestGuy.php +++ b/App/Tests/functional/TestGuy.php @@ -1,58 +1,47 @@ -scenario->addStep(new \Codeception\Step\Condition('amInPath', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); + return $this->scenario->runStep(new \Codeception\Step\Condition('amInPath', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * * Opens a file and stores it's content. * @@ -66,23 +55,15 @@ public function amInPath($path) { * ``` * * @param $filename - * @see Codeception\Module\Filesystem::openFile() - * @return \Codeception\Maybe + * @see \Codeception\Module\Filesystem::openFile() */ public function openFile($filename) { - $this->scenario->addStep(new \Codeception\Step\Action('openFile', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); + return $this->scenario->runStep(new \Codeception\Step\Action('openFile', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * * Deletes a file * @@ -93,23 +74,15 @@ public function openFile($filename) { * ``` * * @param $filename - * @see Codeception\Module\Filesystem::deleteFile() - * @return \Codeception\Maybe + * @see \Codeception\Module\Filesystem::deleteFile() */ public function deleteFile($filename) { - $this->scenario->addStep(new \Codeception\Step\Action('deleteFile', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); + return $this->scenario->runStep(new \Codeception\Step\Action('deleteFile', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * * Deletes directory with all subdirectories * @@ -120,23 +93,15 @@ public function deleteFile($filename) { * ``` * * @param $dirname - * @see Codeception\Module\Filesystem::deleteDir() - * @return \Codeception\Maybe + * @see \Codeception\Module\Filesystem::deleteDir() */ public function deleteDir($dirname) { - $this->scenario->addStep(new \Codeception\Step\Action('deleteDir', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); + return $this->scenario->runStep(new \Codeception\Step\Action('deleteDir', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * * Copies directory with all contents * @@ -148,23 +113,15 @@ public function deleteDir($dirname) { * * @param $src * @param $dst - * @see Codeception\Module\Filesystem::copyDir() - * @return \Codeception\Maybe + * @see \Codeception\Module\Filesystem::copyDir() */ public function copyDir($src, $dst) { - $this->scenario->addStep(new \Codeception\Step\Action('copyDir', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); + return $this->scenario->runStep(new \Codeception\Step\Action('copyDir', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * * Checks If opened file has `text` in it. * @@ -178,22 +135,14 @@ public function copyDir($src, $dst) { * ``` * * @param $text - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Module\Filesystem::seeInThisFile() - * @return \Codeception\Maybe + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\Filesystem::seeInThisFile() */ public function canSeeInThisFile($text) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeInThisFile', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeInThisFile', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * * Checks If opened file has `text` in it. * @@ -207,26 +156,18 @@ public function canSeeInThisFile($text) { * ``` * * @param $text - * @see Codeception\Module\Filesystem::seeInThisFile() - * @return \Codeception\Maybe + * @see \Codeception\Module\Filesystem::seeInThisFile() */ public function seeInThisFile($text) { - $this->scenario->addStep(new \Codeception\Step\Assertion('seeInThisFile', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeInThisFile', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * * Checks the strict matching of file contents. - * Unlike `seeInThisFile` will fail if file has something more then expected lines. + * Unlike `seeInThisFile` will fail if file has something more than expected lines. * Better to use with HEREDOC strings. * Matching is done after removing "\r" chars from file content. * @@ -238,25 +179,17 @@ public function seeInThisFile($text) { * ``` * * @param $text - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Module\Filesystem::seeFileContentsEqual() - * @return \Codeception\Maybe + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\Filesystem::seeFileContentsEqual() */ public function canSeeFileContentsEqual($text) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeFileContentsEqual', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeFileContentsEqual', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * * Checks the strict matching of file contents. - * Unlike `seeInThisFile` will fail if file has something more then expected lines. + * Unlike `seeInThisFile` will fail if file has something more than expected lines. * Better to use with HEREDOC strings. * Matching is done after removing "\r" chars from file content. * @@ -268,23 +201,15 @@ public function canSeeFileContentsEqual($text) { * ``` * * @param $text - * @see Codeception\Module\Filesystem::seeFileContentsEqual() - * @return \Codeception\Maybe + * @see \Codeception\Module\Filesystem::seeFileContentsEqual() */ public function seeFileContentsEqual($text) { - $this->scenario->addStep(new \Codeception\Step\Assertion('seeFileContentsEqual', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeFileContentsEqual', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * * Checks If opened file doesn't contain `text` in it * @@ -296,22 +221,14 @@ public function seeFileContentsEqual($text) { * ``` * * @param $text - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Module\Filesystem::dontSeeInThisFile() - * @return \Codeception\Maybe + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\Filesystem::dontSeeInThisFile() */ public function cantSeeInThisFile($text) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeInThisFile', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInThisFile', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * * Checks If opened file doesn't contain `text` in it * @@ -323,42 +240,26 @@ public function cantSeeInThisFile($text) { * ``` * * @param $text - * @see Codeception\Module\Filesystem::dontSeeInThisFile() - * @return \Codeception\Maybe + * @see \Codeception\Module\Filesystem::dontSeeInThisFile() */ public function dontSeeInThisFile($text) { - $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeInThisFile', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeInThisFile', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * * Deletes a file - * @see Codeception\Module\Filesystem::deleteThisFile() - * @return \Codeception\Maybe + * @see \Codeception\Module\Filesystem::deleteThisFile() */ public function deleteThisFile() { - $this->scenario->addStep(new \Codeception\Step\Action('deleteThisFile', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); + return $this->scenario->runStep(new \Codeception\Step\Action('deleteThisFile', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * * Checks if file exists in path. * Opens a file when it's exists @@ -371,22 +272,14 @@ public function deleteThisFile() { * * @param $filename * @param string $path - * Conditional Assertion: Test won't be stopped on fail - * @see Codeception\Module\Filesystem::seeFileFound() - * @return \Codeception\Maybe + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\Filesystem::seeFileFound() */ public function canSeeFileFound($filename, $path = null) { - $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeFileFound', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeFileFound', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * * Checks if file exists in path. * Opens a file when it's exists @@ -399,23 +292,42 @@ public function canSeeFileFound($filename, $path = null) { * * @param $filename * @param string $path - * @see Codeception\Module\Filesystem::seeFileFound() - * @return \Codeception\Maybe + * @see \Codeception\Module\Filesystem::seeFileFound() */ public function seeFileFound($filename, $path = null) { - $this->scenario->addStep(new \Codeception\Step\Assertion('seeFileFound', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeFileFound', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if file does not exists in path + * + * @param $filename + * @param string $path + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\Filesystem::dontSeeFileFound() + */ + public function cantSeeFileFound($filename, $path = null) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeFileFound', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if file does not exists in path + * + * @param $filename + * @param string $path + * @see \Codeception\Module\Filesystem::dontSeeFileFound() + */ + public function dontSeeFileFound($filename, $path = null) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeFileFound', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * * Erases directory contents * @@ -426,35 +338,23 @@ public function seeFileFound($filename, $path = null) { * ``` * * @param $dirname - * @see Codeception\Module\Filesystem::cleanDir() - * @return \Codeception\Maybe + * @see \Codeception\Module\Filesystem::cleanDir() */ public function cleanDir($dirname) { - $this->scenario->addStep(new \Codeception\Step\Action('cleanDir', func_get_args())); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); + return $this->scenario->runStep(new \Codeception\Step\Action('cleanDir', func_get_args())); } /** - * This method is generated. - * Documentation taken from corresponding module. - * ---------------------------------------------- + * [!] Method is generated. Documentation taken from corresponding module. * + * Saves contents to file * - * @see Codeception\Module::getName() - * @return \Codeception\Maybe + * @param $filename + * @param $contents + * @see \Codeception\Module\Filesystem::writeToFile() */ - 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(); + public function writeToFile($filename, $contents) { + return $this->scenario->runStep(new \Codeception\Step\Action('writeToFile', func_get_args())); } } - diff --git a/App/Tests/unit/CodeGuy.php b/App/Tests/unit/CodeGuy.php index 9dd19de..4124558 100755 --- a/App/Tests/unit/CodeGuy.php +++ b/App/Tests/unit/CodeGuy.php @@ -1,47 +1,28 @@ -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(); - } + } - diff --git a/README.md b/README.md index d1f859d..3b40dc5 100644 --- a/README.md +++ b/README.md @@ -141,6 +141,10 @@ No. It's completely un-official. It's not affiliated or sponsored in anyway by t So, raise all issues about Webception on the Webception [GitHub Issues](https://github.com/jayhealey/Webception/issues) page. +**How do I run webception in WAMP on windows? +By default WAMP disables environment variables and the php executable cannot be found without the system path being available. +Enable environment variables by editing c:\wamp\bin\apache\apache2.4.9\bin\php.ini and ensure the line +variables_order = "EGPCS" ------------ diff --git a/composer.lock b/composer.lock deleted file mode 100644 index bacd06f..0000000 --- a/composer.lock +++ /dev/null @@ -1,1689 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" - ], - "hash": "a34be166aa7afc40a81d82a086e03341", - "packages": [ - { - "name": "behat/mink", - "version": "v1.5.0", - "source": { - "type": "git", - "url": "https://github.com/Behat/Mink.git", - "reference": "0769e6d9726c140a54dbf827a438c0f9912749fe" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Behat/Mink/zipball/0769e6d9726c140a54dbf827a438c0f9912749fe", - "reference": "0769e6d9726c140a54dbf827a438c0f9912749fe", - "shasum": "" - }, - "require": { - "php": ">=5.3.1", - "symfony/css-selector": "~2.0" - }, - "suggest": { - "behat/mink-browserkit-driver": "extremely fast headless driver for Symfony\\Kernel-based apps (Sf2, Silex)", - "behat/mink-goutte-driver": "fast headless driver for any app without JS emulation", - "behat/mink-selenium2-driver": "slow, but JS-enabled driver for any app (requires Selenium2)", - "behat/mink-zombie-driver": "fast and JS-enabled headless driver for any app (requires node.js)" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-develop": "1.5.x-dev" - } - }, - "autoload": { - "psr-0": { - "Behat\\Mink": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - } - ], - "description": "Web acceptance testing framework for PHP 5.3", - "homepage": "http://mink.behat.org/", - "keywords": [ - "browser", - "testing", - "web" - ], - "time": "2013-04-13 23:39:27" - }, - { - "name": "behat/mink-browserkit-driver", - "version": "v1.1.0", - "source": { - "type": "git", - "url": "https://github.com/Behat/MinkBrowserKitDriver.git", - "reference": "63960c8fcad4529faad1ff33e950217980baa64c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Behat/MinkBrowserKitDriver/zipball/63960c8fcad4529faad1ff33e950217980baa64c", - "reference": "63960c8fcad4529faad1ff33e950217980baa64c", - "shasum": "" - }, - "require": { - "behat/mink": "~1.5.0", - "php": ">=5.3.1", - "symfony/browser-kit": "~2.0", - "symfony/dom-crawler": "~2.0" - }, - "require-dev": { - "silex/silex": "@dev" - }, - "type": "mink-driver", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, - "autoload": { - "psr-0": { - "Behat\\Mink\\Driver": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - } - ], - "description": "Symfony2 BrowserKit driver for Mink framework", - "homepage": "http://mink.behat.org/", - "keywords": [ - "Mink", - "Symfony2", - "browser", - "testing" - ], - "time": "2013-04-13 23:46:30" - }, - { - "name": "behat/mink-goutte-driver", - "version": "v1.0.9", - "source": { - "type": "git", - "url": "https://github.com/Behat/MinkGoutteDriver.git", - "reference": "fa1b073b48761464feb0b05e6825da44b20118d8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Behat/MinkGoutteDriver/zipball/fa1b073b48761464feb0b05e6825da44b20118d8", - "reference": "fa1b073b48761464feb0b05e6825da44b20118d8", - "shasum": "" - }, - "require": { - "behat/mink-browserkit-driver": ">=1.0.5,<1.2.0", - "fabpot/goutte": "~1.0.1", - "php": ">=5.3.1" - }, - "type": "mink-driver", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "Behat\\Mink\\Driver": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - } - ], - "description": "Goutte driver for Mink framework", - "homepage": "http://mink.behat.org/", - "keywords": [ - "browser", - "goutte", - "headless", - "testing" - ], - "time": "2013-07-03 18:43:54" - }, - { - "name": "behat/mink-selenium2-driver", - "version": "v1.1.1", - "source": { - "type": "git", - "url": "https://github.com/Behat/MinkSelenium2Driver.git", - "reference": "bcf1b537de37db6db0822d9e7bd97e600fd7a476" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Behat/MinkSelenium2Driver/zipball/bcf1b537de37db6db0822d9e7bd97e600fd7a476", - "reference": "bcf1b537de37db6db0822d9e7bd97e600fd7a476", - "shasum": "" - }, - "require": { - "behat/mink": "~1.5.0", - "instaclick/php-webdriver": "~1.0.12", - "php": ">=5.3.1" - }, - "type": "mink-driver", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, - "autoload": { - "psr-0": { - "Behat\\Mink\\Driver": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Pete Otaqui", - "email": "pete@otaqui.com", - "homepage": "https://github.com/pete-otaqui" - } - ], - "description": "Selenium2 (WebDriver) driver for Mink framework", - "homepage": "http://mink.behat.org/", - "keywords": [ - "ajax", - "browser", - "javascript", - "selenium", - "testing", - "webdriver" - ], - "time": "2013-06-02 19:09:45" - }, - { - "name": "codeception/codeception", - "version": "1.8.1", - "source": { - "type": "git", - "url": "https://github.com/Codeception/Codeception.git", - "reference": "7043dc17cf3caa009461a6f2569262546f38c7f9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Codeception/Codeception/zipball/7043dc17cf3caa009461a6f2569262546f38c7f9", - "reference": "7043dc17cf3caa009461a6f2569262546f38c7f9", - "shasum": "" - }, - "require": { - "behat/mink": "1.5.*", - "behat/mink-goutte-driver": "1.0.*", - "behat/mink-selenium2-driver": "1.1.*", - "facebook/webdriver": "~0.3", - "monolog/monolog": "*", - "php": ">=5.3.3", - "phpunit/phpunit": "3.7.*", - "symfony/console": "~2.3", - "symfony/event-dispatcher": "~2.3", - "symfony/finder": "~2.3", - "symfony/yaml": "~2.3" - }, - "require-dev": { - "behat/mink-selenium-driver": "1.1.*", - "behat/mink-zombie-driver": "1.1.*", - "facebook/php-sdk": "3.*", - "videlalvaro/php-amqplib": "*" - }, - "suggest": { - "codeception/phpbuiltinserver": "Extension to starts and stops PHP builtin web server for your tests" - }, - "bin": [ - "codecept" - ], - "type": "library", - "autoload": { - "psr-0": { - "Codeception": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Bodnarchuk", - "email": "davert@mail.ua", - "homepage": "http://codegyre.com" - } - ], - "description": "BDD-style testing framework", - "homepage": "http://codeception.com/", - "keywords": [ - "BDD", - "TDD", - "acceptance testing", - "functional testing", - "unit testing" - ], - "time": "2013-12-08 02:28:41" - }, - { - "name": "fabpot/goutte", - "version": "v1.0.3", - "source": { - "type": "git", - "url": "https://github.com/fabpot/Goutte.git", - "reference": "75c9f23c4122caf4ea3e87a42a00b471366e707f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/fabpot/Goutte/zipball/75c9f23c4122caf4ea3e87a42a00b471366e707f", - "reference": "75c9f23c4122caf4ea3e87a42a00b471366e707f", - "shasum": "" - }, - "require": { - "ext-curl": "*", - "guzzle/http": ">=3.0.5,<3.8-dev", - "php": ">=5.3.0", - "symfony/browser-kit": "~2.1", - "symfony/css-selector": "~2.1", - "symfony/dom-crawler": "~2.1", - "symfony/finder": "~2.1", - "symfony/process": "~2.1" - }, - "require-dev": { - "guzzle/plugin-history": ">=3.0.5,<3.8-dev", - "guzzle/plugin-mock": ">=3.0.5,<3.8-dev" - }, - "type": "application", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "psr-0": { - "Goutte": "." - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "A simple PHP Web Scraper", - "homepage": "https://github.com/fabpot/Goutte", - "keywords": [ - "scraper" - ], - "time": "2013-08-16 06:03:22" - }, - { - "name": "facebook/webdriver", - "version": "v0.3", - "source": { - "type": "git", - "url": "https://github.com/facebook/php-webdriver.git", - "reference": "1b0facc33133f0ff990df8cebe7f2e19b2603da3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/facebook/php-webdriver/zipball/1b0facc33133f0ff990df8cebe7f2e19b2603da3", - "reference": "1b0facc33133f0ff990df8cebe7f2e19b2603da3", - "shasum": "" - }, - "require": { - "php": ">=5.3.19", - "phpunit/phpunit": "3.7.*" - }, - "type": "library", - "autoload": { - "classmap": [ - "lib/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "description": "A php client for WebDriver", - "homepage": "https://github.com/facebook/php-webdriver", - "keywords": [ - "facebook", - "php", - "selenium", - "webdriver" - ], - "time": "2013-11-26 23:16:02" - }, - { - "name": "guzzle/common", - "version": "v3.7.4", - "target-dir": "Guzzle/Common", - "source": { - "type": "git", - "url": "https://github.com/guzzle/common.git", - "reference": "5126e268446c7e7df961b89128d71878e0652432" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/common/zipball/5126e268446c7e7df961b89128d71878e0652432", - "reference": "5126e268446c7e7df961b89128d71878e0652432", - "shasum": "" - }, - "require": { - "php": ">=5.3.2", - "symfony/event-dispatcher": ">=2.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.7-dev" - } - }, - "autoload": { - "psr-0": { - "Guzzle\\Common": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Common libraries used by Guzzle", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "collection", - "common", - "event", - "exception" - ], - "time": "2013-10-02 20:47:00" - }, - { - "name": "guzzle/http", - "version": "v3.7.4", - "target-dir": "Guzzle/Http", - "source": { - "type": "git", - "url": "https://github.com/guzzle/http.git", - "reference": "3420035adcf312d62a2e64f3e6b3e3e590121786" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/http/zipball/3420035adcf312d62a2e64f3e6b3e3e590121786", - "reference": "3420035adcf312d62a2e64f3e6b3e3e590121786", - "shasum": "" - }, - "require": { - "guzzle/common": "self.version", - "guzzle/parser": "self.version", - "guzzle/stream": "self.version", - "php": ">=5.3.2" - }, - "suggest": { - "ext-curl": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.7-dev" - } - }, - "autoload": { - "psr-0": { - "Guzzle\\Http": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "HTTP libraries used by Guzzle", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "Guzzle", - "client", - "curl", - "http", - "http client" - ], - "time": "2013-09-20 22:05:53" - }, - { - "name": "guzzle/parser", - "version": "v3.7.4", - "target-dir": "Guzzle/Parser", - "source": { - "type": "git", - "url": "https://github.com/guzzle/parser.git", - "reference": "a25c2ddda1c52fb69a4ee56eb530b13ddd9573c2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/parser/zipball/a25c2ddda1c52fb69a4ee56eb530b13ddd9573c2", - "reference": "a25c2ddda1c52fb69a4ee56eb530b13ddd9573c2", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.7-dev" - } - }, - "autoload": { - "psr-0": { - "Guzzle\\Parser": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Interchangeable parsers used by Guzzle", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "URI Template", - "cookie", - "http", - "message", - "url" - ], - "time": "2013-07-11 22:46:03" - }, - { - "name": "guzzle/stream", - "version": "v3.7.4", - "target-dir": "Guzzle/Stream", - "source": { - "type": "git", - "url": "https://github.com/guzzle/stream.git", - "reference": "a86111d9ac7db31d65a053c825869409fe8fc83f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/stream/zipball/a86111d9ac7db31d65a053c825869409fe8fc83f", - "reference": "a86111d9ac7db31d65a053c825869409fe8fc83f", - "shasum": "" - }, - "require": { - "guzzle/common": "self.version", - "php": ">=5.3.2" - }, - "suggest": { - "guzzle/http": "To convert Guzzle request objects to PHP streams" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.7-dev" - } - }, - "autoload": { - "psr-0": { - "Guzzle\\Stream": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle stream wrapper component", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "Guzzle", - "component", - "stream" - ], - "time": "2013-07-30 22:07:23" - }, - { - "name": "instaclick/php-webdriver", - "version": "1.0.17", - "source": { - "type": "git", - "url": "https://github.com/instaclick/php-webdriver.git", - "reference": "47a6019553a7a5b42d35493276ffc2c9252c53d5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/instaclick/php-webdriver/zipball/47a6019553a7a5b42d35493276ffc2c9252c53d5", - "reference": "47a6019553a7a5b42d35493276ffc2c9252c53d5", - "shasum": "" - }, - "require": { - "ext-curl": "*", - "php": ">=5.3.2" - }, - "bin": [ - "bin/webunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "WebDriver": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Justin Bishop", - "email": "jubishop@gmail.com", - "role": "Developer" - }, - { - "name": "Anthon Pang", - "email": "apang@softwaredevelopment.ca", - "role": "Fork Maintainer" - } - ], - "description": "PHP WebDriver for Selenium 2", - "homepage": "http://instaclick.com/", - "keywords": [ - "browser", - "selenium", - "webdriver", - "webtest" - ], - "time": "2013-10-04 15:03:51" - }, - { - "name": "monolog/monolog", - "version": "1.7.0", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/monolog.git", - "reference": "6225b22de9dcf36546be3a0b2fa8e3d986153f57" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/6225b22de9dcf36546be3a0b2fa8e3d986153f57", - "reference": "6225b22de9dcf36546be3a0b2fa8e3d986153f57", - "shasum": "" - }, - "require": { - "php": ">=5.3.0", - "psr/log": "~1.0" - }, - "require-dev": { - "aws/aws-sdk-php": "~2.4.8", - "doctrine/couchdb": "dev-master", - "mlehner/gelf-php": "1.0.*", - "phpunit/phpunit": "~3.7.0", - "raven/raven": "0.5.*", - "ruflin/elastica": "0.90.*" - }, - "suggest": { - "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", - "doctrine/couchdb": "Allow sending log messages to a CouchDB server", - "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", - "ext-mongo": "Allow sending log messages to a MongoDB server", - "mlehner/gelf-php": "Allow sending log messages to a GrayLog2 server", - "raven/raven": "Allow sending log messages to a Sentry server", - "ruflin/elastica": "Allow sending log messages to an Elastic Search server" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.7.x-dev" - } - }, - "autoload": { - "psr-0": { - "Monolog": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be", - "role": "Developer" - } - ], - "description": "Sends your logs to files, sockets, inboxes, databases and various web services", - "homepage": "http://github.com/Seldaek/monolog", - "keywords": [ - "log", - "logging", - "psr-3" - ], - "time": "2013-11-14 19:48:31" - }, - { - "name": "phpunit/php-code-coverage", - "version": "1.2.13", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "466e7cd2554b4e264c9e3f31216d25ac0e5f3d94" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/466e7cd2554b4e264c9e3f31216d25ac0e5f3d94", - "reference": "466e7cd2554b4e264c9e3f31216d25ac0e5f3d94", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "phpunit/php-file-iterator": ">=1.3.0@stable", - "phpunit/php-text-template": ">=1.1.1@stable", - "phpunit/php-token-stream": ">=1.1.3@stable" - }, - "require-dev": { - "phpunit/phpunit": "3.7.*@dev" - }, - "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.0.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "PHP/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2013-09-10 08:14:32" - }, - { - "name": "phpunit/php-file-iterator", - "version": "1.3.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb", - "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "File/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2013-10-10 15:34:57" - }, - { - "name": "phpunit/php-text-template", - "version": "1.1.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5180896f51c5b3648ac946b05f9ec02be78a0b23" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5180896f51c5b3648ac946b05f9ec02be78a0b23", - "reference": "5180896f51c5b3648ac946b05f9ec02be78a0b23", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "Text/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2012-10-31 18:15:28" - }, - { - "name": "phpunit/php-timer", - "version": "1.0.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c", - "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "PHP/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2013-08-02 07:42:54" - }, - { - "name": "phpunit/php-token-stream", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "5220af2a7929aa35cf663d97c89ad3d50cf5fa3e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/5220af2a7929aa35cf663d97c89ad3d50cf5fa3e", - "reference": "5220af2a7929aa35cf663d97c89ad3d50cf5fa3e", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2-dev" - } - }, - "autoload": { - "classmap": [ - "PHP/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2013-09-13 04:58:23" - }, - { - "name": "phpunit/phpunit", - "version": "3.7.28", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "3b97c8492bcafbabe6b6fbd2ab35f2f04d932a8d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3b97c8492bcafbabe6b6fbd2ab35f2f04d932a8d", - "reference": "3b97c8492bcafbabe6b6fbd2ab35f2f04d932a8d", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=5.3.3", - "phpunit/php-code-coverage": "~1.2.1", - "phpunit/php-file-iterator": ">=1.3.1", - "phpunit/php-text-template": ">=1.1.1", - "phpunit/php-timer": ">=1.0.4", - "phpunit/phpunit-mock-objects": "~1.2.0", - "symfony/yaml": "~2.0" - }, - "require-dev": { - "pear-pear/pear": "1.9.4" - }, - "suggest": { - "ext-json": "*", - "ext-simplexml": "*", - "ext-tokenizer": "*", - "phpunit/php-invoker": ">=1.1.0,<1.2.0" - }, - "bin": [ - "composer/bin/phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.7.x-dev" - } - }, - "autoload": { - "classmap": [ - "PHPUnit/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "", - "../../symfony/yaml/" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "http://www.phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2013-10-17 07:27:40" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "1.2.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5794e3c5c5ba0fb037b11d8151add2a07fa82875", - "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "phpunit/php-text-template": ">=1.1.1@stable" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "autoload": { - "classmap": [ - "PHPUnit/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2013-01-13 10:24:48" - }, - { - "name": "psr/log", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", - "shasum": "" - }, - "type": "library", - "autoload": { - "psr-0": { - "Psr\\Log\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2012-12-21 11:40:51" - }, - { - "name": "slim/slim", - "version": "2.4.0", - "source": { - "type": "git", - "url": "https://github.com/codeguy/Slim.git", - "reference": "ff7d7148848fa4f45712984d7b91ac3cbced586b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/codeguy/Slim/zipball/ff7d7148848fa4f45712984d7b91ac3cbced586b", - "reference": "ff7d7148848fa4f45712984d7b91ac3cbced586b", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "suggest": { - "ext-mcrypt": "Required for HTTP cookie encryption" - }, - "type": "library", - "autoload": { - "psr-0": { - "Slim": "." - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Josh Lockhart", - "email": "info@joshlockhart.com", - "homepage": "http://www.joshlockhart.com/" - } - ], - "description": "Slim Framework, a PHP micro framework", - "homepage": "http://github.com/codeguy/Slim", - "keywords": [ - "microframework", - "rest", - "router" - ], - "time": "2013-11-29 20:33:36" - }, - { - "name": "slim/views", - "version": "0.1.1", - "target-dir": "Slim/Views", - "source": { - "type": "git", - "url": "https://github.com/codeguy/Slim-Views.git", - "reference": "8c7e0f3067e5e10b7b4ca98f29bdef8d5cfe5371" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/codeguy/Slim-Views/zipball/8c7e0f3067e5e10b7b4ca98f29bdef8d5cfe5371", - "reference": "8c7e0f3067e5e10b7b4ca98f29bdef8d5cfe5371", - "shasum": "" - }, - "require": { - "php": ">=5.3.0", - "slim/slim": ">=2.4.0" - }, - "suggest": { - "smarty/smarty": "Smarty templating system", - "twig/twig": "Twig templating system" - }, - "type": "library", - "autoload": { - "psr-0": { - "Slim\\Views": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Andrew Smith", - "email": "a.smith@silentworks.co.uk", - "homepage": "http://thoughts.silentworks.co.uk/" - }, - { - "name": "Josh Lockhart", - "email": "info@joshlockhart.com", - "homepage": "http://www.joshlockhart.com/" - } - ], - "description": "Smarty and Twig View Parser package for the Slim Framework", - "homepage": "http://github.com/codeguy/Slim-Views", - "keywords": [ - "extensions", - "slimphp", - "templating" - ], - "time": "2013-12-08 10:18:35" - }, - { - "name": "symfony/browser-kit", - "version": "v2.4.1", - "target-dir": "Symfony/Component/BrowserKit", - "source": { - "type": "git", - "url": "https://github.com/symfony/BrowserKit.git", - "reference": "0248b2dfc9cd6b259555d232eedfb1283eb496c3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/BrowserKit/zipball/0248b2dfc9cd6b259555d232eedfb1283eb496c3", - "reference": "0248b2dfc9cd6b259555d232eedfb1283eb496c3", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "symfony/dom-crawler": "~2.0" - }, - "require-dev": { - "symfony/css-selector": "~2.0", - "symfony/process": "~2.0" - }, - "suggest": { - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\BrowserKit\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - } - ], - "description": "Symfony BrowserKit Component", - "homepage": "http://symfony.com", - "time": "2013-12-28 21:39:51" - }, - { - "name": "symfony/console", - "version": "v2.4.1", - "target-dir": "Symfony/Component/Console", - "source": { - "type": "git", - "url": "https://github.com/symfony/Console.git", - "reference": "4c1ed2ff514bd85ee186eebb010ccbdeeab05af7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/4c1ed2ff514bd85ee186eebb010ccbdeeab05af7", - "reference": "4c1ed2ff514bd85ee186eebb010ccbdeeab05af7", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "symfony/event-dispatcher": "~2.1" - }, - "suggest": { - "symfony/event-dispatcher": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Console\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - } - ], - "description": "Symfony Console Component", - "homepage": "http://symfony.com", - "time": "2014-01-01 08:14:50" - }, - { - "name": "symfony/css-selector", - "version": "v2.4.1", - "target-dir": "Symfony/Component/CssSelector", - "source": { - "type": "git", - "url": "https://github.com/symfony/CssSelector.git", - "reference": "352552da1f50a79f6a6fa427e4a85ee2ea1945f6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/CssSelector/zipball/352552da1f50a79f6a6fa427e4a85ee2ea1945f6", - "reference": "352552da1f50a79f6a6fa427e4a85ee2ea1945f6", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\CssSelector\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Jean-François Simon", - "email": "jeanfrancois.simon@sensiolabs.com" - } - ], - "description": "Symfony CssSelector Component", - "homepage": "http://symfony.com", - "time": "2014-01-01 08:14:50" - }, - { - "name": "symfony/dom-crawler", - "version": "v2.4.1", - "target-dir": "Symfony/Component/DomCrawler", - "source": { - "type": "git", - "url": "https://github.com/symfony/DomCrawler.git", - "reference": "58e85928ad277c67102a41a046160de86df44d55" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/DomCrawler/zipball/58e85928ad277c67102a41a046160de86df44d55", - "reference": "58e85928ad277c67102a41a046160de86df44d55", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "symfony/css-selector": "~2.0" - }, - "suggest": { - "symfony/css-selector": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\DomCrawler\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - } - ], - "description": "Symfony DomCrawler Component", - "homepage": "http://symfony.com", - "time": "2013-12-29 20:33:52" - }, - { - "name": "symfony/event-dispatcher", - "version": "v2.4.1", - "target-dir": "Symfony/Component/EventDispatcher", - "source": { - "type": "git", - "url": "https://github.com/symfony/EventDispatcher.git", - "reference": "e3ba42f6a70554ed05749e61b829550f6ac33601" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/e3ba42f6a70554ed05749e61b829550f6ac33601", - "reference": "e3ba42f6a70554ed05749e61b829550f6ac33601", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "symfony/dependency-injection": "~2.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\EventDispatcher\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - } - ], - "description": "Symfony EventDispatcher Component", - "homepage": "http://symfony.com", - "time": "2013-12-28 08:12:03" - }, - { - "name": "symfony/finder", - "version": "v2.4.1", - "target-dir": "Symfony/Component/Finder", - "source": { - "type": "git", - "url": "https://github.com/symfony/Finder.git", - "reference": "6904345cf2b3bbab1f6d6e4ce1724cb99df9f00a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Finder/zipball/6904345cf2b3bbab1f6d6e4ce1724cb99df9f00a", - "reference": "6904345cf2b3bbab1f6d6e4ce1724cb99df9f00a", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Finder\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - } - ], - "description": "Symfony Finder Component", - "homepage": "http://symfony.com", - "time": "2014-01-01 08:14:50" - }, - { - "name": "symfony/process", - "version": "v2.4.1", - "target-dir": "Symfony/Component/Process", - "source": { - "type": "git", - "url": "https://github.com/symfony/Process.git", - "reference": "58fdccb311e44f28866f976c2d7b3227e9f713db" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Process/zipball/58fdccb311e44f28866f976c2d7b3227e9f713db", - "reference": "58fdccb311e44f28866f976c2d7b3227e9f713db", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Process\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - } - ], - "description": "Symfony Process Component", - "homepage": "http://symfony.com", - "time": "2014-01-05 02:10:50" - }, - { - "name": "symfony/yaml", - "version": "dev-master", - "target-dir": "Symfony/Component/Yaml", - "source": { - "type": "git", - "url": "https://github.com/symfony/Yaml.git", - "reference": "9921872611710df49cf035c259e5a461ea2d0f8c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/9921872611710df49cf035c259e5a461ea2d0f8c", - "reference": "9921872611710df49cf035c259e5a461ea2d0f8c", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Yaml\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "http://symfony.com", - "time": "2014-01-07 13:29:57" - }, - { - "name": "twig/twig", - "version": "v1.15.0", - "source": { - "type": "git", - "url": "https://github.com/fabpot/Twig.git", - "reference": "85e4ff98000157ff753d934b9f13659a953f5666" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/fabpot/Twig/zipball/85e4ff98000157ff753d934b9f13659a953f5666", - "reference": "85e4ff98000157ff753d934b9f13659a953f5666", - "shasum": "" - }, - "require": { - "php": ">=5.2.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.15-dev" - } - }, - "autoload": { - "psr-0": { - "Twig_": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com" - } - ], - "description": "Twig, the flexible, fast, and secure template language for PHP", - "homepage": "http://twig.sensiolabs.org", - "keywords": [ - "templating" - ], - "time": "2013-12-06 07:47:10" - } - ], - "packages-dev": [ - - ], - "aliases": [ - - ], - "minimum-stability": "stable", - "stability-flags": { - "symfony/yaml": 20 - }, - "platform": { - "php": ">=5.3.0" - }, - "platform-dev": [ - - ] -} diff --git a/public/js/app.js b/public/js/app.js index 02df0de..aa62959 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -443,6 +443,11 @@ APP = { // and run that test. test = tests.shift(); + var env = APP.test.findEnvs(); + env = env.join('+'); + + var url = test.attr('action') + '?env=' + env; + // Run the test $.ajax({ url : test.attr('action'), @@ -544,6 +549,28 @@ APP = { return tests; }, + /** + * Find all environments + * + * @return Array of form objects or FALSE + */ + findEnvs: function() + { + var checkedIds = $(":checkbox[name^=envs]:checked").map(function() { + return this.id; + }).get(); + + checkedIds = checkedIds.map(function(item){ + if (item.indexOf('_envs') !== -1) { + return item.substring(0, item.indexOf('_envs')); + } else { + return ''; + } + }); + + return checkedIds; + }, + /** * Start running the tests. */ diff --git a/public/js/app.js.orig b/public/js/app.js.orig new file mode 100644 index 0000000..02df0de --- /dev/null +++ b/public/js/app.js.orig @@ -0,0 +1,818 @@ +/** + * This file is part of the Webception package. + * + * (c) James Healey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * The following Application takes care of 6 parts: + * + * Codeception : Check if Codeception is runnable. + * Toolbar : Handle the toolbar state based on the Application state. + * State : Hold the Application state. + * Tests : Handlers for running tests & updating UI test elements. + * Console : Handlers for the Console. + * Mode : Allows test mode to be run (by setting a query string value). + */ + +APP = { + + /** + * Initialize the Application. + */ + init: function() { + + // See if Codeception is runnable. + APP.codeception.init(); + + // Setup any other Test interactions. + APP.test.init(); + + // Setup the app & toolbar states. + APP.state.init(); + + // Setup the Console filters + APP.console.init(); + + }, + + /** + * Codeception Initialization + */ + codeception: { + + vars: { + + ready: false, + eCodeceptionButton: '#button_codeception', + eLogButton: '#button_logs', + eHideOnError: '.hide_on_error', + eErrorContainer: '#error_container', + eErrorMessage: '#error_container .message', + eErrorResource: '#error_container strong.resource', + eErrorConfig: '#error_container strong.config', + sButton: 'button ', + + /** + * List of checks to run. + */ + checks: { + 'log': { + button: '#button_logs', + label: 'LOG', + url: 'logs', + }, + 'executable': { + button: '#button_codeception', + label: 'EXECUTABLE', + url: 'executable', + } + }, + + /** + * All the available states for the Codeception button + */ + states: { + 'running': { + css: 'secondary disabled', + label: '%s EXECUTABLE...', + showError: false, + }, + 'passed': { + css: 'success ', + label: '%s PASSED', + showError: false, + }, + 'failed': { + css: 'alert', + label: '%s FAILED', + showError: true, + }, + } + }, + + init: function() + { + // Run each check individually. + Object.keys(APP.codeception.vars.checks).forEach(function (key) + { + APP.codeception.check(key); + }); + }, + + /** + * Make an AJAX call to see if Codeception is executable. + */ + check: function(type) + { + var chosen_type = APP.codeception.vars.checks[type]; + + $.ajax({ + url : chosen_type.url, + method : 'GET', + cache : false, + dataType : 'json', + data : APP.mode.data(), + beforeSend : function (xhr, settings) + { + // Hide any error messages + // and set the state of the codeception status to running. + $(APP.codeception.vars.eErrorContainer).hide(); + + APP.codeception.refresh('running', xhr, chosen_type); + + }, + success: function(data, status, xhr) + { + // Update the Codeception button to indicate success! + APP.codeception.refresh('passed', data, chosen_type); + }, + error: function(xhr, status, message) + { + // Update the Codeception button to indicate it's not ready. + APP.codeception.refresh('failed', xhr, chosen_type); + } + }); + }, + + /** + * Refresh the state of the Codeception state button + * + * @param String state + * @param JSON response + */ + refresh: function(state, response, type) + { + // Load the details of the current state + var chosenState = APP.codeception.vars.states[state]; + + // Filter in the check-type into the button label + var message = sprintf(chosenState.label, type.label); + + // Update the button state. + $(type.button) + .attr('class', APP.codeception.vars.sButton + chosenState.css) + .html(message); + + // If Codeception is not setup properly, + // show the error message and hide all the tests. + if (chosenState.showError) + { + $(APP.codeception.vars.eHideOnError).hide(); + + // If the resource details are not set, it means + // the Codeception config is really broken. + // An error will already show in that case. + if (response.responseJSON.resource.length > 0) + { + $(APP.codeception.vars.eErrorMessage).html(response.responseJSON.error); + $(APP.codeception.vars.eErrorResource).html(response.responseJSON.resource); + $(APP.codeception.vars.eErrorConfig).html(response.responseJSON.config); + $(APP.codeception.vars.eErrorContainer).show(); + } + } + } + }, + + /** + * Store and Update the state of the Application + */ + state: { + vars: { + + // Default state. Used to reset the state if states change. + currentState: 'ready', + + // Tallies for the test states + countTests: 0, + countRun: 0, + countPass: 0, + countFail: 0, + + // State booleans + running: false, + stopped: false, + + }, + + init: function() { + + // Initial count of all the available tests + APP.state.updateCount(); + + // Update the UI to reflect the current state + APP.state.refresh('ready'); + }, + + /** + * Set the Application state. + * + * @param String state + */ + refresh: function(state) { + + // Get the current state + APP.state.vars.currentState = state; + + // Load the details of the current state + var chosenState = APP.toolbar.vars.states[state]; + + // Set all the variables that can be used in the status message. + var message_counts = { + tests: APP.state.vars.countTests, + run: APP.state.vars.countRun, + pass: APP.state.vars.countPass, + fail: APP.state.vars.countFail, + }; + + // Pass the message_counts into the chosen state message + message = sprintf(chosenState.message, message_counts); + + // Grab the container + $status = $(APP.toolbar.vars.eStatusContainer); + + // Get the click event for the action button + var bind = chosenState.bind; + + // Update the message state and button states. + APP.state.vars.running = chosenState.running; + APP.state.vars.stopped = chosenState.stopped; + + // Update the message box (if required) + $(APP.toolbar.vars.eMessageContainer, $status).html(message); + + // Update the class & content of the state button. + $(APP.toolbar.vars.eButtonState, $status) + .attr('class', APP.toolbar.vars.sButton + chosenState.buttonReadyCss) + .html(''+ chosenState.buttonReadyLabel +''); + + // Update the bind, class & content on the action button. + $(APP.toolbar.vars.eButtonAction, $status) + .unbind('click') + .bind('click', function(e) { + e.preventDefault(); + + // Bind the new click event to the action button. + // Also - I hate this line of code. Is there a better way? + eval("APP.test." + bind + "()"); + }) + .attr('class', APP.toolbar.vars.sButton + chosenState.buttonActionCss) + .html(''+ chosenState.buttonActionLabel +''); + }, + + /** + * Update the count of chosen tests. + */ + updateCount: function() + { + APP.state.vars.countTests = APP.test.find().length; + }, + + /* + * State Check: Return if the Tests are running. + */ + isRunning: function() { + return APP.state.vars.running; + }, + + /* + * State Check: Return if the Tests have been stopped. + */ + isStopped: function() { + return APP.state.vars.stopped; + }, + + /* + * State Check: Return if the chosen tests have been run. + */ + isCompleted: function() { + return APP.state.vars.countRun == APP.state.vars.countTests + }, + + }, + + /** + * Toolbar of Webception + */ + toolbar: { + + vars: { + + // Elements + eStatusContainer: '#status_container', + eMessageContainer: 'h3.message', + eProgressContainer: '#progress_container .meter', + eButtonState: '#button_state', + eButtonAction: '#button_action', + + // All possible States and Content of the buttons + sButton: 'button small ', + + // All possible Toolbar states + states : { + 'ready': { + message: 'Ready to run %(tests)s tests.', + buttonReadyCss: 'secondary disabled', + buttonReadyLabel: 'READY', + buttonActionCss: 'success', + buttonActionLabel: 'START', + bind: 'start', + running: false, + stopped: false, + }, + 'running': { + message: 'Running %(run)s out of %(tests)s.', + buttonReadyCss: '', + buttonReadyLabel: 'RUNNING', + buttonActionCss: 'alert', + buttonActionLabel: 'STOP', + bind: 'stop', + running: true, + stopped: false, + }, + 'stopped': { + message: 'Tests stopped after %(run)s out of %(tests)s.', + buttonReadyCss: 'alert', + buttonReadyLabel: 'STOPPED', + buttonActionCss: 'secondary', + buttonActionLabel: 'RESET', + bind: 'reset', + running: false, + stopped: true, + }, + 'failed': { + message: 'All tests run. %(pass)s passed, %(fail)s fails.', + buttonReadyCss: 'alert', + buttonReadyLabel: 'FAILED', + buttonActionCss: 'secondary', + buttonActionLabel: 'RESET', + bind: 'reset', + running: false, + stopped: false, + }, + 'passed': { + message: 'All tests run. Everything passed!', + buttonReadyCss: 'success', + buttonReadyLabel: 'PASSED', + buttonActionCss: 'secondary', + buttonActionLabel: 'RESET', + bind: 'reset', + running: false, + stopped: false, + }, + }, + }, + + /** + * Update the progress bar. + * + * @param Integer count + * @param Integer total + */ + progressBar: function(count, total) + { + $(APP.toolbar.vars.eProgressContainer).css('width', ((100/total) * count) +'%'); + }, + }, + + /** + * Test Runner & State Handlers + */ + test: { + + init: function() + { + APP.test.binds(); + }, + + vars: { + + // Elements + eTestsGroup: '.tests_group', + eTestState : 'span', + eRunAll: '.all_toggle', + eRunGroup: '.type_toggle', + eTestCheckboxes: 'div.test input[type=checkbox]', + + // Basic styling of the state button + sButton: 'tiny label radius right ', + + // All possible States and Content of the buttons + states: { + 'ready': { + css: 'secondary disabled', + label: 'READY', + }, + 'running': { + css: '', + label: 'RUNNING', + }, + 'error': { + css: 'alert', + label: 'ERROR', + }, + 'stopped': { + css: 'alert', + label: 'STOPPED', + }, + 'failed': { + css: 'alert', + label: 'FAILED', + }, + 'passed': { + css: 'success', + label: 'PASSED', + }, + } + }, + + /** + * Test Runner. + * + * @param Array List of test IDs. + */ + run: function(tests) + { + // If the tests are being run and we still have tests left... + if (APP.state.isRunning() && tests.length > 0) + { + // Remove the first test from the list, + // and run that test. + test = tests.shift(); + + // Run the test + $.ajax({ + url : test.attr('action'), + method : 'GET', + cache : false, + dataType : "json", + beforeSend : function (xhr, settings) + { + // Before running the tests, + // update the progress bar and set the test state to 'running' + APP.toolbar.progressBar(++APP.state.vars.countRun, + APP.state.vars.countTests); + APP.test.refresh(test, 'running'); + APP.state.refresh('running'); + }, + success : function(data, status, xhr) + { + // After a successful run, update the test status. + APP.test.complete(test, data, xhr); + + // Carry on running the tests... + APP.test.run(tests); + } + }); + + } else if (APP.state.isStopped()) { + + APP.state.refresh('stopped'); + + } else if (APP.state.isCompleted()) { + + // Re-enable the checkboxes + APP.test.checkboxToggle(); + + // All the tests have been run, so decide how the tests faired. + (APP.state.vars.countFail > 0) ? + APP.state.refresh('failed') : APP.state.refresh('passed'); + + } + }, + + /** + * Set the state of the given test to Running. + * + * @param Form Object test + * @param String state + */ + refresh: function (test, state) { + + // Load the details of the current state + var chosenState = APP.test.vars.states[state]; + + // Update the test + $(APP.test.vars.eTestState, $(test)) + .attr('class', APP.test.vars.sButton + chosenState.css) + .html(chosenState.label); + }, + + /** + * Set the test state after it's been run (whether it's pass or fail) + */ + complete: function(test, data, xhr) + { + var state; + + // Check the state of the completed test and + // set the UI state and updated counts. + state = (data.passed == true) ? 'passed' : 'failed'; + + // Cheeky one liner to increment the right counter. + (data.passed == true) ? APP.state.vars.countPass++ : APP.state.vars.countFail++; + + // Append the test log to the console + APP.console.add(data); + + // Update the single test state + APP.test.refresh(test, state); + + // Force refresh on the console filter + APP.console.filter(APP.console.vars.filter); + }, + + /** + * Find all the Tests + * + * @return Array of form objects or FALSE + */ + find: function() + { + var tests = []; + + // For every form on the page, only add it to the test list + // if the checkbox is checked. + $("form").each(function() { + if ($('input[type=checkbox]', $(this)).prop('checked')) + tests.push($(this)); + }); + + return tests; + }, + + /** + * Start running the tests. + */ + start: function() { + + tests = APP.test.find(); + + // If there are tests available... + if (tests.length > 0) + { + APP.console.clear(); + APP.test.checkboxToggle(); + APP.state.refresh('running'); + APP.test.run(tests); + } else { + APP.state.showError('Please select some tests to run.'); + } + }, + + /** + * Stop the tests from running. + */ + stop: function() { + + // Re-enable the checkboxes + APP.test.checkboxToggle(); + + // And set the application state to Stopped. + APP.state.refresh('stopped'); + }, + + /** + * Reset the Application state to ready. + */ + reset: function() { + + // Reset all the counters + APP.state.vars.countRun = 0; + APP.state.vars.countPass = 0; + APP.state.vars.countFail = 0; + + // Clear the progress bar + APP.toolbar.progressBar(0, APP.state.vars.countTests); + + // Reset all the tests + $("form").each(function() { + APP.test.refresh($(this), 'ready'); + }); + + // And finally refresh the state + APP.state.refresh('ready'); + }, + + /** + * Binds for the Test + */ + binds: function() + { + // INCLUDE ALL - toggle the group on/off when clicked. + $(APP.test.vars.eRunAll).on('click', function(e) + { + $ischecked = $(this).is(":checked"); + + $(APP.test.vars.eRunAll).prop('checked', $ischecked); + $(APP.test.vars.eRunGroup).prop('checked', $ischecked); + $(APP.test.vars.eTestCheckboxes).prop('checked', $ischecked); + + APP.state.updateCount(); + APP.state.refresh(APP.state.vars.currentState); + }); + + // Group Checkboxes - Unchecking a checkbox removes it from the list + // and also unchecks the 'Run all' checkbox. + $(APP.test.vars.eRunGroup).on('click', function(e) + { + $ischecked = $(this).is(":checked"); + + $(APP.test.vars.eTestCheckboxes, $(this).closest(APP.test.vars.eTestsGroup)) + .prop('checked', $ischecked); + + APP.test.checkboxToggleAll(); + APP.state.updateCount(); + APP.state.refresh(APP.state.vars.currentState); + }); + + // Test Checkboxes - Unchecking a checkbox removes it from the list + // and also unchecks the 'Include All' checkbox. + $(APP.test.vars.eTestCheckboxes).on('click', function(e) + { + APP.test.checkboxToggleGroup(this); + APP.test.checkboxToggleAll(); + APP.state.updateCount(); + APP.state.refresh(APP.state.vars.currentState); + }); + }, + + /** + * Based on the count of how many tests are checked, + * the UI toggles the 'Include All' checkboxes. + */ + checkboxToggleAll: function() + { + // Count all of the available tests + var all_checked = $('form input[type=checkbox]:checked').length; + var all_count = $('form input[type=checkbox]').length; + + // If all the tests are checked, check the 'Include All' checkbox + $(APP.test.vars.eRunAll).prop('checked', (all_checked == all_count)); + }, + + /** + * Based on the count of how many tests are checked in a group, + * the UI toggles the 'Include (type) Tests' and the 'Include All' checkboxes. + * + * @param element group Checkbox that handled the click-event. + */ + checkboxToggleGroup: function(group) + { + // In the current test group, find how many are available & how many are checked + var $group = $(group).closest(APP.test.vars.eTestsGroup); + var group_count = $(APP.test.vars.eTestCheckboxes, $group).length; + var group_checked = $(APP.test.vars.eTestCheckboxes +':checked', $group).length; + + // If all the tests in the group are checked, check the 'Include (type) Tests' checkbox + $(APP.test.vars.eRunGroup, $group).prop('checked', (group_count == group_checked)); + }, + + /** + * Checkboxes are enabled by default. + * + * On start, they're disabled. + * On reset, they're enabled. + */ + checkboxToggle: function() + { + $('input:checkbox').toggleDisabled(); + }, + }, + + /** + * Console Functions & Binds + */ + console: { + + init: function() { + + // Ready the Console filter binds + APP.console.binds(); + + }, + + vars: { + eFilter: '.console_filter', + eConsoleContainer: '#console_container', + sButtonDefault: 'console_filter radius', + filter: 'all', + }, + + /** + * Binds for the Console + */ + binds: function() { + + // Console Filters + $(APP.console.vars.eFilter).on('click', function(e) + { + e.preventDefault(); + + var filter = $(this); + + // Clear out the other filter styles + $.each( $(APP.console.vars.eFilter), function( index, filt ){ + $(filt).addClass('secondary').removeClass($(filt).attr('data-css')); + }); + + // Add the class to the button to imply it's active + APP.console.vars.filter = filter.attr('id'); + APP.console.filter(filter.attr('id')); + filter.removeClass('secondary').addClass(filter.attr('data-css')); + + }); + + // Add high-light colour to console filter on hover. + $(APP.console.vars.eFilter).on({ + mouseenter: function() { + $(this).removeClass('secondary').addClass($(this).attr('data-css')); + }, + mouseleave: function() { + // Only remove the hover state if the current state is not the same. + if ($(this).attr('id') != APP.console.vars.filter) + $(this).addClass('secondary').removeClass($(this).attr('data-css')); + } + }); + }, + + /** + * Filter the tests in the console type the filter + * + * @param string filter 'All|Passed|Failed' + */ + filter: function(filter) { + $(APP.console.vars.eConsoleContainer +' > div').hide(); + $(APP.console.vars.eConsoleContainer +' .'+ filter).show(); + }, + + /** + * Given the result of a running a test, append the console output. + * + * @param object Test + */ + add: function(test) + { + var consoleContainer = $(APP.console.vars.eConsoleContainer); + consoleContainer.show(); + + // Load the details of the current state + var chosenState = APP.test.vars.states[test.state]; + + var testResult = $('
', {'class': test.state +' all'}); + var state = $('', {'class': APP.test.vars.sButton + chosenState.css, + }).html(chosenState.label).appendTo(testResult); + + $('
', {'text': test.title}).appendTo(testResult); + $('
', {'text': test.log}).appendTo(testResult);
+            $('
').appendTo(testResult); + + testResult.appendTo(consoleContainer); + + // Move down to the bottom of the container + consoleContainer[0].scrollTop = consoleContainer[0].scrollHeight; + }, + + /** + * Empty the content of the console + */ + clear: function() { + $(APP.console.vars.eConsoleContainer).html(''); + }, + }, + + /** + * If Test mode is set (via query string), it's pass forward + * into any AJAX calls. + */ + mode: { + + data: function() + { + if (location.search.indexOf('test=') >= 0) + return {'test' : APP.mode.getParameterByName('test') }; + + return {}; + }, + + getParameterByName: function(name) + { + name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); + var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), + results = regex.exec(location.search); + return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); + } + } +}; + +(function($) { + $.fn.toggleDisabled = function(){ return this.each(function(){ this.disabled = !this.disabled; });} +})(jQuery); + +; (function ( context, $ ) { + "use strict"; + APP.init(); +})(this, jQuery, window); \ No newline at end of file