Completed
Push — master ( efa801...d3c12f )
by Mihail
12s queued 11s
created

LogConstructorTest::test_construction_with_config_array()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 7
c 0
b 0
f 0
dl 0
loc 12
rs 10
cc 1
nc 1
nop 0
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