LoggerTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testPrintingLogInStdOutIfVerboseFlag() 0 8 1
A providerLevelMessages() 0 12 1
1
<?php
2
/**
3
 * @author Dmitry Gladyshev <[email protected]>
4
 */
5
6
namespace Rucaptcha\Test;
7
8
9
use PHPUnit\Framework\TestCase;
10
use Psr\Log\LogLevel;
11
use Rucaptcha\Logger;
12
13
class LoggerTest extends TestCase
14
{
15
    /**
16
     * @dataProvider providerLevelMessages
17
     */
18
    public function testPrintingLogInStdOutIfVerboseFlag($level, $message)
19
    {
20
        $logger = new Logger;
21
22
        $logger->log($level, $message);
23
24
        $this->expectOutputRegex("#\[{$level}\]\s{$message}#ui");
25
    }
26
27
    public function providerLevelMessages()
28
    {
29
        return [
30
            [LogLevel::ALERT, 'hello, i am the Log Entry!'],
31
            [LogLevel::CRITICAL, 'hello, i am the Log Entry!'],
32
            [LogLevel::EMERGENCY, 'hello, i am the Log Entry!'],
33
            [LogLevel::DEBUG, 'hello, i am the Log Entry!'],
34
            [LogLevel::ERROR, 'hello, i am the Log Entry!'],
35
            [LogLevel::INFO, 'hello, i am the Log Entry!'],
36
            [LogLevel::WARNING, 'hello, i am the Log Entry!']
37
        ];
38
    }
39
}