Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / dbal / tests / Doctrine / Tests / DBAL / Events / SQLSessionInitTest.php
1 <?php
2
3 namespace Doctrine\Tests\DBAL\Events;
4
5 use Doctrine\Tests\DbalTestCase;
6 use Doctrine\DBAL\Event\Listeners\SQLSessionInit;
7 use Doctrine\DBAL\Event\ConnectionEventArgs;
8 use Doctrine\DBAL\Events;
9
10 require_once __DIR__ . '/../../TestInit.php';
11
12 /**
13  * @group DBAL-169
14  */
15 class SQLSessionInitTest extends DbalTestCase
16 {
17     public function testPostConnect()
18     {
19         $connectionMock = $this->getMock('Doctrine\DBAL\Connection', array(), array(), '', false);
20         $connectionMock->expects($this->once())
21                        ->method('exec')
22                        ->with($this->equalTo("SET SEARCH_PATH TO foo, public, TIMEZONE TO 'Europe/Berlin'"));
23
24         $eventArgs = new ConnectionEventArgs($connectionMock);
25
26         $listener = new SQLSessionInit("SET SEARCH_PATH TO foo, public, TIMEZONE TO 'Europe/Berlin'");
27         $listener->postConnect($eventArgs);
28     }
29
30     public function testGetSubscribedEvents()
31     {
32         $listener = new SQLSessionInit("SET SEARCH_PATH TO foo, public, TIMEZONE TO 'Europe/Berlin'");
33         $this->assertEquals(array(Events::postConnect), $listener->getSubscribedEvents());
34     }
35 }