Completed
Pull Request — master (#8)
by Mathieu
02:03
created

LoggerTest::testDebug()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 9
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 11
rs 9.9666
1
<?php
2
3
use Suricate\Logger;
4
5
/**
6
 * @SuppressWarnings("StaticAccess")
7
 */
8
class LoggerTest extends \PHPUnit\Framework\TestCase
9
{
10
    public function testFatal()
11
    {
12
        $message = 'log message';
13
        $mock = $this->getMockBuilder(Logger::class)
14
            ->setMethods(['log'])
15
            ->getMock();
16
        $mock
17
            ->expects($this->once())
18
            ->method('log')
19
            ->with($message, Logger::LOGLEVEL_FATAL);
20
        $mock->fatal($message);
0 ignored issues
show
Bug introduced by
The method fatal() does not exist on PHPUnit\Framework\MockObject\MockObject. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
        $mock->/** @scrutinizer ignore-call */ 
21
               fatal($message);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
21
    }
22
23
    public function testError()
24
    {
25
        $message = 'log message';
26
        $mock = $this->getMockBuilder(Logger::class)
27
            ->setMethods(['log'])
28
            ->getMock();
29
        $mock
30
            ->expects($this->once())
31
            ->method('log')
32
            ->with($message, Logger::LOGLEVEL_ERROR);
33
        $mock->error($message);
0 ignored issues
show
Bug introduced by
The method error() does not exist on PHPUnit\Framework\MockObject\MockObject. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

33
        $mock->/** @scrutinizer ignore-call */ 
34
               error($message);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
34
    }
35
36
    public function testWarn()
37
    {
38
        $message = 'log message';
39
        $mock = $this->getMockBuilder(Logger::class)
40
            ->setMethods(['log'])
41
            ->getMock();
42
        $mock
43
            ->expects($this->once())
44
            ->method('log')
45
            ->with($message, Logger::LOGLEVEL_WARN);
46
        $mock->warn($message);
0 ignored issues
show
Bug introduced by
The method warn() does not exist on PHPUnit\Framework\MockObject\MockObject. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

46
        $mock->/** @scrutinizer ignore-call */ 
47
               warn($message);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
47
    }
48
49
    public function testInfo()
50
    {
51
        $message = 'log message';
52
        $mock = $this->getMockBuilder(Logger::class)
53
            ->setMethods(['log'])
54
            ->getMock();
55
        $mock
56
            ->expects($this->once())
57
            ->method('log')
58
            ->with($message, Logger::LOGLEVEL_INFO);
59
        $mock->info($message);
0 ignored issues
show
Bug introduced by
The method info() does not exist on PHPUnit\Framework\MockObject\MockObject. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

59
        $mock->/** @scrutinizer ignore-call */ 
60
               info($message);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
60
    }
61
62
    public function testDebug()
63
    {
64
        $message = 'log message';
65
        $mock = $this->getMockBuilder(Logger::class)
66
            ->setMethods(['log'])
67
            ->getMock();
68
        $mock
69
            ->expects($this->once())
70
            ->method('log')
71
            ->with($message, Logger::LOGLEVEL_DEBUG);
72
        $mock->debug($message);
0 ignored issues
show
Bug introduced by
The method debug() does not exist on PHPUnit\Framework\MockObject\MockObject. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

72
        $mock->/** @scrutinizer ignore-call */ 
73
               debug($message);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
73
    }
74
}
75