diff --git a/docs/03-AcceptanceTests.md b/docs/03-AcceptanceTests.md index 81a00b6e6..0b658b2ff 100644 --- a/docs/03-AcceptanceTests.md +++ b/docs/03-AcceptanceTests.md @@ -887,6 +887,22 @@ WebDriver module provides advanced methods for the browser session, however, the Those methods can be used to create custom commands like `$I->startBrowser()` or used in [before/after](http://codeception.com/docs/06-ModulesAndHelpers#Hooks) hooks. +## Error Reporting + +By default Codeception uses the `E_ALL & ~E_STRICT & ~E_DEPRECATED` error reporting level. +In acceptance tests you might want to change this level depending on your framework's error policy. +The error reporting level can be set in the suite configuration file: + +{% highlight yaml %} + +actor: AcceptanceTester +... +error_level: E_ALL & ~E_STRICT & ~E_DEPRECATED + +{% endhighlight %} + +`error_level` can also be set globally in `codeception.yml` file. In order to do that, you need to specify `error_level` as a part of `settings`. For more information, see [Global Configuration](https://codeception.com/docs/reference/Configuration). Note that suite specific `error_level` value will override global value. + ## Conclusion Writing acceptance tests with Codeception and PhpBrowser is a good start. diff --git a/docs/04-FunctionalTests.md b/docs/04-FunctionalTests.md index c02dee526..53d44aa0a 100644 --- a/docs/04-FunctionalTests.md +++ b/docs/04-FunctionalTests.md @@ -259,15 +259,12 @@ The error reporting level can be set in the suite configuration file: {% highlight yaml %} actor: FunctionalTester -modules: - enabled: - - Yii2 - - \Helper\Functional -error_level: "E_ALL & ~E_STRICT & ~E_DEPRECATED" +... +error_level: E_ALL & ~E_STRICT & ~E_DEPRECATED {% endhighlight %} -`error_level` can also be set globally in `codeception.yml` file. In order to do that, you need to specify `error_level` as a part of `settings`. For more information, see [Global Configuration](https://codeception.com/docs/reference/Configuration). +`error_level` can also be set globally in `codeception.yml` file. In order to do that, you need to specify `error_level` as a part of `settings`. For more information, see [Global Configuration](https://codeception.com/docs/reference/Configuration). Note that suite specific `error_level` value will override global value. ## Conclusion diff --git a/docs/05-UnitTests.md b/docs/05-UnitTests.md index b7caca19d..e62691b13 100644 --- a/docs/05-UnitTests.md +++ b/docs/05-UnitTests.md @@ -514,6 +514,22 @@ public function testSingleton() * [AspectMock in Action](http://codeception.com/07-31-2013/nothing-is-untestable-aspect-mock.html) * [How it Works](http://codeception.com/09-13-2013/understanding-aspectmock.html) +## Error Reporting + +By default Codeception uses the `E_ALL & ~E_STRICT & ~E_DEPRECATED` error reporting level. +In unit tests you might want to change this level depending on your framework's error policy. +The error reporting level can be set in the suite configuration file: + +{% highlight yaml %} + +actor: UnitTester +... +error_level: E_ALL & ~E_STRICT & ~E_DEPRECATED + +{% endhighlight %} + +`error_level` can also be set globally in `codeception.yml` file. In order to do that, you need to specify `error_level` as a part of `settings`. For more information, see [Global Configuration](https://codeception.com/docs/reference/Configuration). Note that suite specific `error_level` value will override global value. + ## Conclusion PHPUnit tests are first-class citizens in test suites. Whenever you need to write and execute unit tests, diff --git a/docs/reference/Configuration.md b/docs/reference/Configuration.md index 91eaec9c5..33d847937 100644 --- a/docs/reference/Configuration.md +++ b/docs/reference/Configuration.md @@ -84,6 +84,12 @@ settings: # Section logging > junit log_incomplete_skipped: false + # Set the error_reporting level + # You can specify either a predefined constant or an integer value + # See https://www.php.net/manual/en/function.error-reporting.php + # See https://www.php.net/manual/en/errorfunc.constants.php + error_level: E_ALL & ~E_STRICT & ~E_DEPRECATED + {% endhighlight %} * `modules`: allows to create shared module configuration for all included suites. @@ -151,7 +157,7 @@ modules: * `formats`: [formats](http://codeception.com/docs/07-AdvancedUsage#Formats) with the list of extra test format classes. * `coverage`: per suite [CodeCoverage](http://codeception.com/docs/11-Codecoverage#Configuration) settings. * `gherkin`: per suite [BDD Gherkin](http://codeception.com/docs/07-BDD#Configuration) settings. -* `error_level`: [error level](http://codeception.com/docs/04-FunctionalTests#Error-Reporting) for runner in current suite. Should be specified for unit, integration, functional tests. Passes value to `error_reporting` function. +* `error_level`: [error level](http://codeception.com/docs/04-FunctionalTests#Error-Reporting) for runner in current suite. Can be specified for unit, integration, functional tests. Passes value to `error_reporting` function. Suite specific value will override the global value. * `bootstrap`: bootstrap script that will be executed before current suites. A script should be put into suite directory. ## Config Templates (dist)