blob: a2c436d62de51c2439a183afce8cec4464ececa9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
<?php
namespace SMW\Tests\Utils;
use SMW\Utils\Logger;
/**
* @covers \SMW\Utils\Logger
* @group semantic-mediawiki
*
* @license GNU GPL v2+
* @since 3.0
*
* @author mwjames
*/
class LoggerTest extends \PHPUnit_Framework_TestCase {
private $logger;
protected function setUp() {
$this->logger = $this->getMockBuilder( '\Psr\Log\LoggerInterface' )
->disableOriginalConstructor()
->getMock();
}
public function testCanConstruct() {
$this->assertInstanceOf(
Logger::class,
new Logger( $this->logger )
);
}
/**
* @dataProvider logProvider
*/
public function testLog( $role, $message, $context ) {
$this->logger->expects( $this->once() )
->method( 'log' );
$instance = new Logger( $this->logger, $role );
$instance->log( 'Foo', $message, $context );
}
public function logProvider() {
yield [
Logger::ROLE_DEVELOPER,
'Foo',
[ 'Foo' ]
];
yield [
Logger::ROLE_DEVELOPER,
'Foo',
[ 'Foo', [ 'Bar' => 123 ] ]
];
}
}
|