From 9feb72235ae13de98e80b2060f5ca20bc4efd84e Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 13 Feb 2021 11:40:19 +0100 Subject: [PATCH] Added config to log in filesystem while running API tests --- bin/test/run-api-tests.sh | 2 ++ config/test/test_config.global.php | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/bin/test/run-api-tests.sh b/bin/test/run-api-tests.sh index 07b36881..dbd87a84 100755 --- a/bin/test/run-api-tests.sh +++ b/bin/test/run-api-tests.sh @@ -3,6 +3,8 @@ export APP_ENV=test export DB_DRIVER=postgres export TEST_ENV=api +rm -rf data/log/api-tests + # Try to stop server just in case it hanged in last execution vendor/bin/laminas mezzio:swoole:stop diff --git a/config/test/test_config.global.php b/config/test/test_config.global.php index 3608257e..7ea5644a 100644 --- a/config/test/test_config.global.php +++ b/config/test/test_config.global.php @@ -9,6 +9,8 @@ use Laminas\ConfigAggregator\ConfigAggregator; use Laminas\Diactoros\Response\EmptyResponse; use Laminas\ServiceManager\Factory\InvokableFactory; use Laminas\Stdlib\Glob; +use Monolog\Handler\RotatingFileHandler; +use Monolog\Logger; use PDO; use PHPUnit\Runner\Version; use SebastianBergmann\CodeCoverage\CodeCoverage; @@ -163,4 +165,28 @@ return [ ], ], + 'logger' => [ + 'Shlink' => [ + 'handlers' => [ + 'shlink_handler' => [ + 'params' => [ + 'level' => Logger::DEBUG, + 'filename' => 'data/log/api-tests/shlink_log.log', + ], + ], + ], + ], + 'Access' => [ + 'handlers' => [ + 'access_handler' => [ + 'name' => RotatingFileHandler::class, + 'params' => [ + 'level' => Logger::DEBUG, + 'filename' => 'data/log/api-tests/access_log.log', + ], + ], + ], + ], + ], + ];