Failed Conditions
Pull Request — master (#3156)
by Sergei
13:25
created

PsrAdapterTest::testLogging()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 10
nc 2
nop 0
1
<?php
2
3
namespace Doctrine\DBAL\Logging;
4
5
use Doctrine\DBAL\ParameterType;
6
use PHPUnit\Framework\TestCase;
7
use Psr\Log\LoggerInterface;
8
use function class_exists;
9
10
class PsrAdapterTest extends TestCase
11
{
12
    public function testLogging()
13
    {
14
        if (! class_exists(LoggerInterface::class)) {
15
            $this->markTestSkipped('PSR-3 LoggerInterface is unavailable');
16
        }
17
18
        $logger = $this->createMock(LoggerInterface::class);
19
        $logger->expects($this->once())
20
            ->method('debug')
21
            ->with('SELECT name FROM users WHERE id = ?', [
22
                'params' => [1],
23
                'types' => [ParameterType::INTEGER],
24
            ]);
25
26
        $adapter = new PsrAdapter($logger);
27
        $adapter->startQuery('SELECT name FROM users WHERE id = ?', [1], [ParameterType::INTEGER]);
28
    }
29
}
30