Skip to content

Commit 617e530

Browse files
committed
auto updated documentation
1 parent 24bbf33 commit 617e530

21 files changed

+658
-45
lines changed

_includes/reference.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<li><a href="/docs/reference/Autoload">Autoload</a></li><li><a href="/docs/reference/Fixtures">Fixtures</a></li><li><a href="/docs/reference/Functions">Functions</a></li><li><a href="/docs/reference/JsonType">JsonType</a></li><li><a href="/docs/reference/Locator">Locator</a></li><li><a href="/docs/reference/Stub">Stub</a></li><li><a href="/docs/reference/XmlBuilder">XmlBuilder</a></li>
1+
<li><a href="/docs/reference/Autoload">Autoload</a></li><li><a href="/docs/reference/Fixtures">Fixtures</a></li><li><a href="/docs/reference/Functions">Functions</a></li><li><a href="/docs/reference/HttpCode">HttpCode</a></li><li><a href="/docs/reference/JsonType">JsonType</a></li><li><a href="/docs/reference/Locator">Locator</a></li><li><a href="/docs/reference/Stub">Stub</a></li><li><a href="/docs/reference/XmlBuilder">XmlBuilder</a></li>

changelog.markdown

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

88
# Changelog
99

10+
#### 2.2.2
11+
12+
* Parameters can be applied to global `codeception.yml` config. See [#3255](https://github.com/Codeception/Codeception/issues/3255) Thanks to **[LeRondPoint](https://github.com/LeRondPoint)**
13+
* Fixed loading of parameters from `.env.*` files. See [#3224](https://github.com/Codeception/Codeception/issues/3224). By **[smotesko](https://github.com/smotesko)**
14+
* Better failure diff messages by **[k0pernikus](https://github.com/k0pernikus)**
15+
* UTF-8 improvements (replaced with custom `ucfirst`, `strtoupper` => `mb_strtoupper`) by **[Naktibalda](https://github.com/Naktibalda)**. See [#3211](https://github.com/Codeception/Codeception/issues/3211)
16+
* Print execution time of non-successful tests by **[Naktibalda](https://github.com/Naktibalda)**. Fixes [#3274](https://github.com/Codeception/Codeception/issues/3274)
17+
* [WebDriver][PhpBrowser][Frameworks] Fixed created files on failure. Fixes [#3207](https://github.com/Codeception/Codeception/issues/3207)
18+
* [Frameworks][PhpBrowser] Adjacent forms submit improvements by **[dizzy7](https://github.com/dizzy7)**. Fixes [#2331](https://github.com/Codeception/Codeception/issues/2331)
19+
* **[WebDriver]** Fixed adjacent `selectOption` with similar options by **[eXorus](https://github.com/eXorus)**. Fixes [#3246](https://github.com/Codeception/Codeception/issues/3246)
20+
* **[DataFactory]** fixed loading factories from relative paths. Fixes [#3208](https://github.com/Codeception/Codeception/issues/3208)
21+
* *Test\Gherkin* Added JUnit reporter [#3273](https://github.com/Codeception/Codeception/issues/3273)
22+
* *Test\Unit* Dependencies can pass and receive values the same way as it is done in PHPUnit. Fixes [#3213](https://github.com/Codeception/Codeception/issues/3213)
23+
* **[Symfony]** Fixed failing tests when the profiler is disabled by **[dizzy7](https://github.com/dizzy7)**. See [#3223](https://github.com/Codeception/Codeception/issues/3223)
24+
* **[REST]** Added `Codecepion\Util\HttpCode` util class with HTTP code constants. See [class reference](https://github.com/Codeception/Codeception/blob/2.2/docs/reference/HttpCode.md)
25+
* **[REST]** Support simple key-value format for file uploads. See [#3244](https://github.com/Codeception/Codeception/issues/3244)
26+
* Bugfix with duplicate instances in the modules container [#3219](https://github.com/Codeception/Codeception/issues/3219) by **[dizzy7](https://github.com/dizzy7)**
27+
* **[REST]** Added `deleteHeader` method by **[Naktibalda](https://github.com/Naktibalda)**. Fixes [#3161](https://github.com/Codeception/Codeception/issues/3161)
28+
* **[Yii1]** `init` part added to avoid conflicts with `WebDriver`
29+
* `generate:snippets` can accept second parameter to generate snippets from a specific file or folder.
30+
* **[Db]** Added `grabNumRecords` method by **[tocsick](https://github.com/tocsick)**. See [#3175](https://github.com/Codeception/Codeception/issues/3175)
31+
* Fixed group events fire twice [#3112](https://github.com/Codeception/Codeception/issues/3112). By **[jstaudenmaier](https://github.com/jstaudenmaier)**
32+
* **[ZF2]** Added services part which can be used to `grabServiceFromContainer` when conflicting module is used by **[Naktibalda](https://github.com/Naktibalda)**.
33+
* Improved Examples to be Traversable; Fixed console output for complex data structures.
34+
* **[Laravel5]** Added `haveBinding`, `haveSingleton`, `haveContextualBinding` and `haveInstance` methods. By **[janhenkgerritsen](https://github.com/janhenkgerritsen)**. See [#2904](https://github.com/Codeception/Codeception/issues/2904).
35+
* + changes from 2.1.11
36+
1037
#### 2.2.1
1138

1239
* PHPUnit 5.4 and PHPUnit/php-code-coverage 4.0 compatibility.
@@ -25,7 +52,10 @@ title: Codeception Changelog
2552
* **Custom Commands** inject your own commands as as simple as extension. [Announcement](http://codeception.com/03-10-2016/even-more-features-of-codeception.html#custom-commands)
2653
* `codecept dry-run` command added to show scenario steps without executing them.
2754
* *Breaking* **[Dbh]** module removed
28-
* *Breaking* **[Laravel4]** module removed
55+
* *Breaking* **[Laravel4]** module removed. See [#2866](https://github.com/Codeception/Codeception/issues/2866)
56+
* *Breaking* **[Laravel5]** Removed `createModel` method, use `have` method instead. See [#2866](https://github.com/Codeception/Codeception/issues/2866)
57+
* *Breaking* **[Laravel5]** Removed `makeModel` method. See [#2866](https://github.com/Codeception/Codeception/issues/2866)
58+
* *Breaking* **[Laravel5]** Renamed `haveModel` method to `have`. See [#2866](https://github.com/Codeception/Codeception/issues/2866)
2959
* *Breaking* **[Symfony]** public property `container` removed
3060
* *Breaking* **[Asserts]** removed deprecated `assertLessThen` and `assertGreaterThen`
3161
* *Breaking* mocks created with `Codeception\Util\Stub` are not verified in Cests. See [#3005](https://github.com/Codeception/Codeception/issues/3005)
@@ -34,6 +64,8 @@ title: Codeception Changelog
3464
* **[AngularJS]** module added. Extends WebDriver module for AngularJS testing. [Announcement](http://codeception.com/03-10-2016/even-more-features-of-codeception.html#angularjs)
3565
* **[DataFactory]** module added. Performs data generation using FactoryMuffin library [Announcement](http://codeception.com/03-10-2016/even-more-features-of-codeception.html#datafactory)
3666
* **[Redis]** Module rewritten using Predis library as driver by **[marcverney](https://github.com/marcverney)**
67+
* **[Laravel5]** Added a `haveMultiple` method to create more than one model per call. See [#2866](https://github.com/Codeception/Codeception/issues/2866)
68+
* **[Laravel5]** [Lumen] The `haveRecord`, `seeRecord`, `dontSeeRecord` and `grabRecord` methods now also accept Eloquent model class names instead of only database table names. See [#2866](https://github.com/Codeception/Codeception/issues/2866)
3769
* **[Symfony]** module Symfony2 renamed to Symfony
3870
* **[Phalcon]** Merged `Phalcon1` and `Phalcon2` modules into one `Phalcon` due the fact that Phalcon Framework v1.3.x no longer supported at all
3971
* **[Asserts]** More `assert*` methods from PHPUnit added
@@ -44,8 +76,18 @@ title: Codeception Changelog
4476
* Deprecation errors won't fail tests but will be printed.
4577
* Official [Docker image](https://hub.docker.com/r/codeception/codeception/) introduced by **[schmunk42](https://github.com/schmunk42)**
4678

79+
#### 2.1.11
80+
81+
* **[Yii1]** Improved Yii connector. AR metadata is cleaned up between requests. `regenerateId` of session is disabled.
82+
* [REST][InnerBrowser] redirect is not triggered when Location header is set but response code is not 3xx. By **[Naktibalda](https://github.com/Naktibalda)**. Fixes [#3171](https://github.com/Codeception/Codeception/issues/3171).
83+
* [PhpBrowser][Frameworks] checkboxes can be located by label by **[dizzy7](https://github.com/dizzy7)**. See [#3237](https://github.com/Codeception/Codeception/issues/3237)
84+
* [PhpBrowser][Frameworks] field can be matched by its trimmed label value. See [#3209](https://github.com/Codeception/Codeception/issues/3209). By **[dizzy7](https://github.com/dizzy7)**
85+
* **[WebDriver]** fixed URL matching in WebDriver::seeLink
86+
* [WebDriver][InnerBrowser] Improved error messages of `seeLink` and `dontSeeLink`
87+
4788
#### 2.1.10
4889

90+
* PHPUnit version locked to <5.4
4991
* **[Db]** Added missing support for LIKE condition to SqlSrv driver
5092

5193
#### 2.1.9

docs/10-WebServices.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,15 @@ $I->wantTo('create a user via API');
8080
$I->amHttpAuthenticated('service_user', '123456');
8181
$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
8282
$I->sendPOST('/users', ['name' => 'davert', 'email' => 'davert@codeception.com']);
83-
$I->seeResponseCodeIs(200);
83+
$I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK); // 200
8484
$I->seeResponseIsJson();
8585
$I->seeResponseContains('{"result":"ok"}');
8686

8787

8888
{% endhighlight %}
8989

90+
We can use HTTP code constants from `Codeception\Util\HttpCode` instead of numeric values to check response code in `seeResponseCodeIs` and `dontSeeResponseCodeIs` methods.
91+
9092
### Testing JSON Responses
9193

9294
The last line of the previous example verified that the response contained the provided string. However we shouldn't rely on it, as depending on content formatting we can receive different results with the same data. What we actually need is to check that the response can be parsed and it contains some of the values we expect. In the case of JSON we can use the `seeResponseContainsJson` method
@@ -114,6 +116,7 @@ You may want to perform even more complex assertions on a response. This can be
114116

115117
<?php
116118
namespace Helper;
119+
117120
class Api extends \Codeception\Module
118121
{
119122
public function seeResponseIsHtml()
@@ -140,6 +143,7 @@ If we expect a JSON response to be received we can check its structure with [JSO
140143
$I = new ApiTester($scenario);
141144
$I->wantTo('validate structure of GitHub api responses');
142145
$I->sendGET('/users');
146+
$I->seeResponseCodeIs(HttpCode::OK); // 200
143147
$I->seeResponseIsJson();
144148
$I->seeResponseJsonMatchesJsonPath('$[0].user.login');
145149
$I->seeResponseJsonMatchesXpath('//user/login');
@@ -154,6 +158,7 @@ You can do that by using with a [seeResponseMatchesJsonType](http://codeception.
154158

155159
<?php
156160
$I->sendGET('/users/1');
161+
$I->seeResponseCodeIs(HttpCode::OK); // 200
157162
$I->seeResponseIsJson();
158163
$I->seeResponseMatchesJsonType([
159164
'id' => 'integer',
@@ -182,6 +187,7 @@ use Codeception\Util\Xml as XmlUtils;
182187
$I = new ApiTester($scenario);
183188
$I->wantTo('validate structure of GitHub api responses');
184189
$I->sendGET('/users.xml');
190+
$I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK); // 200
185191
$I->seeResponseIsXml();
186192
$I->seeXmlResponseMatchesXpath('//user/login');
187193
$I->seeXmlResponseIncludes(XmlUtils::toXml(

docs/12-ParallelExecution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Codeception does not provide a command like `run-parallel`. There is no common s
1919

2020
There are two approaches to achieve parallelization. We can use [Docker](http://docker.com) and run each process inside isolated containers, and have those containers executed simultaneously.
2121

22-
<div class="alert alert-warning">
22+
<div class="alert alert-info">
2323
Docker works really well for isolating testing environments.
2424
By the time of writing this chapter, we didn't have an awesome tool like it. This chapter demonstrates how to manage parallel execution manually. As you will see we spend too much effort trying to isolate tests which Docker does for free. Today we **recommend using Docker** for parallel testing.
2525
</div>

docs/modules/DataFactory.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ modules:
6363

6464
(you can also use Laravel5 and Phalcon).
6565

66-
In this example factories are loaded from `tests/_support/factories` directory.
66+
In this example factories are loaded from `tests/_support/factories` directory. Please note that this directory is relative from the codeception.yml file (so for Yii2 it would be codeception/_support/factories).
6767
* You should create this directory manually and create PHP files in it with factories definitions following [official documentation](https://github.com/thephpleague/factory-muffin#usage).
6868

6969
In cases you want to use data from database inside your factory definitions you can define them in Helper.
@@ -134,12 +134,11 @@ In case your ORM expects a related record itself (Doctrine) then you should use
134134
{% endhighlight %}
135135

136136

137-
138137
### Actions
139138

140139
#### have
141140

142-
Generates and saves a record,
141+
Generates and saves a record,.
143142

144143
{% highlight php %}
145144

@@ -152,12 +151,13 @@ Returns an instance of created user.
152151

153152
* `param` $name
154153
* `param array` $extraAttrs
154+
155155
* `return` object
156156

157157

158158
#### haveMultiple
159159

160-
Generates and saves a record multiple times
160+
Generates and saves a record multiple times.
161161

162162
{% highlight php %}
163163

@@ -169,6 +169,7 @@ $I->haveMultiple('User', 10, ['is_active' => true]); // create 10 active users
169169
* `param` $name
170170
* `param` $times
171171
* `param array` $extraAttrs
172+
172173
* `return` \object[]
173174

174175
<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.2/src/Codeception/Module/DataFactory.php">Help us to improve documentation. Edit module reference</a></div>

docs/modules/Db.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,9 @@ DELETE FROM `Order`;
9191
{% endhighlight %}
9292
### Query generation
9393

94-
seeInDatabase, dontSeeInDatabase, seeNumRecords and grabFromDatabase methods accept arrays as criteria.
95-
WHERE condition is generated using item key as a field name and item value as a field value.
94+
seeInDatabase, dontSeeInDatabase, seeNumRecords, grabFromDatabase and grabNumRecords methods
95+
accept arrays as criteria. WHERE condition is generated using item key as a field name and
96+
item value as a field value.
9697

9798
Example:
9899
{% highlight php %}
@@ -171,6 +172,16 @@ $mail = $I->grabFromDatabase('users', 'email', array('name' => 'Davert'));
171172

172173

173174

175+
#### grabNumRecords
176+
177+
Returns the number of rows in a database
178+
179+
* `param string` $table Table name
180+
* `param array` $criteria Search criteria [Optional]
181+
182+
* `return` int
183+
184+
174185
#### haveInDatabase
175186

176187
Inserts an SQL record into a database. This record will be erased after the test.

docs/modules/Facebook.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ To use this module with Composer you need <em>"facebook/php-sdk4": "5.*"</em> pa
1919

2020
### Status
2121

22-
* Maintainer: **tiger-seo**
22+
[ ![Facebook Status for Codeception/Codeception](https://codeship.com/projects/e4bc90d0-1ed5-0134-566c-1ed679ae6c9d/status?branch=2.2)](https://codeship.com/projects/160201)
23+
2324
* Stability: **beta**
24-
* Contact: tiger.seo@gmail.com
25+
* Maintainer: **tiger-seo**
26+
* Contact: tiger.seo@codeception.com
2527

2628
### Config
2729

docs/modules/Laravel5.md

Lines changed: 102 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,22 @@ $I->dontSeeRecord('App\User', array('name' => 'davert'));
717717
* `[Part]` orm
718718

719719

720+
#### dontSeeResponseCodeIs
721+
722+
Checks that response code is equal to value provided.
723+
724+
{% highlight php %}
725+
726+
<?php
727+
$I->dontSeeResponseCodeIs(200);
728+
729+
// recommended \Codeception\Util\HttpCode
730+
$I->dontSeeResponseCodeIs(\Codeception\Util\HttpCode::OK);
731+
732+
{% endhighlight %}
733+
* `param` $code
734+
735+
720736
#### enableExceptionHandling
721737

722738
Enable Laravel exception handling.
@@ -854,8 +870,8 @@ $record = $I->grabRecord('App\User', array('name' => 'davert')); // returns Eloq
854870

855871
#### grabService
856872

857-
Return an instance of a class from the IoC Container.
858-
(http://laravel.com/docs/ioc)
873+
Return an instance of a class from the Laravel service container.
874+
(https://laravel.com/docs/master/container)
859875

860876
{% highlight php %}
861877

@@ -908,6 +924,46 @@ $value = $I->grabTextFrom('~<input value=(.*?)]~sgi'); // match with a regex
908924
__not documented__
909925

910926

927+
#### haveBinding
928+
929+
Add a binding to the Laravel service container.
930+
(https://laravel.com/docs/master/container)
931+
932+
{% highlight php %}
933+
934+
<?php
935+
$I->haveBinding('My\Interface', 'My\Implementation');
936+
?>
937+
938+
{% endhighlight %}
939+
940+
* `param` $abstract
941+
* `param` $concrete
942+
943+
944+
#### haveContextualBinding
945+
946+
Add a contextual binding to the Laravel service container.
947+
(https://laravel.com/docs/master/container)
948+
949+
{% highlight php %}
950+
951+
<?php
952+
$I->haveContextualBinding('My\Class', '$variable', 'value');
953+
954+
// This is similar to the following in your Laravel application
955+
$app->when('My\Class')
956+
->needs('$variable')
957+
->give('value');
958+
?>
959+
960+
{% endhighlight %}
961+
962+
* `param` $concrete
963+
* `param` $abstract
964+
* `param` $implementation
965+
966+
911967
#### haveHttpHeader
912968

913969
Sets the HTTP header to the passed value - which is used on
@@ -928,6 +984,23 @@ $I->amOnPage('test-headers.php');
928984
requests
929985

930986

987+
#### haveInstance
988+
989+
Add an instance binding to the Laravel service container.
990+
(https://laravel.com/docs/master/container)
991+
992+
{% highlight php %}
993+
994+
<?php
995+
$I->haveInstance('My\Class', new My\Class());
996+
?>
997+
998+
{% endhighlight %}
999+
1000+
* `param` $abstract
1001+
* `param` $instance
1002+
1003+
9311004
#### haveMultiple
9321005
__not documented__
9331006

@@ -953,6 +1026,23 @@ $user = $I->haveRecord('App\User', array('name' => 'Davert')); // returns Eloque
9531026
* `[Part]` orm
9541027

9551028

1029+
#### haveSingleton
1030+
1031+
Add a singleton binding to the Laravel service container.
1032+
(https://laravel.com/docs/master/container)
1033+
1034+
{% highlight php %}
1035+
1036+
<?php
1037+
$I->haveSingleton('My\Interface', 'My\Singleton');
1038+
?>
1039+
1040+
{% endhighlight %}
1041+
1042+
* `param` $abstract
1043+
* `param` $concrete
1044+
1045+
9561046
#### logout
9571047

9581048
Logout user.
@@ -1450,8 +1540,17 @@ $I->seeRecord('App\User', array('name' => 'davert'));
14501540

14511541
Checks that response code is equal to value provided.
14521542

1453-
* `param` $code
1543+
{% highlight php %}
1544+
1545+
<?php
1546+
$I->seeResponseCodeIs(200);
14541547

1548+
// recommended \Codeception\Util\HttpCode
1549+
$I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
1550+
1551+
{% endhighlight %}
1552+
1553+
* `param` $code
14551554

14561555

14571556
#### seeSessionHasValues

0 commit comments

Comments
 (0)