Skip to content

Commit

Permalink
fixed passed config parameter in FileHandlerTest
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Mar 20, 2020
1 parent 99d4649 commit a85fa14
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/system/Log/FileHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,18 @@ public function testBasicHandle()
$config = new LoggerConfig();
$config->handlers['Tests\Support\Log\Handlers\TestHandler']['path'] = $this->start . 'charlie/';
$config->handlers['Tests\Support\Log\Handlers\TestHandler']['handles'] = ['critical'];
$logger = new MockFileLogger((array) $config);
$logger = new MockFileLogger($config->handlers['Tests\Support\Log\Handlers\TestHandler']);
$logger->setDateFormat('Y-m-d H:i:s:u');
$expected = 'log-' . date('Y-m-d') . '.log';
vfsStream::newFile($expected)->at(vfsStream::setup('root/charlie'))->withContent('This is a test log');
$this->assertTrue($logger->handle('warning', 'This is a test log'));
}

public function testHandleCreateFile()
{
$config = new LoggerConfig();
$config->handlers['Tests\Support\Log\Handlers\TestHandler']['path'] = $this->start;
$logger = new MockFileLogger((array) $config);
$logger = new MockFileLogger($config->handlers['Tests\Support\Log\Handlers\TestHandler']);

$logger->setDateFormat('Y-m-d H:i:s:u');
$expected = 'log-' . date('Y-m-d') . '.log';
Expand All @@ -61,7 +63,7 @@ public function testHandleDateTimeCorrectly()
{
$config = new LoggerConfig();
$config->handlers['Tests\Support\Log\Handlers\TestHandler']['path'] = $this->start;
$logger = new MockFileLogger((array) $config);
$logger = new MockFileLogger($config->handlers['Tests\Support\Log\Handlers\TestHandler']);

$logger->setDateFormat('Y-m-d');
$expected = 'log-' . date('Y-m-d') . '.log';
Expand Down

0 comments on commit a85fa14

Please sign in to comment.