Skip to content

Commit c108fa5

Browse files
committed
auto updated documentation
1 parent bfd7553 commit c108fa5

File tree

4 files changed

+59
-9
lines changed

4 files changed

+59
-9
lines changed

changelog.markdown

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

88
# Changelog
99

10+
#### 2.4.1
11+
12+
* Fixed `PHP Fatal error: Uncaught Error: Call to undefined method Codeception\Test\Descriptor::getTestDataSetIndex()` when filtering tests
13+
* Better support of PHPUnit warning status by **[edno](https://github.com/edno)**:
14+
* support PHPUnit addWarning()
15+
* display 'W' instead of success for warning test cases
16+
* Fixed Running test with invalid dataprovider by **[okneloper](https://github.com/okneloper)**. Fixed [#4888](https://github.com/Codeception/Codeception/issues/4888) by **[edno](https://github.com/edno)**
17+
* **[Yii2]** **Request flow and database transactions refactored** (by **[sammousa](https://github.com/sammousa)**):
18+
* **Breaking** Application is no longer available in helpers via `$this->getModule('Yii2'')->app`, now you must use `\Yii::$app` everywhere
19+
* Multiple databases are now supported
20+
* More reliable application state before and during test execution
21+
* Fixtures method is now configurable
22+
* 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)**
24+
* **[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)**
25+
* Fixed [#4854](https://github.com/Codeception/Codeception/issues/4854): unnecessary escaping in operation arguments logging by **[nicholascus](https://github.com/nicholascus)**
26+
* Fixed humanizing steps for utf8 strings by **[nicholascus](https://github.com/nicholascus)**. See [#4850](https://github.com/Codeception/Codeception/issues/4850)
27+
* Fixed parsing relative urls in `parse_url`. See [#4853](https://github.com/Codeception/Codeception/issues/4853) by **[quantum-x](https://github.com/quantum-x)**
28+
1029
#### 2.4.0
1130

1231
* **PHPUnit 7.x compatibility**
@@ -23,7 +42,9 @@ title: Codeception Changelog
2342
**Upgrade Notice**: If you face issues with underscore PHPUnit class names (like PHPUnit_Framework_Assert) you have two options:
2443

2544
* Lock version for PHPUnit in composer.json: "phpunit/phpunit":"^5.0.0"
26-
* Update your codebase and replace underscore PHPUnit class names to namespaced (PHPUnit 6+ API) #### 2.3.9
45+
* Update your codebase and replace underscore PHPUnit class names to namespaced (PHPUnit 6+ API)
46+
47+
#### 2.3.9
2748

2849
* Added `Codeception\Step\Argument\PasswordArgument` to pass sensitive data into tests:
2950

docs/07-AdvancedUsage.md

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,19 @@ class BasicCest
7272

7373
{% endhighlight %}
7474

75-
As you see, Cest classes have no parents.
75+
As you see, Cest classes have no parents.
7676
This is done intentionally. It allows you to extend your classes with common behaviors and workarounds
7777
that may be used in child classes. But don't forget to make these methods `protected` so they won't be executed as tests.
7878

79-
Cest format also can contain hooks based on test results:
79+
Cest format also can contain hooks based on test results:
8080

8181
* `_failed` will be executed on failed test
8282
* `_passed` will be executed on passed test
8383

8484
{% highlight php %}
8585

8686
<?php
87-
public function _failed(\AcceptanceTester $I)
87+
public function _failed(\AcceptanceTester $I)
8888
{
8989
// will be executed on test failure
9090
}
@@ -201,7 +201,7 @@ Moreover, Codeception can resolve dependencies recursively (when `A` depends on
201201
and handle parameters of primitive types with default values (like `$param = 'default'`).
202202
Of course, you are not allowed to have *cyclic dependencies*.
203203

204-
### Examples
204+
## Example Annotation
205205

206206
What if you want to execute the same test scenario with different data? In this case you can inject examples
207207
as `\Codeception\Example` instances.
@@ -210,6 +210,8 @@ Data is defined via the `@example` annotation, using JSON or Doctrine-style nota
210210
{% highlight php %}
211211

212212
<?php
213+
class EndpointCest
214+
{
213215
/**
214216
* @example ["/api/", 200]
215217
* @example ["/api/protected", 401]
@@ -221,6 +223,7 @@ Data is defined via the `@example` annotation, using JSON or Doctrine-style nota
221223
$I->sendGET($example[0]);
222224
$I->seeResponseCodeIs($example[1]);
223225
}
226+
}
224227

225228
{% endhighlight %}
226229

@@ -229,6 +232,8 @@ JSON:
229232
{% highlight php %}
230233

231234
<?php
235+
class PageCest
236+
{
232237
/**
233238
* @example { "url": "/", "title": "Welcome" }
234239
* @example { "url": "/info", "title": "Info" }
@@ -241,6 +246,7 @@ JSON:
241246
$I->see($example['title'], 'h1');
242247
$I->seeInTitle($example['title']);
243248
}
249+
}
244250

245251
{% endhighlight %}
246252

@@ -254,6 +260,8 @@ Key-value data in Doctrine-style annotation syntax:
254260
{% highlight php %}
255261

256262
<?php
263+
class PageCest
264+
{
257265
/**
258266
* @example(url="/", title="Welcome")
259267
* @example(url="/info", title="Info")
@@ -266,16 +274,21 @@ Key-value data in Doctrine-style annotation syntax:
266274
$I->see($example['title'], 'h1');
267275
$I->seeInTitle($example['title']);
268276
}
277+
}
269278

270279
{% endhighlight %}
271280

272-
You can also use the `@dataprovider` annotation for creating dynamic examples, using a protected method for providing example data:
281+
## DataProvider Annotations
282+
283+
You can also use the `@dataProvider` annotation for creating dynamic examples for [Cest classes](#Cest-Classes), using a **protected method** for providing example data:
273284

274285
{% highlight php %}
275286

276287
<?php
288+
class PageCest
289+
{
277290
/**
278-
* @dataprovider pageProvider
291+
* @dataProvider pageProvider
279292
*/
280293
public function staticPages(AcceptanceTester $I, \Codeception\Example $example)
281294
{
@@ -296,10 +309,14 @@ You can also use the `@dataprovider` annotation for creating dynamic examples, u
296309
['url'=>"/contact", 'title'=>"Contact Us"]
297310
];
298311
}
312+
}
299313

300314
{% endhighlight %}
301315

302-
### Before/After Annotations
316+
`@dataprovider` annotation is also available for [unit tests](https://codeception.com/docs/05-UnitTests), in this case the data provider **method must be public**.
317+
For more details about how to use data provider for unit tests, please refer to [PHPUnit documentation](https://phpunit.de/manual/current/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.data-providers).
318+
319+
## Before/After Annotations
303320

304321
You can control execution flow with `@before` and `@after` annotations. You may move common actions
305322
into protected (non-test) methods and invoke them before or after the test method by putting them into annotations.

docs/modules/Laravel5.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,12 +334,14 @@ Call an Artisan command.
334334
<?php
335335
$I->callArtisan('command:name');
336336
$I->callArtisan('command:name', ['parameter' => 'value']);
337-
?>
338337

339338
{% endhighlight %}
339+
Use 3rd parameter to pass in custom `OutputInterface`
340340

341341
* `param string` $command
342342
* `param array` $parameters
343+
* `param OutputInterface` $output
344+
* `return` string
343345

344346

345347
#### checkOption

docs/modules/Yii2.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ title: Yii2 - Codeception - Documentation
1212

1313
This module provides integration with [Yii framework](http://www.yiiframework.com/) (2.0).
1414
It initializes Yii framework in test environment and provides actions for functional testing.
15+
### Application state during testing
16+
This section details what you can expect when using this module.
17+
* You will get a fresh application in `\Yii::$app` at the start of each test (available in the test and in `_before()`).
18+
* When executing a request via one of the request functions the `request` and `response` component are both recreated.
19+
* After a request the whole application is available for inspection / interaction.
20+
* You may use multiple database connections, each will use a separate transaction; to prevent accidental mistakes we
21+
will warn you if you try to connect to the same database twice but we cannot reuse the same connection.
1522

1623
### Config
1724

@@ -20,6 +27,8 @@ It initializes Yii framework in test environment and provides actions for functi
2027
* `entryScript` - front script title (like: index-test.php). If not set - taken from entryUrl.
2128
* `transaction` - (default: true) wrap all database connection inside a transaction and roll it back after the test. Should be disabled for acceptance testing..
2229
* `cleanup` - (default: true) cleanup fixtures after the test
30+
* `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.
31+
* `fixturesMethod` - (default: _fixtures) Name of the method used for creating fixtures.
2332

2433
You can use this module by setting params in your functional.suite.yml:
2534

@@ -132,6 +141,7 @@ $I->sendAjaxPostRequest(['/user/update', 'id' => 1], ['UserForm[name]' => 'G.Hop
132141
Maintainer: **samdark**
133142
Stability: **stable**
134143

144+
@property \Codeception\Lib\Connector\Yii2 $client
135145

136146
### Actions
137147

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