Skip to content

Commit

Permalink
Adding an implementation class to the BaseLogTest php file instead of…
Browse files Browse the repository at this point in the history
… using PHP 7 anonymous class (supporting PHP 5.6).
  • Loading branch information
jzdunek committed Jun 7, 2017
1 parent 926a668 commit 0d52e24
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions tests/TestCase/Log/Engine/BaseLogTest.php
Expand Up @@ -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
{

Expand All @@ -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)
Expand Down

0 comments on commit 0d52e24

Please sign in to comment.