Rajout de doctrine/orm
[zf2.biz/application_blanche.git] / vendor / doctrine / dbal / tests / Doctrine / Tests / DBAL / Events / MysqlSessionInitTest.php
diff --git a/vendor/doctrine/dbal/tests/Doctrine/Tests/DBAL/Events/MysqlSessionInitTest.php b/vendor/doctrine/dbal/tests/Doctrine/Tests/DBAL/Events/MysqlSessionInitTest.php
new file mode 100644 (file)
index 0000000..1ef47dd
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+
+namespace Doctrine\Tests\DBAL\Events;
+
+use Doctrine\Tests\DbalTestCase;
+use Doctrine\DBAL\Event\Listeners\MysqlSessionInit;
+use Doctrine\DBAL\Event\ConnectionEventArgs;
+use Doctrine\DBAL\Events;
+
+require_once __DIR__ . '/../../TestInit.php';
+
+class MysqlSessionInitTest extends DbalTestCase
+{
+    public function testPostConnect()
+    {
+        $connectionMock = $this->getMock('Doctrine\DBAL\Connection', array(), array(), '', false);
+        $connectionMock->expects($this->once())
+                       ->method('executeUpdate')
+                       ->with($this->equalTo("SET NAMES foo COLLATE bar"));
+
+        $eventArgs = new ConnectionEventArgs($connectionMock);
+
+
+        $listener = new MysqlSessionInit('foo', 'bar');
+        $listener->postConnect($eventArgs);
+    }
+
+    public function testGetSubscribedEvents()
+    {
+        $listener = new MysqlSessionInit();
+        $this->assertEquals(array(Events::postConnect), $listener->getSubscribedEvents());
+    }
+}
\ No newline at end of file