From 0d52e247760821dd3eb8c8c62f5a31c2311b6112 Mon Sep 17 00:00:00 2001 From: Jan Zdunek Date: Wed, 7 Jun 2017 16:32:28 +0200 Subject: [PATCH] Adding an implementation class to the BaseLogTest php file instead of using PHP 7 anonymous class (supporting PHP 5.6). --- tests/TestCase/Log/Engine/BaseLogTest.php | 39 +++++++++++++---------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/tests/TestCase/Log/Engine/BaseLogTest.php b/tests/TestCase/Log/Engine/BaseLogTest.php index 5d59fff9982..f713c040827 100644 --- a/tests/TestCase/Log/Engine/BaseLogTest.php +++ b/tests/TestCase/Log/Engine/BaseLogTest.php @@ -18,6 +18,28 @@ use Cake\TestSuite\TestCase; use Psr\Log\LogLevel; +/** + * Class BaseLogImpl + * Implementation of abstract class {@see Cake\Log\Engine\BaseLog}, + * required by test case {@see Cake\Test\TestCase\Log\Engine\BaseLogTest}. + */ +class BaseLogImpl extends BaseLog +{ + /** + * Logs with an arbitrary level. + * + * @param mixed $level + * @param mixed $message + * @param array $context + * + * @return mixed + */ + public function log($level, $message, array $context = []) + { + return $this->_format($message, $context); + } +} + class BaseLogTest extends TestCase { @@ -33,22 +55,7 @@ public function setUp() { parent::setUp(); - $this->logger = new class() extends BaseLog { - - /** - * Logs with an arbitrary level. - * - * @param mixed $level - * @param mixed $message - * @param array $context - * - * @return mixed - */ - public function log($level, $message, array $context = array()) - { - return $this->_format($message, $context); - } - }; + $this->logger = new BaseLogImpl(); } private function assertUnescapedUnicode(array $needles, string $haystack)