Rajout de doctrine/orm
[zf2.biz/application_blanche.git] / vendor / doctrine / dbal / tests / Doctrine / Tests / Mocks / DriverMock.php
diff --git a/vendor/doctrine/dbal/tests/Doctrine/Tests/Mocks/DriverMock.php b/vendor/doctrine/dbal/tests/Doctrine/Tests/Mocks/DriverMock.php
new file mode 100644 (file)
index 0000000..c60a137
--- /dev/null
@@ -0,0 +1,72 @@
+<?php
+
+namespace Doctrine\Tests\Mocks;
+
+
+class DriverMock implements \Doctrine\DBAL\Driver
+{
+    private $_platformMock;
+
+    private $_schemaManagerMock;
+
+    public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
+    {
+        return new DriverConnectionMock();
+    }
+
+    /**
+     * Constructs the Sqlite PDO DSN.
+     *
+     * @return string  The DSN.
+     * @override
+     */
+    protected function _constructPdoDsn(array $params)
+    {
+        return "";
+    }
+
+    /**
+     * @override
+     */
+    public function getDatabasePlatform()
+    {
+        if ( ! $this->_platformMock) {
+            $this->_platformMock = new DatabasePlatformMock;
+        }
+        return $this->_platformMock;
+    }
+
+    /**
+     * @override
+     */
+    public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
+    {
+        if($this->_schemaManagerMock == null) {
+            return new SchemaManagerMock($conn);
+        } else {
+            return $this->_schemaManagerMock;
+        }
+    }
+
+    /* MOCK API */
+
+    public function setDatabasePlatform(\Doctrine\DBAL\Platforms\AbstractPlatform $platform)
+    {
+        $this->_platformMock = $platform;
+    }
+
+    public function setSchemaManager(\Doctrine\DBAL\Schema\AbstractSchemaManager $sm)
+    {
+        $this->_schemaManagerMock = $sm;
+    }
+
+    public function getName()
+    {
+        return 'mock';
+    }
+
+    public function getDatabase(\Doctrine\DBAL\Connection $conn)
+    {
+        return;
+    }
+}
\ No newline at end of file