Skip to content

Commit d09bdfa

Browse files
committed
auto updated documentation
1 parent 8e49102 commit d09bdfa

File tree

15 files changed

+250
-62
lines changed

15 files changed

+250
-62
lines changed

changelog.markdown

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

88
# Changelog
99

10+
#### 2.3.7
11+
12+
* **Symfony 4 support** implemented by **[VolCh](https://github.com/VolCh)**.
13+
* Dependencies updated to support Symfony 4.x components.
14+
* **[Symfony]** Support for Symfony Flex directory and namespace structure
15+
* [Demo application](https://github.com/Codeception/symfony-demo) was updated to Symfony 4.0
16+
* **[Db]** `seeInDatabse`, `dontSeeInDatabase`, `grabFromDatabase` and other methods to support SQL comparison operators: `<`, `>`, `>=`, `<=`, `!=`, `like`. Thanks **[susgo](https://github.com/susgo)** and **[Naktibalda](https://github.com/Naktibalda)**.
17+
* **[Db]** Fixed quoting around schema identifiers in MSSQL by **[Naktibalda](https://github.com/Naktibalda)**. See [#4542](https://github.com/Codeception/Codeception/issues/4542).
18+
* **[Db]** Added SSL options for connection. Thanks **[kossi84](https://github.com/kossi84)**
19+
* **[Db]** Fix getting Database name from DSN in MSSQL by **[yesdevnull](https://github.com/yesdevnull)**.
20+
* **[PhpBrowser]** Fixed setting `User-Agent` in config via `headers`. Fixed [#4576](https://github.com/Codeception/Codeception/issues/4576) by **[Naktibalda](https://github.com/Naktibalda)**.
21+
* **[WebDriver]** Implemented `dontSeeInPopup` by **[kpascal](https://github.com/kpascal)**.
22+
* **[WebDriver]** Allow to click a button located by its `title` attribute. See [#4586](https://github.com/Codeception/Codeception/issues/4586) by **[gimler](https://github.com/gimler)**.
23+
* **[Silex]** `app` property added to public API. Thanks **[sky003](https://github.com/sky003)**
24+
* **[Yii2]** Pass DB to Yii application as early as possible to reuse old connection. By **[SilverFire](https://github.com/SilverFire)**. See [#4601](https://github.com/Codeception/Codeception/issues/4601)
25+
* **[Yii2]** Resetting global event handlers after a test. See [#4621](https://github.com/Codeception/Codeception/issues/4621) by **[SamMousa](https://github.com/SamMousa)**
26+
* **[Yii2]** Recreate request object to reset headers and cookies before each request. Fixes [#4587](https://github.com/Codeception/Codeception/issues/4587) by **[erickskrauch](https://github.com/erickskrauch)**
27+
* **[MongoDb]** Allowing `.tgz` files to be accepted for database dumps. [#4611](https://github.com/Codeception/Codeception/issues/4611) by **[Lukazar](https://github.com/Lukazar)**
28+
* [PhpBrowser][Frameworks] Fixed usage of `see` when source code contains `<=` JS operator. By **[tobias-kuendig](https://github.com/tobias-kuendig)** Fixes [#4509](https://github.com/Codeception/Codeception/issues/4509).
29+
* **[Queue]** Added configuration parameter `endpoint` for AmazonSQS by **[gitis](https://github.com/gitis)**.
30+
* Fixed signature error in `DummyCodeCoverage::stop` See [#4665](https://github.com/Codeception/Codeception/issues/4665) by **[network-spy](https://github.com/network-spy)**
31+
* Throw exception if `exit(0)` was accidentally called. Fixes false-positive test reports. See [#4604](https://github.com/Codeception/Codeception/issues/4604) by Fenikkusu.
32+
* Fixed using `path: tests: .` in configuration. Fixes [#4432](https://github.com/Codeception/Codeception/issues/4432) by **[marcovtwout](https://github.com/marcovtwout)**
33+
* Fixed suite name containing slash in remote code coverage. [#4612](https://github.com/Codeception/Codeception/issues/4612) by **[bscheshirwork](https://github.com/bscheshirwork)**
34+
* Improved generated actions file by removing redundant `use` section. [#4614](https://github.com/Codeception/Codeception/issues/4614) by **[bscheshirwork](https://github.com/bscheshirwork)**
35+
* Don't skip last test if some test has missing dependency by **[Naktibalda](https://github.com/Naktibalda)**. Fixes [#4598](https://github.com/Codeception/Codeception/issues/4598)
36+
* Improved PHP 7.2 compatibility by **[FanchTheSystem](https://github.com/FanchTheSystem)**. See [#4557](https://github.com/Codeception/Codeception/issues/4557)
37+
* Implemented `Descriptor::getTestSignatureUnique` to create unique names for tests. See [#4673](https://github.com/Codeception/Codeception/issues/4673) by **[Tenzian](https://github.com/Tenzian)**. Fixes [#4672](https://github.com/Codeception/Codeception/issues/4672)
38+
* Fixed `setExpectedException()` default value for PHPUnit 5.7.23 by **[MilesChou](https://github.com/MilesChou)**. See [#4566](https://github.com/Codeception/Codeception/issues/4566)
39+
* Fixed printing wrong failed step by **[eXorus](https://github.com/eXorus)**. See [#4654](https://github.com/Codeception/Codeception/issues/4654)
40+
* Fixed undefined `argv` warnings, added check for `register_argc_argv`. Fixes [#4595](https://github.com/Codeception/Codeception/issues/4595) by **[Naktibalda](https://github.com/Naktibalda)**
41+
* Added `init` command to `codecept.phar` by **[Naktibalda](https://github.com/Naktibalda)**.
42+
43+
And many thanks to our awesome contributors! **Thanks to **[VolCh](https://github.com/VolCh)** for upgrading to Symfony 4**, thanks **[Naktibalda](https://github.com/Naktibalda)** for edgecase patches and reviews and
44+
thanks to **[carusogabriel](https://github.com/carusogabriel)** for tests refactoring.
45+
1046
#### 2.3.6
1147

1248
* **Laravel 5.5 compatibility**. Laravel5 module documentation updated.

docs/03-AcceptanceTests.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ $I->performOn('.confirm', function(\Codeception\Module\WebDriver $I) {
560560

561561
{% endhighlight %}
562562

563-
For more options see [`performOn()` reference]([performOn](http://codeception.com/docs/modules/WebDriver#performOn) ).
563+
For more options see [`performOn()` reference](http://codeception.com/docs/modules/WebDriver#performOn).
564564

565565
### Multi Session Testing
566566

docs/05-UnitTests.md

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,27 @@ $container = $this->getModule('Symfony')->container;
284284

285285
The same can be done for all public properties of an enabled module. Accessible properties are listed in the module reference.
286286

287+
### Scenario Driven Testing
288+
289+
[Cest format](http://codeception.com/docs/07-AdvancedUsage#Cest-Classes) can also be used for integration testing.
290+
In some cases it makes tests cleaner as it simplifies module access by using common `$I->` syntax:
291+
292+
{% highlight php %}
293+
294+
<?php
295+
public function buildShouldHaveSequence(\UnitTester $I)
296+
{
297+
$build = $I->have(Build::class, ['project_id' => $this->project->id]);
298+
$I->assertEquals(1, $build->sequence);
299+
$build = $I->have(Build::class, ['project_id' => $this->project->id]);
300+
$I->assertEquals(2, $build->sequence);
301+
$this->project->refresh();
302+
$I->assertEquals(3, $this->project->build_sequence);
303+
}
304+
305+
{% endhighlight %}
306+
This format can be recommended for testing domain and database interactions.
307+
287308
## BDD Specification Testing
288309

289310
When writing tests you should prepare them for constant changes in your application.
@@ -304,6 +325,7 @@ class UserTest extends \Codeception\Test\Unit
304325
{
305326
use \Codeception\Specify;
306327
328+
/** @specify */
307329
private $user;
308330
309331
public function testValidation()
@@ -333,11 +355,7 @@ By using `specify` codeblocks, you can describe any piece of a test.
333355
This makes tests much cleaner and comprehensible for everyone in your team.
334356

335357
Code inside `specify` blocks is isolated. In the example above, any changes to `$this->user`
336-
(as with any other object property),
337-
will not be reflected in other code blocks. Specify uses deep and shallow cloning strategies to save objects
338-
between isolated scopes. The downsides of this approach is increased memory consumption (on deep cloning)
339-
or incomplete isolation when shallow cloning is used. Please make sure you understand
340-
how [Specify](https://github.com/Codeception/Specify) works and how to configure it before using it in your tests.
358+
will not be reflected in other code blocks as it is marked with `@specify` annotation.
341359

342360
Also, you may add [Codeception\Verify](https://github.com/Codeception/Verify) for BDD-style assertions.
343361
This tiny library adds more readable assertions, which is quite nice, if you are always confused
@@ -350,6 +368,34 @@ verify($user->getName())->equals('john');
350368

351369
{% endhighlight %}
352370

371+
## Domain Assertions
372+
373+
The more complicated your domain is the more explicit your tests should be. With [DomainAssert](https://github.com/Codeception/DomainAssert)
374+
library you can easily create custom assertion methods for unit and integration tests.
375+
376+
It allows to reuse business rules inside assertion methods:
377+
378+
{% highlight php %}
379+
380+
<?php
381+
$user = new User;
382+
383+
// simple custom assertions below:
384+
$this->assertUserIsValid($user);
385+
$this->assertUserIsAdmin($user);
386+
387+
// use combined explicit assertion
388+
// to tell what you expect to check
389+
$this->assertUserCanPostToBlog($user, $blog);
390+
// instead of just calling a bunch of assertions
391+
$this->assertNotNull($user);
392+
$this->assertNotNull($blog);
393+
$this->assertContain($user, $blog->getOwners());
394+
395+
{% endhighlight %}
396+
397+
With custom assertion methods you can improve readability of your tests and keep them focused around the specification.
398+
353399
## Stubs
354400

355401
Codeception provides a tiny wrapper over the PHPUnit mocking framework to create stubs easily.

docs/12-ContinuousIntegration.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ layout: doc
33
title: 12-ContinuousIntegration - Codeception - Documentation
44
---
55

6-
# Continous Integration
6+
# Continuous Integration
77

88
Once you get testing suite up and running you are interested in running your tests regularly. If you ensure that tests are running on every code change or at least once a day you can be sure that no regression is introduced. This allows to keep you system stable. But developers are not so passionate about running all tests manually, they also can forget to execute tests before pushing code to production... The solution is simple, test execution should be automated. Instead of running them locally it is better to have dedicated server responsible for running tests for a team. This way we can ensure that everyone's tests executed, which commit made a regression in codebase, and that we can deploy only once tests pass.
99

@@ -90,7 +90,7 @@ Jenkins should locate `report.html` at `tests/_output/`. Now Jenkins will displa
9090

9191
![TeamCity](http://codeception.com/images/teamcity/logo.jpg)
9292

93-
TeamCity is a hotsed solution from JetBrains. The setup of it can be a bit tricky as TeamCity uses its own reporter format for parsing test results. PHPUnit since verison 5.x has integrated support for this format, so does Codeception. What we need to do is to configure Codeception to use custom reporter. By default there is `--report` option which provides an alternative output. You can change the reporter class in `codeception.yml` configuration:
93+
TeamCity is a hosted solution from JetBrains. The setup of it can be a bit tricky as TeamCity uses its own reporter format for parsing test results. PHPUnit since version 5.x has integrated support for this format, so does Codeception. What we need to do is to configure Codeception to use custom reporter. By default there is `--report` option which provides an alternative output. You can change the reporter class in `codeception.yml` configuration:
9494

9595
{% highlight yaml %}
9696

@@ -118,7 +118,7 @@ Once you execute your first build you should see detailed report inside TeamCity
118118

119119
![Travis CI](http://codeception.com/images/travis.png)
120120

121-
Travis CI is popular service CI with good GitHub integration. Codeception is self-tested with Travis CI. There nothing specifal about configuration. Just add to the bottom line of travis configuration:
121+
Travis CI is popular service CI with good GitHub integration. Codeception is self-tested with Travis CI. There nothing special about configuration. Just add to the bottom line of travis configuration:
122122

123123
{% highlight yaml %}
124124

@@ -169,7 +169,7 @@ For acceptance testing you can use `codeception/codeception` docker image as bas
169169

170170
## Conclusion
171171

172-
It is tringly recommended to use Continuous Integration system in development. Codeception is easy to install and run in any CI systems. However, each of them has their differences you should take into account. You can use different repoters to provide output in format expected by CI system.
172+
It is highly recommended to use Continuous Integration system in development. Codeception is easy to install and run in any CI systems. However, each of them has their differences you should take into account. You can use different reporters to provide output in format expected by CI system.
173173

174174

175175

docs/modules/AngularJS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,16 @@ Checks that the page source doesn't contain the given string.
719719
* `param` $text
720720

721721

722+
#### dontSeeInPopup
723+
724+
Checks that the active JavaScript popup,
725+
as created by `window.alert`|`window.confirm`|`window.prompt`, does NOT contain the given string.
726+
727+
* `param` $text
728+
729+
@throws \Codeception\Exception\ModuleException
730+
731+
722732
#### dontSeeInSource
723733

724734
Checks that the current page contains the given string in its

docs/modules/Db.md

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ if you run into problems loading dumps and cleaning databases.
4444
* populate: false - whether the the dump should be loaded before the test suite is started
4545
* cleanup: false - whether the dump should be reloaded before each test
4646
* reconnect: false - whether the module should reconnect to the database before each test
47+
* ssl_key - path to the SSL key (MySQL specific, @see http://php.net/manual/de/ref.pdo-mysql.php#pdo.constants.mysql-attr-key)
48+
* ssl_cert - path to the SSL certificate (MySQL specific, @see http://php.net/manual/de/ref.pdo-mysql.php#pdo.constants.mysql-attr-ssl-cert)
49+
* ssl_ca - path to the SSL certificate authority (MySQL specific, @see http://php.net/manual/de/ref.pdo-mysql.php#pdo.constants.mysql-attr-ssl-ca)
4750

4851
### Example
4952

@@ -57,6 +60,9 @@ if you run into problems loading dumps and cleaning databases.
5760
populate: true
5861
cleanup: true
5962
reconnect: true
63+
 Â Â Â Â Â Â Â Â Â Â Â Â  ssl_key: '/path/to/client-key.pem'
64+
 Â Â Â Â Â Â Â Â Â Â Â Â  ssl_cert: '/path/to/client-cert.pem'
65+
 Â Â Â Â Â Â Â Â Â Â Â Â  ssl_ca: '/path/to/ca-cert.pem'
6066

6167
### SQL data dump
6268

@@ -202,11 +208,23 @@ Provide table name and column values.
202208
{% highlight php %}
203209

204210
<?php
205-
$I->dontSeeInDatabase('users', array('name' => 'Davert', 'email' => 'davert@mail.com'));
211+
$I->dontSeeInDatabase('users', ['name' => 'Davert', 'email' => 'davert@mail.com']);
206212

207213
{% endhighlight %}
208214
Fails if such user was found.
209215

216+
Comparison expressions can be used as well:
217+
218+
{% highlight php %}
219+
220+
<?php
221+
$I->dontSeeInDatabase('posts', ['num_comments >=' => '0']);
222+
$I->dontSeeInDatabase('users', ['email like' => 'miles%']);
223+
224+
{% endhighlight %}
225+
226+
Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`.
227+
210228
* `param string` $table
211229
* `param array` $criteria
212230

@@ -241,6 +259,17 @@ Provide table name, desired column and criteria.
241259
$mail = $I->grabFromDatabase('users', 'email', array('name' => 'Davert'));
242260

243261
{% endhighlight %}
262+
Comparison expressions can be used as well:
263+
264+
{% highlight php %}
265+
266+
<?php
267+
$post = $I->grabFromDatabase('posts', ['num_comments >=' => 100']);
268+
$user = $I->grabFromDatabase('users', ['email like' => 'miles%']);
269+
270+
{% endhighlight %}
271+
272+
Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`.
244273

245274
* `param string` $table
246275
* `param string` $column
@@ -288,11 +317,24 @@ Provide table name and column values.
288317
{% highlight php %}
289318

290319
<?php
291-
$I->seeInDatabase('users', array('name' => 'Davert', 'email' => 'davert@mail.com'));
320+
$I->seeInDatabase('users', ['name' => 'Davert', 'email' => 'davert@mail.com']);
292321

293322
{% endhighlight %}
294323
Fails if no such user found.
295324

325+
Comparison expressions can be used as well:
326+
327+
{% highlight php %}
328+
329+
<?php
330+
$I->seeInDatabase('posts', ['num_comments >=' => '0']);
331+
$I->seeInDatabase('users', ['email like' => 'miles@davis.com']);
332+
333+
{% endhighlight %}
334+
335+
Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`.
336+
337+
296338
* `param string` $table
297339
* `param array` $criteria
298340

docs/modules/PhpBrowser.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,15 @@ If test fails stores last shown page in 'output' dir.
2222
* Maintainer: **davert**
2323
* Stability: **stable**
2424
* Contact: codeception@codeception.com
25-
* Works with [Guzzle](http://guzzlephp.org/)
2625

27-
*Please review the code of non-stable modules and provide patches if you have issues.*
2826

2927
### Configuration
3028

3129
* url *required* - start url of your app
30+
* headers - default headers are set before each test.
3231
* handler (default: curl) - Guzzle handler to use. By default curl is used, also possible to pass `stream`, or any valid class name as [Handler](http://docs.guzzlephp.org/en/latest/handlers-and-middleware.html#handlers).
3332
* middleware - Guzzle middlewares to add. An array of valid callables is required.
3433
* curl - curl options
35-
* headers - ...
3634
* cookies - ...
3735
* auth - ...
3836
* verify - ...

docs/modules/Queue.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ service.
5050
* token - Iron.io access token.
5151
* project - Iron.io project ID.
5252
* key - AWS access key ID.
53+
* version - AWS version (e.g. latest)
54+
* endpoint - The full URI of the webservice. This is only required when connecting to a custom endpoint (e.g., a local version of SQS).
5355
* secret - AWS secret access key.
5456
Warning:
5557
Hard-coding your credentials can be dangerous, because it is easy to accidentally commit your credentials
@@ -87,40 +89,40 @@ service.
8789
enabled: [Queue]
8890
config:
8991
Queue:
90-
'type' => 'iron',
91-
'host' => 'mq-aws-us-east-1.iron.io',
92-
'token' => 'your-token',
93-
'project' => 'your-project-id'
92+
'type': 'iron',
93+
'host': 'mq-aws-us-east-1.iron.io',
94+
'token': 'your-token',
95+
'project': 'your-project-id'
9496

9597
##### Example (AWS SQS)
9698

9799
modules:
98100
enabled: [Queue]
99101
config:
100102
Queue:
101-
'type' => 'aws',
102-
'key' => 'your-public-key',
103-
'secret' => 'your-secret-key',
104-
'region' => 'us-west-2'
103+
'type': 'aws',
104+
'key': 'your-public-key',
105+
'secret': 'your-secret-key',
106+
'region': 'us-west-2'
105107

106108
##### Example AWS SQS using profile credentials
107109

108110
modules:
109111
enabled: [Queue]
110112
config:
111113
Queue:
112-
'type' => 'aws',
113-
'profile' => 'project1', //see documentation
114-
'region' => 'us-west-2'
114+
'type': 'aws',
115+
'profile': 'project1', //see documentation
116+
'region': 'us-west-2'
115117

116118
##### Example AWS SQS running on Amazon EC2 instance
117119

118120
modules:
119121
enabled: [Queue]
120122
config:
121123
Queue:
122-
'type' => 'aws',
123-
'region' => 'us-west-2'
124+
'type': 'aws',
125+
'region': 'us-west-2'
124126

125127

126128

docs/modules/REST.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,33 @@ Conflicts with SOAP module
4949

5050
### Actions
5151

52+
#### amAWSAuthenticated
53+
54+
Allows to send REST request using AWS Authorization
55+
Only works with PhpBrowser
56+
Example
57+
Config -
58+
59+
modules:
60+
enabled:
61+
- REST:
62+
aws:
63+
key: accessKey
64+
secret: accessSecret
65+
service: awsService
66+
region: awsRegion
67+
68+
{% highlight php %}
69+
70+
<?php
71+
$I->amAWSAuthenticated();
72+
?>
73+
74+
{% endhighlight %}
75+
* `param array` $additionalAWSConfig
76+
@throws ModuleException
77+
78+
5279
#### amBearerAuthenticated
5380

5481
Adds Bearer authentication via access token.

0 commit comments

Comments
 (0)