You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: changelog.markdown
+22-1Lines changed: 22 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,25 @@ title: Codeception Changelog
7
7
8
8
# Changelog
9
9
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
+
10
29
#### 2.4.0
11
30
12
31
***PHPUnit 7.x compatibility**
@@ -23,7 +42,9 @@ title: Codeception Changelog
23
42
**Upgrade Notice**: If you face issues with underscore PHPUnit class names (like PHPUnit_Framework_Assert) you have two options:
24
43
25
44
* 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
27
48
28
49
* Added `Codeception\Step\Argument\PasswordArgument` to pass sensitive data into tests:
Copy file name to clipboardExpand all lines: docs/07-AdvancedUsage.md
+24-7Lines changed: 24 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -72,19 +72,19 @@ class BasicCest
72
72
73
73
{% endhighlight %}
74
74
75
-
As you see, Cest classes have no parents.
75
+
As you see, Cest classes have no parents.
76
76
This is done intentionally. It allows you to extend your classes with common behaviors and workarounds
77
77
that may be used in child classes. But don't forget to make these methods `protected` so they won't be executed as tests.
78
78
79
-
Cest format also can contain hooks based on test results:
79
+
Cest format also can contain hooks based on test results:
80
80
81
81
* `_failed` will be executed on failed test
82
82
* `_passed` will be executed on passed test
83
83
84
84
{% highlight php %}
85
85
86
86
<?php
87
-
public function _failed(\AcceptanceTester $I)
87
+
public function _failed(\AcceptanceTester $I)
88
88
{
89
89
// will be executed on test failure
90
90
}
@@ -201,7 +201,7 @@ Moreover, Codeception can resolve dependencies recursively (when `A` depends on
201
201
and handle parameters of primitive types with default values (like `$param = 'default'`).
202
202
Of course, you are not allowed to have *cyclic dependencies*.
203
203
204
-
### Examples
204
+
## Example Annotation
205
205
206
206
What if you want to execute the same test scenario with different data? In this case you can inject examples
207
207
as `\Codeception\Example` instances.
@@ -210,6 +210,8 @@ Data is defined via the `@example` annotation, using JSON or Doctrine-style nota
210
210
{% highlight php %}
211
211
212
212
<?php
213
+
class EndpointCest
214
+
{
213
215
/**
214
216
* @example ["/api/", 200]
215
217
* @example ["/api/protected", 401]
@@ -221,6 +223,7 @@ Data is defined via the `@example` annotation, using JSON or Doctrine-style nota
221
223
$I->sendGET($example[0]);
222
224
$I->seeResponseCodeIs($example[1]);
223
225
}
226
+
}
224
227
225
228
{% endhighlight %}
226
229
@@ -229,6 +232,8 @@ JSON:
229
232
{% highlight php %}
230
233
231
234
<?php
235
+
class PageCest
236
+
{
232
237
/**
233
238
* @example { "url": "/", "title": "Welcome" }
234
239
* @example { "url": "/info", "title": "Info" }
@@ -241,6 +246,7 @@ JSON:
241
246
$I->see($example['title'], 'h1');
242
247
$I->seeInTitle($example['title']);
243
248
}
249
+
}
244
250
245
251
{% endhighlight %}
246
252
@@ -254,6 +260,8 @@ Key-value data in Doctrine-style annotation syntax:
254
260
{% highlight php %}
255
261
256
262
<?php
263
+
class PageCest
264
+
{
257
265
/**
258
266
* @example(url="/", title="Welcome")
259
267
* @example(url="/info", title="Info")
@@ -266,16 +274,21 @@ Key-value data in Doctrine-style annotation syntax:
266
274
$I->see($example['title'], 'h1');
267
275
$I->seeInTitle($example['title']);
268
276
}
277
+
}
269
278
270
279
{% endhighlight %}
271
280
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:
273
284
274
285
{% highlight php %}
275
286
276
287
<?php
288
+
class PageCest
289
+
{
277
290
/**
278
-
* @dataprovider pageProvider
291
+
* @dataProvider pageProvider
279
292
*/
280
293
public function staticPages(AcceptanceTester $I, \Codeception\Example $example)
281
294
{
@@ -296,10 +309,14 @@ You can also use the `@dataprovider` annotation for creating dynamic examples, u
296
309
['url'=>"/contact", 'title'=>"Contact Us"]
297
310
];
298
311
}
312
+
}
299
313
300
314
{% endhighlight %}
301
315
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
303
320
304
321
You can control execution flow with `@before` and `@after` annotations. You may move common actions
305
322
into protected (non-test) methods and invoke them before or after the test method by putting them into annotations.
This module provides integration with [Yii framework](http://www.yiiframework.com/) (2.0).
14
14
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.
15
22
16
23
### Config
17
24
@@ -20,6 +27,8 @@ It initializes Yii framework in test environment and provides actions for functi
20
27
*`entryScript` - front script title (like: index-test.php). If not set - taken from entryUrl.
21
28
*`transaction` - (default: true) wrap all database connection inside a transaction and roll it back after the test. Should be disabled for acceptance testing..
22
29
*`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.
23
32
24
33
You can use this module by setting params in your functional.suite.yml:
0 commit comments