diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2018-09-06 01:33:03 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-06 01:33:03 +0300 |
commit | d679c5571ece625b9863c63ad9b99d09f28ce63f (patch) | |
tree | 92c8d40c945c21d9aaf13837eac24f91c7de4e97 /config/environment | |
parent | 04c8456861787b50b22444617bef114eb00be7e1 (diff) |
Add [tests] config option to enable logging in tests. (#13335)
* Add [tests] config option to enable logging in tests.
* Allow tests:run/tests:run-ui commands to enable logging for individual runs + during tests only log to file.
* Remove Fixture field
* fix failing test
* fixing build
* Fix another failure.
* Fix an other test.
Diffstat (limited to 'config/environment')
-rw-r--r-- | config/environment/test.php | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/config/environment/test.php b/config/environment/test.php index 2ac39275b8..785eb15ce4 100644 --- a/config/environment/test.php +++ b/config/environment/test.php @@ -8,7 +8,26 @@ use Piwik\Tests\Framework\Mock\TestConfig; return array( // Disable logging - 'Psr\Log\LoggerInterface' => DI\object('Psr\Log\NullLogger'), + 'Psr\Log\LoggerInterface' => \DI\decorate(function ($previous, ContainerInterface $c) { + $enableLogging = $c->get('ini.tests.enable_logging') == 1 || !empty(getenv('MATOMO_TESTS_ENABLE_LOGGING')); + if ($enableLogging) { + return $previous; + } else { + return $c->get(\Psr\Log\NullLogger::class); + } + }), + + 'Tests.log.allowAllHandlers' => false, + + 'log.handlers' => \DI\decorate(function ($previous, ContainerInterface $c) { + if ($c->get('Tests.log.allowAllHandlers')) { + return $previous; + } + + return [ + $c->get('Piwik\Plugins\Monolog\Handler\FileHandler'), + ]; + }), 'Piwik\Cache\Backend' => function () { return \Piwik\Cache::buildBackend('file'); |