Skip to content

Commit 93a6b9e

Browse files
committed
auto updated documentation
1 parent 5e2c211 commit 93a6b9e

File tree

9 files changed

+166
-55
lines changed

9 files changed

+166
-55
lines changed

changelog.markdown

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,35 @@ title: Codeception Changelog
77

88
# Changelog
99

10+
#### 2.4.2
11+
12+
* Added support for `extends` in the `codeception.yml` and `*.suite.yml` files; by **[johannesschobel](https://github.com/johannesschobel)**.
13+
Allows to inherit current config from a provided file. See example for `functional.suite.yml`:
14+
15+
16+
```yml
17+
actor: FunctionalTester
18+
extends: shared.functional.suite.yml
19+
modules:
20+
enabled:
21+
- \App\Modules\X\Tests\Helper\Functional
22+
```
23+
24+
* **[Yii2]** Restore null check for client in Yii2 by **[wkritzinger](https://github.com/wkritzinger)**. See [#4940](https://github.com/Codeception/Codeception/issues/4940)
25+
* **[Yii2]** Resetting Yii application in `_after`. By **[SamMousa](https://github.com/SamMousa)**. See [#4928](https://github.com/Codeception/Codeception/issues/4928)
26+
* **[Yii2]** **Breaking** `$settings['configFile']` now supports absolute paths. In you have defined relative path to config in absolute manner
27+
* **[WebDriverIO]** Added `deleteSessionSnapshot` by **[vi4o](https://github.com/vi4o)**
28+
* **[Symfony]** Added support for custom kernel names with `kernel_class` config option. By **[omnilight](https://github.com/omnilight)**.
29+
* **[Asserts]** Better exception message for `expectException` by **[Slamdunk](https://github.com/Slamdunk)**
30+
* **[REST]** Decode all non-arrays to array. See [#4946](https://github.com/Codeception/Codeception/issues/4946) by **[Amunak](https://github.com/Amunak)**, fixes [#4944](https://github.com/Codeception/Codeception/issues/4944).
31+
* **[ZF2]** Fixed compatibility with ZF2 ServiceManager by **[omnilight](https://github.com/omnilight)**.
32+
* **[Laravel5]** Fixed memory leak when using Laravel factories inside Codeception. See [#4971](https://github.com/Codeception/Codeception/issues/4971) by **[AdrianSkierniewski](https://github.com/AdrianSkierniewski)**
33+
* **[Db]** Added support for `null` values in MSSQL driver by **[philek](https://github.com/philek)**
34+
* Handle absolute paths in ParamsLoader by **[SilverFire](https://github.com/SilverFire)**
35+
* Fix error on single file test. See [#4986](https://github.com/Codeception/Codeception/issues/4986) by **[mikbox74](https://github.com/mikbox74)**
36+
* Upgraded to Codeception/Stub 2.0 by **[Naktibalda](https://github.com/Naktibalda)**, fixed compatibility.
37+
38+
1039
#### 2.4.1
1140

1241
* Fixed "Uncaught Error: Call to undefined method Codeception\Test\Descriptor::getTestDataSetIndex()" error when filtering tests.
@@ -20,7 +49,8 @@ title: Codeception Changelog
2049
* More reliable application state before and during test execution
2150
* Fixtures method is now configurable
2251
* Subset of misconfigurations are now detected and informative messages created
23-
* Fixed using `$settings['path']` in `Codeception\Configuration::suiteSettings()` on Windows by **[olegpro](https://github.com/olegpro)**
52+
* Fixed using `$settings['path']` in `Codeception\Configuration::suiteSettings()` on Windows by **[olegpro](https://github.com/olegpro)**
53+
(starting with `/`), you must change it. **[silverfire](https://github.com/silverfire)**
2454
* **[Laravel5]** Added Laravel 5.4+ (5.1+ backward compatible) support for `callArtisan` method in Laravel5 module. See [#4860](https://github.com/Codeception/Codeception/issues/4860) by **[mohamed-aiman](https://github.com/mohamed-aiman)**
2555
* Fixed [#4854](https://github.com/Codeception/Codeception/issues/4854): unnecessary escaping in operation arguments logging by **[nicholascus](https://github.com/nicholascus)**
2656
* Fixed humanizing steps for utf8 strings by **[nicholascus](https://github.com/nicholascus)**. See [#4850](https://github.com/Codeception/Codeception/issues/4850)

docs/08-Customization.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -110,29 +110,29 @@ All listed events are available as constants in `Codeception\Events` class.
110110

111111
| Event | When? | Triggered by
112112
|:--------------------:| --------------------------------------- | --------------------------:
113-
| `suite.before` | Before suite is executed | [Suite, Settings](https://github.com/Codeception/Codeception/blob/master/src/Codeception/Event/SuiteEvent.php)
114-
| `test.start` | Before test is executed | [Test](https://github.com/Codeception/Codeception/blob/master/src/Codeception/Event/TestEvent.php)
115-
| `test.before` | At the very beginning of test execution | [Codeception Test](https://github.com/Codeception/Codeception/blob/master/src/Codeception/Event/TestEvent.php)
116-
| `step.before` | Before step | [Step](https://github.com/Codeception/Codeception/blob/master/src/Codeception/Event/StepEvent.php)
117-
| `step.after` | After step | [Step](https://github.com/Codeception/Codeception/blob/master/src/Codeception/Event/StepEvent.php)
118-
| `step.fail` | After failed step | [Step](https://github.com/Codeception/Codeception/blob/master/src/Codeception/Event/StepEvent.php)
119-
| `test.fail` | After failed test | [Test, Fail](https://github.com/Codeception/Codeception/blob/master/src/Codeception/Event/FailEvent.php)
120-
| `test.error` | After test ended with error | [Test, Fail](https://github.com/Codeception/Codeception/blob/master/src/Codeception/Event/FailEvent.php)
121-
| `test.incomplete` | After executing incomplete test | [Test, Fail](https://github.com/Codeception/Codeception/blob/master/src/Codeception/Event/FailEvent.php)
122-
| `test.skipped` | After executing skipped test | [Test, Fail](https://github.com/Codeception/Codeception/blob/master/src/Codeception/Event/FailEvent.php)
123-
| `test.success` | After executing successful test | [Test](https://github.com/Codeception/Codeception/blob/master/src/Codeception/Event/TestEvent.php)
124-
| `test.after` | At the end of test execution | [Codeception Test](https://github.com/Codeception/Codeception/blob/master/src/Codeception/Event/TestEvent.php)
125-
| `test.end` | After test execution | [Test](https://github.com/Codeception/Codeception/blob/master/src/Codeception/Event/TestEvent.php)
126-
| `suite.after` | After suite was executed | [Suite, Result, Settings](https://github.com/Codeception/Codeception/blob/master/src/Codeception/Event/SuiteEvent.php)
127-
| `test.fail.print` | When test fails are printed | [Test, Fail](https://github.com/Codeception/Codeception/blob/master/src/Codeception/Event/FailEvent.php)
128-
| `result.print.after` | After result was printed | [Result, Printer](https://github.com/Codeception/Codeception/blob/master/src/Codeception/Event/PrintResultEvent.php)
113+
| `suite.before` | Before suite is executed | [Suite, Settings](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Event/SuiteEvent.php)
114+
| `test.start` | Before test is executed | [Test](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Event/TestEvent.php)
115+
| `test.before` | At the very beginning of test execution | [Codeception Test](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Event/TestEvent.php)
116+
| `step.before` | Before step | [Step](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Event/StepEvent.php)
117+
| `step.after` | After step | [Step](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Event/StepEvent.php)
118+
| `step.fail` | After failed step | [Step](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Event/StepEvent.php)
119+
| `test.fail` | After failed test | [Test, Fail](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Event/FailEvent.php)
120+
| `test.error` | After test ended with error | [Test, Fail](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Event/FailEvent.php)
121+
| `test.incomplete` | After executing incomplete test | [Test, Fail](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Event/FailEvent.php)
122+
| `test.skipped` | After executing skipped test | [Test, Fail](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Event/FailEvent.php)
123+
| `test.success` | After executing successful test | [Test](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Event/TestEvent.php)
124+
| `test.after` | At the end of test execution | [Codeception Test](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Event/TestEvent.php)
125+
| `test.end` | After test execution | [Test](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Event/TestEvent.php)
126+
| `suite.after` | After suite was executed | [Suite, Result, Settings](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Event/SuiteEvent.php)
127+
| `test.fail.print` | When test fails are printed | [Test, Fail](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Event/FailEvent.php)
128+
| `result.print.after` | After result was printed | [Result, Printer](https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Event/PrintResultEvent.php)
129129

130130
There may be some confusion between `test.start`/`test.before` and `test.after`/`test.end`.
131131
The start and end events are triggered by PHPUnit, but the before and after events are triggered by Codeception.
132132
Thus, when you are using classical PHPUnit tests (extended from `PHPUnit\Framework\TestCase`),
133133
the before/after events won't be triggered for them. During the `test.before` event you can mark a test
134134
as skipped or incomplete, which is not possible in `test.start`. You can learn more from
135-
[Codeception internal event listeners](https://github.com/Codeception/Codeception/tree/master/src/Codeception/Subscriber).
135+
[Codeception internal event listeners](https://github.com/Codeception/Codeception/tree/2.4/src/Codeception/Subscriber).
136136

137137
The extension class itself is inherited from `Codeception\Extension`:
138138

docs/12-ParallelExecution.md

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Run official Codeception image from DockerHub:
3333
docker run codeception/codeception
3434

3535
Running tests from a project, by mounting the current path as a host-volume into the container.
36-
The default working directory in the container is `/project`.
36+
The **default working directory in the container is `/project`**.
3737

3838
docker run -v ${PWD}:/project codeception/codeception run
3939

@@ -45,17 +45,15 @@ We prepared a sample config with codeception, web server, database, and selenium
4545

4646
{% highlight yaml %}
4747

48-
version: '2'
48+
version: '3'
4949
services:
5050
codecept:
5151
image: codeception/codeception
5252
depends_on:
53-
- firefox
53+
- chrome
5454
- web
5555
volumes:
56-
- ./src:/src
57-
- ./tests:/tests
58-
- ./codeception.yml:/codeception.yml
56+
- .:/project
5957
web:
6058
image: php:7-apache
6159
depends_on:
@@ -64,13 +62,8 @@ services:
6462
- .:/var/www/html
6563
db:
6664
image: percona:5.6
67-
ports:
68-
- '3306'
69-
firefox:
70-
image: selenium/standalone-firefox-debug:2.53.0
71-
ports:
72-
- '4444'
73-
- '5900'
65+
chrome:
66+
image: selenium/standalone-chrome
7467

7568
{% endhighlight %}
7669

docs/modules/AngularJS.md

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,15 @@ Print out latest Selenium Logs in debug mode
519519
* `param TestInterface` $test
520520

521521

522+
#### deleteSessionSnapshot
523+
524+
Deletes session snapshot.
525+
526+
See [saveSessionSnapshot](#saveSessionSnapshot)
527+
528+
* `param` $name
529+
530+
522531
#### dontSee
523532

524533
Checks that the current page doesn't contain the text specified (case insensitive).
@@ -1031,8 +1040,12 @@ $name = $I->grabValueFrom(['name' => 'username']);
10311040

10321041
#### loadSessionSnapshot
10331042

1034-
* `param string` $name
1035-
* `return` bool
1043+
Loads cookies from a saved snapshot.
1044+
Allows to reuse same session across tests without additional login.
1045+
1046+
See [saveSessionSnapshot](#saveSessionSnapshot)
1047+
1048+
* `param` $name
10361049

10371050

10381051
#### makeScreenshot
@@ -1228,7 +1241,35 @@ $I->resizeWindow(800, 600);
12281241

12291242
#### saveSessionSnapshot
12301243

1231-
* `param string` $name
1244+
Saves current cookies into named snapshot in order to restore them in other tests
1245+
This is useful to save session state between tests.
1246+
For example, if user needs log in to site for each test this scenario can be executed once
1247+
while other tests can just restore saved cookies.
1248+
1249+
{% highlight php %}
1250+
1251+
<?php
1252+
// inside AcceptanceTester class:
1253+
1254+
public function login()
1255+
{
1256+
// if snapshot exists - skipping login
1257+
if ($I->loadSessionSnapshot('login')) return;
1258+
1259+
// logging in
1260+
$I->amOnPage('/login');
1261+
$I->fillField('name', 'jon');
1262+
$I->fillField('password', '123345');
1263+
$I->click('Login');
1264+
1265+
// saving snapshot
1266+
$I->saveSessionSnapshot('login');
1267+
}
1268+
?>
1269+
1270+
{% endhighlight %}
1271+
1272+
* `param` $name
12321273

12331274

12341275
#### scrollTo

docs/modules/Db.md

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -249,31 +249,21 @@ $mails = $I->grabColumnFromDatabase('users', 'email', array('name' => 'RebOOter'
249249

250250
#### grabFromDatabase
251251

252-
Fetches a single column value from a database.
252+
Fetches all values from the column in database.
253253
Provide table name, desired column and criteria.
254254

255255
{% highlight php %}
256256

257257
<?php
258-
$mail = $I->grabFromDatabase('users', 'email', array('name' => 'Davert'));
259-
260-
{% endhighlight %}
261-
Comparison expressions can be used as well:
262-
263-
{% highlight php %}
264-
265-
<?php
266-
$post = $I->grabFromDatabase('posts', ['num_comments >=' => 100]);
267-
$user = $I->grabFromDatabase('users', ['email like' => 'miles%']);
258+
$mails = $I->grabFromDatabase('users', 'email', array('name' => 'RebOOter'));
268259

269260
{% endhighlight %}
270261

271-
Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`.
272-
273262
* `param string` $table
274263
* `param string` $column
275-
* `param array` $criteria
264+
* `param array` $criteria
276265

266+
* `return` array
277267

278268

279269
#### grabNumRecords

docs/modules/Symfony.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ This module uses Symfony Crawler and HttpKernel to emulate requests and test res
2222

2323
* app_path: 'src' - in Symfony 4 Kernel is located inside `src`
2424
* environment: 'local' - environment used for load kernel
25+
* kernel_class: 'App\Kernel' - kernel class name
2526
* em_service: 'doctrine.orm.entity_manager' - use the stated EntityManager to pair with Doctrine Module.
2627
* debug: true - turn on/off debug mode
2728
* cache_router: 'false' - enable router caching between tests in order to [increase performance](http://lakion.com/blog/how-did-we-speed-up-sylius-behat-suite-with-blackfire)
@@ -41,6 +42,7 @@ This module uses Symfony Crawler and HttpKernel to emulate requests and test res
4142
* app_path: 'app' - specify custom path to your app dir, where the kernel interface is located.
4243
* var_path: 'var' - specify custom path to your var dir, where bootstrap cache is located.
4344
* environment: 'local' - environment used for load kernel
45+
* kernel_class: 'AppKernel' - kernel class name
4446
* em_service: 'doctrine.orm.entity_manager' - use the stated EntityManager to pair with Doctrine Module.
4547
* debug: true - turn on/off debug mode
4648
* cache_router: 'false' - enable router caching between tests in order to [increase performance](http://lakion.com/blog/how-did-we-speed-up-sylius-behat-suite-with-blackfire)
@@ -60,6 +62,7 @@ This module uses Symfony Crawler and HttpKernel to emulate requests and test res
6062

6163
* app_path: 'app' - specify custom path to your app dir, where bootstrap cache and kernel interface is located.
6264
* environment: 'local' - environment used for load kernel
65+
* kernel_class: 'AppKernel' - kernel class name
6366
* debug: true - turn on/off debug mode
6467
* em_service: 'doctrine.orm.entity_manager' - use the stated EntityManager to pair with Doctrine Module.
6568
* cache_router: 'false' - enable router caching between tests in order to [increase performance](http://lakion.com/blog/how-did-we-speed-up-sylius-behat-suite-with-blackfire)

docs/modules/WebDriver.md

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,15 @@ Print out latest Selenium Logs in debug mode
719719
* `param TestInterface` $test
720720

721721

722+
#### deleteSessionSnapshot
723+
724+
Deletes session snapshot.
725+
726+
See [saveSessionSnapshot](#saveSessionSnapshot)
727+
728+
* `param` $name
729+
730+
722731
#### dontSee
723732

724733
Checks that the current page doesn't contain the text specified (case insensitive).
@@ -1231,8 +1240,12 @@ $name = $I->grabValueFrom(['name' => 'username']);
12311240

12321241
#### loadSessionSnapshot
12331242

1234-
* `param string` $name
1235-
* `return` bool
1243+
Loads cookies from a saved snapshot.
1244+
Allows to reuse same session across tests without additional login.
1245+
1246+
See [saveSessionSnapshot](#saveSessionSnapshot)
1247+
1248+
* `param` $name
12361249

12371250

12381251
#### makeScreenshot
@@ -1428,7 +1441,35 @@ $I->resizeWindow(800, 600);
14281441

14291442
#### saveSessionSnapshot
14301443

1431-
* `param string` $name
1444+
Saves current cookies into named snapshot in order to restore them in other tests
1445+
This is useful to save session state between tests.
1446+
For example, if user needs log in to site for each test this scenario can be executed once
1447+
while other tests can just restore saved cookies.
1448+
1449+
{% highlight php %}
1450+
1451+
<?php
1452+
// inside AcceptanceTester class:
1453+
1454+
public function login()
1455+
{
1456+
// if snapshot exists - skipping login
1457+
if ($I->loadSessionSnapshot('login')) return;
1458+
1459+
// logging in
1460+
$I->amOnPage('/login');
1461+
$I->fillField('name', 'jon');
1462+
$I->fillField('password', '123345');
1463+
$I->click('Login');
1464+
1465+
// saving snapshot
1466+
$I->saveSessionSnapshot('login');
1467+
}
1468+
?>
1469+
1470+
{% endhighlight %}
1471+
1472+
* `param` $name
14321473

14331474

14341475
#### scrollTo

docs/modules/Yii2.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ It initializes Yii framework in test environment and provides actions for functi
1515
### Application state during testing
1616
This section details what you can expect when using this module.
1717
* You will get a fresh application in `\Yii::$app` at the start of each test (available in the test and in `_before()`).
18+
* Inside your test you may change application state; however these changes will be lost when doing a request if you have enabled `recreateApplication`.
1819
* When executing a request via one of the request functions the `request` and `response` component are both recreated.
1920
* After a request the whole application is available for inspection / interaction.
2021
* You may use multiple database connections, each will use a separate transaction; to prevent accidental mistakes we
@@ -29,16 +30,23 @@ will warn you if you try to connect to the same database twice but we cannot reu
2930
* `cleanup` - (default: true) cleanup fixtures after the test
3031
* `ignoreCollidingDSN` - (default: false) When 2 database connections use the same DSN but different settings an exception will be thrown, set this to true to disable this behavior.
3132
* `fixturesMethod` - (default: _fixtures) Name of the method used for creating fixtures.
32-
33+
* `responseCleanMethod` - (default: clear) Method for cleaning the response object. Note that this is only for multiple requests inside a single test case.
34+
Between test casesthe whole application is always recreated
35+
* `requestCleanMethod` - (default: recreate) Method for cleaning the request object. Note that this is only for multiple requests inside a single test case.
36+
Between test cases the whole application is always recreated
37+
* `recreateComponents` - (default: []) Some components change their state making them unsuitable for processing multiple requests. In production this is usually
38+
not a problem since web apps tend to die and start over after each request. This allows you to list application components that need to be recreated before each request.
39+
As a consequence, any components specified here should not be changed inside a test since those changes will get regarded.
40+
You can use this module by setting params in your functional.suite.yml:
41+
* `recreateApplication` - (default: false) whether to recreate the whole application before each request
3342
You can use this module by setting params in your functional.suite.yml:
34-
3543
{% highlight yaml %}
3644

3745
actor: FunctionalTester
3846
modules:
3947
enabled:
4048
- Yii2:
41-
configFile: '/path/to/config.php'
49+
configFile: 'path/to/config.php'
4250

4351
{% endhighlight %}
4452

@@ -397,6 +405,10 @@ $I->click(['link' => 'Login']);
397405
* `param` $context
398406

399407

408+
#### connectionOpenHandler
409+
__not documented__
410+
411+
400412
#### createAndSetCsrfCookie
401413

402414
This function creates the CSRF Cookie.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy