Failed Conditions
Push — master ( 30b923...92920e )
by Marco
19s queued 13s
created

Tests/DBAL/Events/MysqlSessionInitTest.php (2 issues)

1
<?php
2
3
namespace Doctrine\Tests\DBAL\Events;
4
5
use Doctrine\DBAL\Connection;
6
use Doctrine\DBAL\Event\ConnectionEventArgs;
7
use Doctrine\DBAL\Event\Listeners\MysqlSessionInit;
8
use Doctrine\DBAL\Events;
9
use Doctrine\Tests\DbalTestCase;
10
11
class MysqlSessionInitTest extends DbalTestCase
12
{
13
    public function testPostConnect()
14
    {
15
        $connectionMock = $this->createMock(Connection::class);
16
        $connectionMock->expects($this->once())
17
                       ->method('executeUpdate')
18
                       ->with($this->equalTo('SET NAMES foo COLLATE bar'));
19
20
        $eventArgs = new ConnectionEventArgs($connectionMock);
21
22
        $listener = new MysqlSessionInit('foo', 'bar');
0 ignored issues
show
Deprecated Code introduced by
The class Doctrine\DBAL\Event\Listeners\MysqlSessionInit has been deprecated: Use "charset" option to PDO MySQL Connection instead. ( Ignorable by Annotation )

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

22
        $listener = /** @scrutinizer ignore-deprecated */ new MysqlSessionInit('foo', 'bar');
Loading history...
23
        $listener->postConnect($eventArgs);
24
    }
25
26
    public function testGetSubscribedEvents()
27
    {
28
        $listener = new MysqlSessionInit();
0 ignored issues
show
Deprecated Code introduced by
The class Doctrine\DBAL\Event\Listeners\MysqlSessionInit has been deprecated: Use "charset" option to PDO MySQL Connection instead. ( Ignorable by Annotation )

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

28
        $listener = /** @scrutinizer ignore-deprecated */ new MysqlSessionInit();
Loading history...
29
        self::assertEquals([Events::postConnect], $listener->getSubscribedEvents());
30
    }
31
}
32