Commit dd205671 authored by rlgy's avatar rlgy

update

parent bc0b51a0
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "139577a2650159602fb12ecb9d8e76da",
......@@ -2158,16 +2158,16 @@
},
{
"name": "codeception/base",
"version": "2.4.2",
"version": "2.4.3",
"source": {
"type": "git",
"url": "https://github.com/Codeception/base.git",
"reference": "b41e442cbf8b7a269b74492a12fb1cf2bd06c3b8"
"reference": "a1416d3cd829bf8decb491143b3e8f8e02ee827f"
},
"dist": {
"type": "zip",
"url": "https://files.phpcomposer.com/files/Codeception/base/b41e442cbf8b7a269b74492a12fb1cf2bd06c3b8.zip",
"reference": "b41e442cbf8b7a269b74492a12fb1cf2bd06c3b8",
"url": "https://files.phpcomposer.com/files/Codeception/base/a1416d3cd829bf8decb491143b3e8f8e02ee827f.zip",
"reference": "a1416d3cd829bf8decb491143b3e8f8e02ee827f",
"shasum": ""
},
"require": {
......@@ -2243,7 +2243,7 @@
"functional testing",
"unit testing"
],
"time": "2018-05-26T22:24:57+00:00"
"time": "2018-06-26T14:35:46+00:00"
},
{
"name": "codeception/phpunit-wrapper",
......
#### 2.4.3
* [Create your own test formats](https://codeception.com/docs/07-AdvancedUsage#Formats) (e.g., Cept, Cest, ...); by @mlambley
* [Symfony] Fixed a bug in order to use multiple Kernels; by @alefcastelo
* [Asserts] Added new methods `assertNotTrue` and `assertNotFalse` methods; by @johannesschobel
* [REST][PhpBrowser][Frameworks] Added new methods to check for `Http Status Ranges` with nice "wrappers" (e.g., `seeHttpStatusCodeIsSuccessful()` checks the code between 200 and 299); by @johannesschobel
* Improved the docs; by community
#### 2.4.2
* Added support for `extends` in the `codeception.yml` and `*.suite.yml` files; by @johannesschobel.
Allows to inherit current config from a provided file. See example for `functional.suite.yml`:
```yml
actor: FunctionalTester
extends: shared.functional.suite.yml
......
......@@ -295,7 +295,7 @@ and you want to check that the user can log into the site using this password:
```php
<?php
$I->fillField('email', 'miles@davis.com')
$I->fillField('email', 'miles@davis.com');
$I->click('Generate Password');
$password = $I->grabTextFrom('#password');
$I->click('Login');
......
......@@ -357,6 +357,8 @@ Here is how it is done in the Db module:
class Db extends \Codeception\Module
{
protected $requiredFields = ['dsn', 'user', 'password'];
// ...
}
```
The next time you start the suite without setting one of these values, an exception will be thrown.
......@@ -370,6 +372,8 @@ class WebDriver extends \Codeception\Module
{
protected $requiredFields = ['browser', 'url'];
protected $config = ['host' => '127.0.0.1', 'port' => '4444'];
// ...
}
```
The host and port parameter can be redefined in the suite configuration.
......
......@@ -106,7 +106,7 @@ breaking the [Single Responsibility Principle](http://en.wikipedia.org/wiki/Sing
### Session Snapshot
If you need to authorize a user for each test, you can do so by submiting the login form at the beginning of every test.
If you need to authorize a user for each test, you can do so by submitting the login form at the beginning of every test.
Running those steps takes time, and in the case of Selenium tests (which are slow by themselves)
that time loss can become significant.
......@@ -237,7 +237,7 @@ the [PageObject pattern](http://docs.seleniumhq.org/docs/06_test_design_consider
which is widely used by test automation engineers. The PageObject pattern represents a web page as a class
and the DOM elements on that page as its properties, and some basic interactions as its methods.
PageObjects are very important when you are developing a flexible architecture of your tests.
Do not hardcode complex CSS or XPath locators in your tests but rather move them into PageObject classes.
Do not hard-code complex CSS or XPath locators in your tests but rather move them into PageObject classes.
Codeception can generate a PageObject class for you with command:
......
......@@ -497,7 +497,7 @@ public function myTest(\AcceptanceTester $I, \Codeception\Scenario $scenario)
}
```
`Codeception\Scenario` is also availble in Actor classes and StepObjects. You can access it with `$this->getScenario()`.
`Codeception\Scenario` is also available in Actor classes and StepObjects. You can access it with `$this->getScenario()`.
### Dependencies
......@@ -661,9 +661,53 @@ groups:
This will load all found `p*` files in `tests/_data` as groups. Group names will be as follows p1,p2,...,pN.
## Shell autocompletion
## Formats
For bash and zsh shells, you can use autocompletion for your Codeception projects by executing the following in your shell (or add it to your .bashrc/.zshrc):
In addition to the standard test formats (Cept, Cest, Unit, Gherkin) you can implement your own format classes to customise your test execution.
Specify these in your suite configuration:
```yaml
formats:
- \My\Namespace\MyFormat
```
Then define a class which implements the LoaderInterface
```php
namespace My\Namespace;
class MyFormat implements \Codeception\Test\Loader\LoaderInterface
{
protected $tests;
protected $settings;
public function __construct($settings = [])
{
//These are the suite settings
$this->settings = $settings;
}
public function loadTests($filename)
{
//Load file and create tests
}
public function getTests()
{
return $this->tests;
}
public function getPattern()
{
return '~Myformat\.php$~';
}
}
```
## Shell auto-completion
For bash and zsh shells, you can use auto-completion for your Codeception projects by executing the following in your shell (or add it to your .bashrc/.zshrc):
```bash
# BASH ~4.x, ZSH
source <([codecept location] _completion --generate-hook --program codecept --use-vendor-bin)
......
......@@ -138,7 +138,7 @@ $ composer require codeception/codeception
### Preparing Robo
Intitalizes basic RoboFile in the root of your project
Initializes basic RoboFile in the root of your project
```bash
$ robo init
......
......@@ -212,6 +212,14 @@ $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the
* `param float` $delta
### assertNotFalse
Checks that the condition is NOT false (everything but false)
* `param` $condition
* `param string` $message
### assertNotInstanceOf
* `param` $class
......@@ -245,6 +253,14 @@ Checks that two variables are not same
* `param string` $message
### assertNotTrue
Checks that the condition is NOT true (everything but true)
* `param` $condition
* `param string` $message
### assertNull
Checks that variable is NULL
......
......@@ -1567,6 +1567,34 @@ $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
* `param` $code
### seeResponseCodeIsBetween
Checks that response code is between a certain range. Between actually means [from <= CODE <= to]
* `param` $from
* `param` $to
### seeResponseCodeIsClientError
Checks that the response code is 4xx
### seeResponseCodeIsRedirection
Checks that the response code 3xx
### seeResponseCodeIsServerError
Checks that the response code is 5xx
### seeResponseCodeIsSuccessful
Checks that the response code 2xx
### seeSessionHasValues
Assert that the session has a given list of values.
......
......@@ -1243,6 +1243,34 @@ $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
* `param` $code
### seeResponseCodeIsBetween
Checks that response code is between a certain range. Between actually means [from <= CODE <= to]
* `param` $from
* `param` $to
### seeResponseCodeIsClientError
Checks that the response code is 4xx
### seeResponseCodeIsRedirection
Checks that the response code 3xx
### seeResponseCodeIsServerError
Checks that the response code is 5xx
### seeResponseCodeIsSuccessful
Checks that the response code 2xx
### selectOption
Selects an option in a select tag or in radio button group.
......
......@@ -1174,6 +1174,34 @@ $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
* `param` $code
### seeResponseCodeIsBetween
Checks that response code is between a certain range. Between actually means [from <= CODE <= to]
* `param` $from
* `param` $to
### seeResponseCodeIsClientError
Checks that the response code is 4xx
### seeResponseCodeIsRedirection
Checks that the response code 3xx
### seeResponseCodeIsServerError
Checks that the response code is 5xx
### seeResponseCodeIsSuccessful
Checks that the response code 2xx
### seeSessionHasValues
Assert that the session has a given list of values.
......
......@@ -1052,6 +1052,34 @@ $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
* `param` $code
### seeResponseCodeIsBetween
Checks that response code is between a certain range. Between actually means [from <= CODE <= to]
* `param` $from
* `param` $to
### seeResponseCodeIsClientError
Checks that the response code is 4xx
### seeResponseCodeIsRedirection
Checks that the response code 3xx
### seeResponseCodeIsServerError
Checks that the response code is 5xx
### seeResponseCodeIsSuccessful
Checks that the response code 2xx
### selectOption
Selects an option in a select tag or in radio button group.
......
......@@ -442,6 +442,26 @@ $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
* `param` $code
### seeResponseCodeIsClientError
Checks that the response code is 4xx
### seeResponseCodeIsRedirection
Checks that the response code 3xx
### seeResponseCodeIsServerError
Checks that the response code is 5xx
### seeResponseCodeIsSuccessful
Checks that the response code is 2xx
### seeResponseContains
Checks whether the last response contains text.
......
......@@ -1000,6 +1000,34 @@ $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
* `param` $code
### seeResponseCodeIsBetween
Checks that response code is between a certain range. Between actually means [from <= CODE <= to]
* `param` $from
* `param` $to
### seeResponseCodeIsClientError
Checks that the response code is 4xx
### seeResponseCodeIsRedirection
Checks that the response code 3xx
### seeResponseCodeIsServerError
Checks that the response code is 5xx
### seeResponseCodeIsSuccessful
Checks that the response code 2xx
### selectOption
Selects an option in a select tag or in radio button group.
......
......@@ -1143,6 +1143,34 @@ $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
* `param` $code
### seeResponseCodeIsBetween
Checks that response code is between a certain range. Between actually means [from <= CODE <= to]
* `param` $from
* `param` $to
### seeResponseCodeIsClientError
Checks that the response code is 4xx
### seeResponseCodeIsRedirection
Checks that the response code 3xx
### seeResponseCodeIsServerError
Checks that the response code is 5xx
### seeResponseCodeIsSuccessful
Checks that the response code 2xx
### selectOption
Selects an option in a select tag or in radio button group.
......
......@@ -1048,6 +1048,34 @@ $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
* `param` $code
### seeResponseCodeIsBetween
Checks that response code is between a certain range. Between actually means [from <= CODE <= to]
* `param` $from
* `param` $to
### seeResponseCodeIsClientError
Checks that the response code is 4xx
### seeResponseCodeIsRedirection
Checks that the response code 3xx
### seeResponseCodeIsServerError
Checks that the response code is 5xx
### seeResponseCodeIsSuccessful
Checks that the response code 2xx
### selectOption
Selects an option in a select tag or in radio button group.
......
......@@ -1299,6 +1299,34 @@ $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
* `param` $code
### seeResponseCodeIsBetween
Checks that response code is between a certain range. Between actually means [from <= CODE <= to]
* `param` $from
* `param` $to
### seeResponseCodeIsClientError
Checks that the response code is 4xx
### seeResponseCodeIsRedirection
Checks that the response code 3xx
### seeResponseCodeIsServerError
Checks that the response code is 5xx
### seeResponseCodeIsSuccessful
Checks that the response code 2xx
### selectOption
Selects an option in a select tag or in radio button group.
......
......@@ -1020,6 +1020,34 @@ $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
* `param` $code
### seeResponseCodeIsBetween
Checks that response code is between a certain range. Between actually means [from <= CODE <= to]
* `param` $from
* `param` $to
### seeResponseCodeIsClientError
Checks that the response code is 4xx
### seeResponseCodeIsRedirection
Checks that the response code 3xx
### seeResponseCodeIsServerError
Checks that the response code is 5xx
### seeResponseCodeIsSuccessful
Checks that the response code 2xx
### selectOption
Selects an option in a select tag or in radio button group.
......
......@@ -1029,6 +1029,34 @@ $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
* `param` $code
### seeResponseCodeIsBetween
Checks that response code is between a certain range. Between actually means [from <= CODE <= to]
* `param` $from
* `param` $to
### seeResponseCodeIsClientError
Checks that the response code is 4xx
### seeResponseCodeIsRedirection
Checks that the response code 3xx
### seeResponseCodeIsServerError
Checks that the response code is 5xx
### seeResponseCodeIsSuccessful
Checks that the response code 2xx
### selectOption
Selects an option in a select tag or in radio button group.
......
......@@ -955,6 +955,34 @@ $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
* `param` $code
### seeResponseCodeIsBetween
Checks that response code is between a certain range. Between actually means [from <= CODE <= to]
* `param` $from
* `param` $to
### seeResponseCodeIsClientError
Checks that the response code is 4xx
### seeResponseCodeIsRedirection
Checks that the response code 3xx
### seeResponseCodeIsServerError
Checks that the response code is 5xx
### seeResponseCodeIsSuccessful
Checks that the response code 2xx
### selectOption
Selects an option in a select tag or in radio button group.
......
......@@ -139,6 +139,7 @@ modules:
* `suite_namespace`: default namespace for new tests of this suite (ignores `namespace` option)
* `env`: override any configuration per [environment](http://codeception.com/docs/07-AdvancedUsage#Environments).
* `groups`: [groups](http://codeception.com/docs/07-AdvancedUsage#Groups) with the list of tests of for corresponding group.
* `formats`: [formats](http://codeception.com/docs/07-AdvancedUsage#Formats) with the list of extra test format classes.
* `coverage`: pre suite [CodeCoverage](http://codeception.com/docs/11-Codecoverage#Configuration) settings.
* `gherkin`: per suite [BDD Gherkin](http://codeception.com/docs/07-BDD#Configuration) settings.
* `error_level`: [error level](http://codeception.com/docs/04-FunctionalTests#Error-Reporting) for runner in current suite. Should be specified for unit, integration, functional tests. Passes value to `error_reporting` function.
......
......@@ -231,7 +231,7 @@ public function _beforeSuite($settings = []) {
* `param` $actual
* `param` $description
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L363)
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L385)
#### assertArrayNotHasKey()
......@@ -241,7 +241,7 @@ public function _beforeSuite($settings = []) {
* `param` $actual
* `param` $description
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L373)
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L395)
#### assertArraySubset()
......@@ -254,7 +254,7 @@ Checks that array contains subset.
* `param bool` $strict
* `param string` $message
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L386)
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L408)
#### assertContains()
......@@ -276,7 +276,7 @@ Checks that haystack contains needle
* `param` $actual
* `param` $description
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L396)
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L418)
#### assertEmpty()
......@@ -311,7 +311,7 @@ Checks that condition is negative.
* `param` $condition
* `param string` $message
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L276)
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L287)
#### assertFileExists()
......@@ -322,7 +322,7 @@ Checks if file exists
* `param string` $filename
* `param string` $message
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L312)
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L334)
#### assertFileNotExists()
......@@ -333,7 +333,7 @@ Checks if file doesn't exist
* `param string` $filename
* `param string` $message
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L324)
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L346)
#### assertGreaterOrEquals()
......@@ -343,7 +343,7 @@ Checks if file doesn't exist
* `param` $actual
* `param` $description
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L334)
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L356)
#### assertGreaterThan()
......@@ -389,7 +389,7 @@ Checks that actual is greater or equal than expected
* `param` $actual
* `param` $description
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L406)
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L428)
#### assertInternalType()
......@@ -399,7 +399,7 @@ Checks that actual is greater or equal than expected
* `param` $actual
* `param` $description
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L426)
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L448)
#### assertIsEmpty()
......@@ -408,7 +408,7 @@ Checks that actual is greater or equal than expected
* `param` $actual
* `param` $description
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L353)
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L375)
#### assertLessOrEquals()
......@@ -418,7 +418,7 @@ Checks that actual is greater or equal than expected
* `param` $actual
* `param` $description
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L344)
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L366)
#### assertLessThan()
......@@ -486,6 +486,17 @@ Checks that two variables are not equal
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L48)
#### assertNotFalse()
*protected* assertNotFalse($condition, $message = null)
Checks that the condition is NOT false (everything but false)
* `param` $condition
* `param string` $message
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L298)
#### assertNotInstanceOf()
*protected* assertNotInstanceOf($class, $actual, $description = null)
......@@ -494,7 +505,7 @@ Checks that two variables are not equal
* `param` $actual
* `param` $description
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L416)
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L438)
#### assertNotNull()
......@@ -531,6 +542,17 @@ Checks that two variables are not same
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L72)
#### assertNotTrue()
*protected* assertNotTrue($condition, $message = null)
Checks that the condition is NOT true (everything but true)
* `param` $condition
* `param string` $message
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L276)
#### assertNull()
*protected* assertNull($actual, $message = null)
......@@ -599,7 +621,7 @@ Checks that a string starts with the given prefix.
* `param` $constraint
* `param string` $message
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L287)
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L309)
#### assertThatItsNot()
......@@ -611,7 +633,7 @@ Checks that haystack doesn't attend
* `param` $constraint
* `param string` $message
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L299)
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L321)
#### assertTrue()
......@@ -653,7 +675,7 @@ Fails the test with message.
* `param` $message
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L436)
[See source](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Util/Shared/Asserts.php#L458)
#### getModule()
......
......@@ -6,7 +6,7 @@ namespace {
}
namespace Symfony\Component\CssSelector {
if (!class_exists('Symfony\Component\CssSelector\CssSelectorConverter')) {
if (!class_exists('Symfony\Component\CssSelector\CssSelectorConverter')) {
class CssSelectorConverter {
function toXPath($cssExpr, $prefix = 'descendant-or-self::') {
return CssSelector::toXPath($cssExpr, $prefix);
......@@ -69,4 +69,4 @@ namespace {
class WebDriverWindow extends Facebook\WebDriver\WebDriverWindow {};
interface WebDriverElement extends Facebook\WebDriver\WebDriverElement {};
}
}
\ No newline at end of file
}
......@@ -7,7 +7,7 @@ use Symfony\Component\EventDispatcher\EventDispatcher;
class Codecept
{
const VERSION = "2.4.2";
const VERSION = "2.4.3";
/**
* @var \Codeception\PHPUnit\Runner
......
......@@ -113,6 +113,7 @@ class Configuration
'extends' => null,
'namespace' => null,
'groups' => [],
'formats' => [],
'shuffle' => false,
'extensions' => [ // suite extensions
'enabled' => [],
......
......@@ -1577,6 +1577,24 @@ class InnerBrowser extends Module implements Web, PageSourceSaver, ElementLocato
}
/**
* Checks that response code is between a certain range. Between actually means [from <= CODE <= to]
*
* @param $from
* @param $to
*/
public function seeResponseCodeIsBetween($from, $to)
{
$failureMessage = sprintf(
'Expected HTTP Status Code between %s and %s. Actual Status Code: %s',
HttpCode::getDescription($from),
HttpCode::getDescription($to),
HttpCode::getDescription($this->getResponseStatusCode())
);
$this->assertGreaterThanOrEqual($from, $this->getResponseStatusCode(), $failureMessage);
$this->assertLessThanOrEqual($to, $this->getResponseStatusCode(), $failureMessage);
}
/**
* Checks that response code is equal to value provided.
*
* ```php
......@@ -1597,6 +1615,38 @@ class InnerBrowser extends Module implements Web, PageSourceSaver, ElementLocato
$this->assertNotEquals($code, $this->getResponseStatusCode(), $failureMessage);
}
/**
* Checks that the response code 2xx
*/
public function seeResponseCodeIsSuccessful()
{
$this->seeResponseCodeIsBetween(200, 299);
}
/**
* Checks that the response code 3xx
*/
public function seeResponseCodeIsRedirection()
{
$this->seeResponseCodeIsBetween(300, 399);
}
/**
* Checks that the response code is 4xx
*/
public function seeResponseCodeIsClientError()
{
$this->seeResponseCodeIsBetween(400, 499);
}
/**
* Checks that the response code is 5xx
*/
public function seeResponseCodeIsServerError()
{
$this->seeResponseCodeIsBetween(500, 599);
}
public function seeInTitle($title)
{
$nodes = $this->getCrawler()->filter('title');
......
......@@ -264,6 +264,17 @@ class Asserts extends CodeceptionModule
}
/**
* Checks that the condition is NOT true (everything but true)
*
* @param $condition
* @param string $message
*/
public function assertNotTrue($condition, $message = '')
{
parent::assertNotTrue($condition, $message);
}
/**
* Checks that condition is negative.
*
* @param $condition
......@@ -275,6 +286,17 @@ class Asserts extends CodeceptionModule
}
/**
* Checks that the condition is NOT false (everything but false)
*
* @param $condition
* @param string $message
*/
public function assertNotFalse($condition, $message = '')
{
parent::assertNotFalse($condition, $message);
}
/**
* Checks if file exists
*
* @param string $filename
......
......@@ -1162,6 +1162,39 @@ EOF;
}
/**
* Checks that the response code is 2xx
*/
public function seeResponseCodeIsSuccessful()
{
$this->connectionModule->seeResponseCodeIsSuccessful();
}
/**
* Checks that the response code 3xx
*/
public function seeResponseCodeIsRedirection()
{
$this->connectionModule->seeResponseCodeIsRedirection();
}
/**
* Checks that the response code is 4xx
*/
public function seeResponseCodeIsClientError()
{
$this->connectionModule->seeResponseCodeIsClientError();
}
/**
* Checks that the response code is 5xx
*/
public function seeResponseCodeIsServerError()
{
$this->connectionModule->seeResponseCodeIsServerError();
}
/**
* Checks whether last response was valid XML.
* This is done with libxml_get_last_error function.
*
......
......@@ -286,21 +286,23 @@ class Symfony extends Framework implements DoctrineProvider, PartedModule
. "Specify directory where file with Kernel class for your application is located with `app_path` parameter."
);
}
$file = current($results);
if (file_exists(codecept_root_dir() . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php')) {
// ensure autoloader from this dir is loaded
require_once codecept_root_dir() . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
}
require_once $file;
$filesRealPath = array_map(function ($file) {
require_once $file;
return $file->getRealPath();
}, $results);
$possibleKernelClasses = $this->getPossibleKernelClasses();
foreach ($possibleKernelClasses as $class) {
if (class_exists($class)) {
$refClass = new \ReflectionClass($class);
if ($refClass->getFileName() === $file->getRealpath()) {
if ($file = array_search($refClass->getFileName(), $filesRealPath)) {
return $class;
}
}
......
......@@ -53,6 +53,11 @@ class Loader
new UnitLoader(),
new GherkinLoader($suiteSettings)
];
if (isset($suiteSettings['formats'])) {
foreach ($suiteSettings['formats'] as $format) {
$this->formats[] = new $format($suiteSettings);
}
}
}
public function getTests()
......
......@@ -268,6 +268,17 @@ trait Asserts
}
/**
* Checks that the condition is NOT true (everything but true)
*
* @param $condition
* @param string $message
*/
protected function assertNotTrue($condition, $message = '')
{
\PHPUnit\Framework\Assert::assertNotTrue($condition, $message);
}
/**
* Checks that condition is negative.
*
* @param $condition
......@@ -279,6 +290,17 @@ trait Asserts
}
/**
* Checks that the condition is NOT false (everything but false)
*
* @param $condition
* @param string $message
*/
protected function assertNotFalse($condition, $message = '')
{
\PHPUnit\Framework\Assert::assertNotFalse($condition, $message);
}
/**
*
* @param $haystack
* @param $constraint
......
......@@ -4,4 +4,5 @@ modules:
- Filesystem
- Cli
- CliHelper
- CodeHelper
\ No newline at end of file
- CodeHelper
- Asserts
\ No newline at end of file
......@@ -47,6 +47,7 @@ class RunCest
$I->seeFileFound('report.json', 'tests/_output');
$I->seeInThisFile('"suite":');
$I->seeInThisFile('"dummy"');
$I->assertNotNull(json_decode(file_get_contents('tests/_output/report.json')));
}
/**
......@@ -292,7 +293,7 @@ EOF
$scenario->skip("Xdebug not loaded");
}
$file = "codeception".DIRECTORY_SEPARATOR."c3";
$file = "codeception" . DIRECTORY_SEPARATOR . "c3";
$I->executeCommand('run scenario SubStepsCept --steps');
$I->seeInShellOutput(<<<EOF
Scenario --
......
......@@ -19,7 +19,13 @@ class AssertsTest extends \PHPUnit\Framework\TestCase
$module->assertNotNull(false);
$module->assertNotNull(0);
$module->assertTrue(true);
$module->assertNotTrue(false);
$module->assertNotTrue(null);
$module->assertNotTrue('foo');
$module->assertFalse(false);
$module->assertNotFalse(true);
$module->assertNotFalse(null);
$module->assertNotFalse('foo');
$module->assertFileExists(__FILE__);
$module->assertFileNotExists(__FILE__ . '.notExist');
$module->assertInstanceOf('Exception', new Exception());
......
......@@ -691,4 +691,40 @@ HTML
$response = $this->module->grabPageSource();
$this->assertEquals('Codeception User Agent Test 1.0', $response, 'Incorrect user agent');
}
public function testIfStatusCodeIsWithin2xxRange()
{
$this->module->amOnPage('https://httpstat.us/200');
$this->module->seeResponseCodeIsSuccessful();
$this->module->amOnPage('https://httpstat.us/299');
$this->module->seeResponseCodeIsSuccessful();
}
public function testIfStatusCodeIsWithin3xxRange()
{
$this->module->amOnPage('https://httpstat.us/300');
$this->module->seeResponseCodeIsRedirection();
$this->module->amOnPage('https://httpstat.us/399');
$this->module->seeResponseCodeIsRedirection();
}
public function testIfStatusCodeIsWithin4xxRange()
{
$this->module->amOnPage('https://httpstat.us/400');
$this->module->seeResponseCodeIsClientError();
$this->module->amOnPage('https://httpstat.us/499');
$this->module->seeResponseCodeIsClientError();
}
public function testIfStatusCodeIsWithin5xxRange()
{
$this->module->amOnPage('https://httpstat.us/500');
$this->module->seeResponseCodeIsServerError();
$this->module->amOnPage('https://httpstat.us/599');
$this->module->seeResponseCodeIsServerError();
}
}
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Composer
Upstream-Contact: Jordi Boggiano <j.boggiano@seld.be>
Source: https://github.com/composer/composer
Copyright (c) Nils Adermann, Jordi Boggiano
Files: *
Copyright: 2016, Nils Adermann <naderman@naderman.de>
2016, Jordi Boggiano <j.boggiano@seld.be>
License: Expat
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
Files: src/Composer/Util/TlsHelper.php
Copyright: 2016, Nils Adermann <naderman@naderman.de>
2016, Jordi Boggiano <j.boggiano@seld.be>
2013, Evan Coury <me@evancoury.com>
License: Expat and BSD-2-Clause
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
License: BSD-2-Clause
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
.
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
License: Expat
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
......@@ -256,17 +256,17 @@
},
{
"name": "codeception/base",
"version": "2.4.2",
"version_normalized": "2.4.2.0",
"version": "2.4.3",
"version_normalized": "2.4.3.0",
"source": {
"type": "git",
"url": "https://github.com/Codeception/base.git",
"reference": "b41e442cbf8b7a269b74492a12fb1cf2bd06c3b8"
"reference": "a1416d3cd829bf8decb491143b3e8f8e02ee827f"
},
"dist": {
"type": "zip",
"url": "https://files.phpcomposer.com/files/Codeception/base/b41e442cbf8b7a269b74492a12fb1cf2bd06c3b8.zip",
"reference": "b41e442cbf8b7a269b74492a12fb1cf2bd06c3b8",
"url": "https://files.phpcomposer.com/files/Codeception/base/a1416d3cd829bf8decb491143b3e8f8e02ee827f.zip",
"reference": "a1416d3cd829bf8decb491143b3e8f8e02ee827f",
"shasum": ""
},
"require": {
......@@ -309,7 +309,7 @@
"stecman/symfony-console-completion": "For BASH autocompletion",
"symfony/phpunit-bridge": "For phpunit-bridge support"
},
"time": "2018-05-26T22:24:57+00:00",
"time": "2018-06-26T14:35:46+00:00",
"bin": [
"codecept"
],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment