Skip to content

Commit dc5c845

Browse files
committed
auto updated documentation
1 parent 62a67b9 commit dc5c845

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+465
-215
lines changed

_includes/extensions.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## DotReporter
44

5-
[See Source](https://github.com/Codeception/Codeception/blob/2.4/ext/DotReporter.php)
5+
[See Source](https://github.com/Codeception/Codeception/blob/2.5/ext/DotReporter.php)
66

77
DotReporter provides less verbose output for test execution.
88
Like PHPUnit printer it prints dots "." for successful testes and "F" for failures.
@@ -38,7 +38,7 @@ Use this extension as an example for building custom reporters.
3838

3939
## Logger
4040

41-
[See Source](https://github.com/Codeception/Codeception/blob/2.4/ext/Logger.php)
41+
[See Source](https://github.com/Codeception/Codeception/blob/2.5/ext/Logger.php)
4242

4343
Log suites/tests/steps using Monolog library.
4444
Monolog should be installed additionally by Composer.
@@ -65,7 +65,7 @@ extensions:
6565

6666
## Recorder
6767

68-
[See Source](https://github.com/Codeception/Codeception/blob/2.4/ext/Recorder.php)
68+
[See Source](https://github.com/Codeception/Codeception/blob/2.5/ext/Recorder.php)
6969

7070
Saves a screenshot of each step in acceptance tests and shows them as a slideshow on one HTML page (here's an [example](http://codeception.com/images/recorder.gif))
7171
Activated only for suites with WebDriver module enabled.
@@ -105,7 +105,7 @@ extensions:
105105

106106
## RunBefore
107107

108-
[See Source](https://github.com/Codeception/Codeception/blob/2.4/ext/RunBefore.php)
108+
[See Source](https://github.com/Codeception/Codeception/blob/2.5/ext/RunBefore.php)
109109

110110
Extension for execution of some processes before running tests.
111111

@@ -136,7 +136,7 @@ HINT: you can use different configurations per environment.
136136

137137
## RunFailed
138138

139-
[See Source](https://github.com/Codeception/Codeception/blob/2.4/ext/RunFailed.php)
139+
[See Source](https://github.com/Codeception/Codeception/blob/2.5/ext/RunFailed.php)
140140

141141
Saves failed tests into tests/log/failed in order to rerun failed tests.
142142

@@ -165,7 +165,7 @@ On each execution failed tests are logged and saved into `tests/_output/failed`
165165

166166
## RunProcess
167167

168-
[See Source](https://github.com/Codeception/Codeception/blob/2.4/ext/RunProcess.php)
168+
[See Source](https://github.com/Codeception/Codeception/blob/2.5/ext/RunProcess.php)
169169

170170
Extension to start and stop processes per suite.
171171
Can be used to start/stop selenium server, chromedriver, phantomjs, mailcatcher, etc.
@@ -212,7 +212,7 @@ HINT: you can use different configurations per environment.
212212

213213
## SimpleReporter
214214

215-
[See Source](https://github.com/Codeception/Codeception/blob/2.4/ext/SimpleReporter.php)
215+
[See Source](https://github.com/Codeception/Codeception/blob/2.5/ext/SimpleReporter.php)
216216

217217
This extension demonstrates how you can implement console output of your own.
218218
Recommended to be used for development purposes only.

changelog.markdown

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,27 @@ title: Codeception Changelog
77

88
# Changelog
99

10+
#### 2.5.0
11+
12+
* [**Snapshot testing**](https://codeception.com/docs/09-Data#Testing-Dynamic-Data-with-Snapshots) introduced. Test dynamic data sets by comparing current values with previously saved ones.
13+
* **[Db]** **Multi database support**. See [#4857](https://github.com/Codeception/Codeception/issues/4857) by **[eXorus](https://github.com/eXorus)**
14+
* `amConnectedToDatabase` method added.
15+
* `performInDatabase` method added.
16+
* Rerun tests in **[shuffle mode](https://codeception.com/docs/07-AdvancedUsage#Shuffle)** in the same order by setting seed value. By **[SamMousa](https://github.com/SamMousa)**
17+
* **[WebDriver]** Keep coverage cookies in `loadSessionSnapshot`. Fix by **[rajras](https://github.com/rajras)**
18+
* **[Yii2]** Prevent null pointer exception by **[SilverFire](https://github.com/SilverFire)**. See [#5136](https://github.com/Codeception/Codeception/issues/5136)
19+
* **[Yii2]** Fixed issue with empty response stream by **[SamMousa](https://github.com/SamMousa)**.
20+
* **[Yii2]** Fixed `Too many connections` issue [#4926](https://github.com/Codeception/Codeception/issues/4926). By **[roslov](https://github.com/roslov)**
21+
* **[Yii2]** Fixed [#4769](https://github.com/Codeception/Codeception/issues/4769): `amLoggedInAs()` throws TypeError. By **[SamMousa](https://github.com/SamMousa)**
22+
* [Recorder Extension] Fixing recorder extension issues caused by phpunit 7.2.7 update by **[OneEyedSpaceFish](https://github.com/OneEyedSpaceFish)**
23+
* [Logger Extension] Added `codecept_log` function to write to logs from any place. Fixes [#3551](https://github.com/Codeception/Codeception/issues/3551) by **[siad007](https://github.com/siad007)**
24+
* **[WebDriver]** Report correct strict locator in error message. When `see()` and `dontSee()` are used with array selector. Fix by **[Naktibalda](https://github.com/Naktibalda)**.
25+
* **[Phalcon]** Use bind for find record. See [#5158](https://github.com/Codeception/Codeception/issues/5158) by **[Joilson](https://github.com/Joilson)**
26+
* **[Phalcon]** Add support for nullable fields in `findRecord()` by **[arjanwestdorp](https://github.com/arjanwestdorp)**
27+
* Added `memory_limit` to `dry-run` command by **[siad007](https://github.com/siad007)**. Fixes [#5090](https://github.com/Codeception/Codeception/issues/5090)
28+
* Added ext-curl to the composer require section by **[siad007](https://github.com/siad007)**
29+
* Make `coverage: show_only_summary` configurable. See [#5142](https://github.com/Codeception/Codeception/issues/5142) by **[Quexer69](https://github.com/Quexer69)**
30+
* Ensure php extension `mbstring` is available by **[siad007](https://github.com/siad007)**. Fixes [#4575](https://github.com/Codeception/Codeception/issues/4575)
1031
#### 2.4.5
1132

1233
* Fixed PHPUnit 7.2 compatibility.

docs/07-AdvancedUsage.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,47 @@ Signature: ModeratorCest:login`
588588
589589
Codeception reorders tests so dependent tests will always be executed before the tests that rely on them.
590590
591+
### Shuffle
592+
593+
By default Codeception runs tests in alphabetic order.
594+
To ensure that tests are not depending on each other (unless explicitly declared via `@depends`) you can enable `shuffle` option.
595+
596+
{% highlight yaml %}
597+
598+
# inside codeception.yml
599+
settings:
600+
shuffle: true
601+
602+
{% endhighlight %}
603+
604+
Alternatively, you may run tests in shuffle without changing the config:
605+
606+
{% highlight yaml %}
607+
codecept run -o "settings: shuffle: true"
608+
609+
{% endhighlight %}
610+
611+
612+
Tests will be randomly reordered on each run. When tests executed in shuffle mode a seed value will be printed.
613+
Copy this seed value from output to be able to rerun tests in the same order.
614+
615+
{% highlight yaml %}
616+
$ codecept run
617+
Codeception PHP Testing Framework v2.4.5
618+
Powered by PHPUnit 5.7.27 by Sebastian Bergmann and contributors.
619+
[Seed] 1872290562
620+
621+
{% endhighlight %}
622+
623+
Pass the copied seed into `--seed` option:
624+
625+
{% highlight yaml %}
626+
codecept run --seed 1872290562
627+
628+
{% endhighlight %}
629+
630+
631+
591632
## Interactive Console
592633
593634
The interactive console was added to try Codeception commands before executing them inside a test.

docs/09-Data.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,71 @@ modules:
305305
DataFactory provides a powerful solution for managing data in integration/functional/acceptance tests.
306306
Read the [full reference](http://codeception.com/docs/modules/DataFactory) to learn how to set this module up.
307307

308+
## Testing Dynamic Data with Snapshots
309+
310+
What if you deal with data which you don't own? For instance, the page look depends on number of categories in database,
311+
and categories are set by admin user. How would you test that the page is still valid?
312+
313+
There is a way to get it tested as well. Codeception allows you take a snapshot of a data on first run and compare with on next executions.
314+
This principle is so general that it can work for testing APIs, items on a web page, etc.
315+
316+
Let's check that list of categories on a page is the same it was before.
317+
Create a snapshot class:
318+
319+
{% highlight php %}
320+
vendor/bin/codecept g:snapshot Categories
321+
322+
{% endhighlight %}
323+
324+
Inject an actor class via constructor and implement `fetchData` method which should return a data set from a test.
325+
326+
{% highlight php %}
327+
328+
<?php
329+
namespace Snapshot;
330+
331+
class Categories extends \Codeception\Snapshot
332+
{
333+
/** @var \AcceptanceTester */
334+
protected $i;
335+
336+
public function __construct(\AcceptanceTester $I)
337+
{
338+
$this->i = $I;
339+
}
340+
341+
protected function fetchData()
342+
{
343+
// fetch texts from all 'a.category' elements on a page
344+
return $this->i->grabMultiple('a.category');
345+
}
346+
}
347+
348+
{% endhighlight %}
349+
350+
Inside a test you can inject the snapshot class and call `assert` method on it:
351+
352+
{% highlight php %}
353+
354+
<?php
355+
public function testCategoriesAreTheSame(\AcceptanceTester $I, \Snapshot\Categories $snapshot)
356+
{
357+
$I->amOnPage('/categories');
358+
// if previously saved array of users does not match current set, test will fail
359+
// to update data in snapshot run test with --debug flag
360+
$snapshot->assert();
361+
}
362+
363+
{% endhighlight %}
364+
365+
On the first run, data will be obtained via `fetchData` method and saved to `tests/_data` directory in json format.
366+
On next execution the obtained data will be compared with previously saved snapshot.
367+
368+
**To update a snapshot with a new data run tests in `--debug` mode.**
369+
370+
By default Snapshot uses `assertEquals` assertion, however this can be customized by overriding `assertData` method.
371+
372+
308373
## Conclusion
309374

310375
Codeception also assists the developer when dealing with data. Tools for database population

docs/11-Codecoverage.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,28 @@ coverage:
5858

5959
{% endhighlight %}
6060

61+
By default, show all whitelisted files in `--coverage-text` output not just the ones with coverage information is set to false, config option:
62+
63+
{% highlight yaml %}
64+
65+
coverage:
66+
enabled: true
67+
show_uncovered: false
68+
69+
{% endhighlight %}
70+
71+
By default, show only the coverage report summary in `--coverage-text` output is set to false, config option:
72+
73+
{% highlight yaml %}
74+
75+
coverage:
76+
enabled: true
77+
show_only_summary: false
78+
79+
{% endhighlight %}
80+
81+
For further information please refer to the [PHPUnit configuration docs](https://phpunit.readthedocs.io/en/latest/configuration.html)
82+
6183
## Local CodeCoverage
6284

6385
The basic codecoverage can be collected for functional and unit tests.

docs/12-ParallelExecution.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,8 @@ public function parallelRun()
323323
for ($i = 1; $i <= 5; $i++) {
324324
$parallel->process(
325325
$this->taskExec('docker-compose run --rm codecept run')
326-
->opt('group', "paracept_$i") // run for groups paracept_*
327-
->opt('xml', "tests/_log/result_$i.xml"); // provide xml report
326+
->option('group', "paracept_$i") // run for groups paracept_*
327+
->option('xml', "tests/_log/result_$i.xml") // provide xml report
328328
);
329329
}
330330
return $parallel->run();

docs/modules/AMQP.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: AMQP - Codeception - Documentation
55

66

77

8-
<div class="btn-group" role="group" style="float: right" aria-label="..."><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Module/AMQP.php">source</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/master/docs/modules/AMQP.md">master</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.3/docs/modules/AMQP.md">2.3</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.2/docs/modules/AMQP.md">2.2</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.1/docs/modules/AMQP.md">2.1</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.0/docs/modules/AMQP.md">2.0</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/1.8/docs/modules/AMQP.md">1.8</a></div>
8+
<div class="btn-group" role="group" style="float: right" aria-label="..."><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.5/src/Codeception/Module/AMQP.php">source</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/master/docs/modules/AMQP.md">master</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.3/docs/modules/AMQP.md">2.3</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.2/docs/modules/AMQP.md">2.2</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.1/docs/modules/AMQP.md">2.1</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.0/docs/modules/AMQP.md">2.0</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/1.8/docs/modules/AMQP.md">1.8</a></div>
99

1010
# AMQP
1111

@@ -226,4 +226,4 @@ $I->seeMessageInQueueContainsText('queue.emails','davert');
226226
* `param string` $queue
227227
* `param string` $text
228228

229-
<p>&nbsp;</p><div class="alert alert-warning">Module reference is taken from the source code. <a href="https://github.com/Codeception/Codeception/tree/2.4/src/Codeception/Module/AMQP.php">Help us to improve documentation. Edit module reference</a></div>
229+
<p>&nbsp;</p><div class="alert alert-warning">Module reference is taken from the source code. <a href="https://github.com/Codeception/Codeception/tree/2.5/src/Codeception/Module/AMQP.php">Help us to improve documentation. Edit module reference</a></div>

docs/modules/AngularJS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: AngularJS - Codeception - Documentation
55

66

77

8-
<div class="btn-group" role="group" style="float: right" aria-label="..."><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Module/AngularJS.php">source</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/master/docs/modules/AngularJS.md">master</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.3/docs/modules/AngularJS.md">2.3</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.2/docs/modules/AngularJS.md">2.2</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.1/docs/modules/AngularJS.md">2.1</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.0/docs/modules/AngularJS.md">2.0</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/1.8/docs/modules/AngularJS.md">1.8</a></div>
8+
<div class="btn-group" role="group" style="float: right" aria-label="..."><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.5/src/Codeception/Module/AngularJS.php">source</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/master/docs/modules/AngularJS.md">master</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.3/docs/modules/AngularJS.md">2.3</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.2/docs/modules/AngularJS.md">2.2</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.1/docs/modules/AngularJS.md">2.1</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.0/docs/modules/AngularJS.md">2.0</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/1.8/docs/modules/AngularJS.md">1.8</a></div>
99

1010
# AngularJS
1111

@@ -2160,4 +2160,4 @@ $I->waitForText('foo', 30, '.title'); // secs
21602160
* `param string` $selector optional
21612161
@throws \Exception
21622162
2163-
<p>&nbsp;</p><div class="alert alert-warning">Module reference is taken from the source code. <a href="https://github.com/Codeception/Codeception/tree/2.4/src/Codeception/Module/AngularJS.php">Help us to improve documentation. Edit module reference</a></div>
2163+
<p>&nbsp;</p><div class="alert alert-warning">Module reference is taken from the source code. <a href="https://github.com/Codeception/Codeception/tree/2.5/src/Codeception/Module/AngularJS.php">Help us to improve documentation. Edit module reference</a></div>

docs/modules/Apc.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: Apc - Codeception - Documentation
55

66

77

8-
<div class="btn-group" role="group" style="float: right" aria-label="..."><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.4/src/Codeception/Module/Apc.php">source</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/master/docs/modules/Apc.md">master</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.3/docs/modules/Apc.md">2.3</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.2/docs/modules/Apc.md">2.2</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.1/docs/modules/Apc.md">2.1</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.0/docs/modules/Apc.md">2.0</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/1.8/docs/modules/Apc.md">1.8</a></div>
8+
<div class="btn-group" role="group" style="float: right" aria-label="..."><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.5/src/Codeception/Module/Apc.php">source</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/master/docs/modules/Apc.md">master</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.3/docs/modules/Apc.md">2.3</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.2/docs/modules/Apc.md">2.2</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.1/docs/modules/Apc.md">2.1</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/2.0/docs/modules/Apc.md">2.0</a><a class="btn btn-default" href="https://github.com/Codeception/Codeception/blob/1.8/docs/modules/Apc.md">1.8</a></div>
99

1010
# Apc
1111

@@ -131,4 +131,4 @@ $I->seeInApc('users_count', 200);
131131
* `param string|string[]` $key
132132
* `param mixed` $value
133133

134-
<p>&nbsp;</p><div class="alert alert-warning">Module reference is taken from the source code. <a href="https://github.com/Codeception/Codeception/tree/2.4/src/Codeception/Module/Apc.php">Help us to improve documentation. Edit module reference</a></div>
134+
<p>&nbsp;</p><div class="alert alert-warning">Module reference is taken from the source code. <a href="https://github.com/Codeception/Codeception/tree/2.5/src/Codeception/Module/Apc.php">Help us to improve documentation. Edit module reference</a></div>

0 commit comments

Comments
 (0)