Passed
Pull Request — master (#2)
by Mihail
03:21
created

LogConstructorTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 12
c 1
b 0
f 0
dl 0
loc 24
rs 10
1
<?php
2
3
namespace Koded\Logging;
4
5
use Koded\Logging\Processors\Memory;
6
use PHPUnit\Framework\TestCase;
7
8
class LogConstructorTest extends TestCase
9
{
10
    public function test_construction_with_config_array()
11
    {
12
        $log = new Log([
13
            'timezone' => 'Europe/Berlin',
14
            'dateformat' => 'Y-m-d',
15
            'loggers' => [
16
                ['class' => Memory::class, 'levels' => Log::ALERT | Log::ERROR, 'format' => '[levelname] message']
17
            ]
18
        ]);
19
20
        $this->assertAttributeSame('Y-m-d', 'dateFormat', $log);
21
        $this->assertAttributeSame('Europe/Berlin', 'timezone', $log);
22
    }
23
24
    public function test_construction_without_config()
25
    {
26
        $log = new Log([]);
27
28
        $this->assertAttributeSame(false, 'deferred', $log);
29
        $this->assertAttributeSame('d/m/Y H:i:s.u', 'dateFormat', $log);
30
        $this->assertAttributeSame('UTC', 'timezone', $log);
31
    }
32
}
33