-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathLoggerTest.php
56 lines (47 loc) · 1.29 KB
/
LoggerTest.php
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
<?php
namespace Jcupitt\Vips\Test;
use Jcupitt\Vips;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use Psr\Log\LoggerTrait;
class LoggerTest extends TestCase
{
public function testGetLoggerCall()
{
// Asserts that getLogger without setting it should
// return a null value.
$logger = Vips\Config::getLogger();
$this->assertNull($logger);
}
public function testSetLoggerCall()
{
Vips\Config::setLogger(new class implements LoggerInterface
{
use LoggerTrait;
/**
* Logs with an arbitrary level.
*
* @param mixed $level
* @param string $message
* @param array $context
*
* @return void
*/
public function log($level, $message, array $context = array())
{
// Do logging logic here.
}
});
$logger = Vips\Config::getLogger();
// Asserts that getLogger should return an instance of Psr\Log\LoggerInterface
$this->assertInstanceOf(LoggerInterface::class, $logger);
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: expandtab sw=4 ts=4 fdm=marker
* vim<600: expandtab sw=4 ts=4
*/