Rajout de doctrine/orm
[zf2.biz/application_blanche.git] / vendor / doctrine / dbal / tests / Doctrine / Tests / DBAL / Sharding / SQLAzure / FunctionalTest.php
diff --git a/vendor/doctrine/dbal/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/FunctionalTest.php b/vendor/doctrine/dbal/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/FunctionalTest.php
new file mode 100644 (file)
index 0000000..1051efb
--- /dev/null
@@ -0,0 +1,44 @@
+<?php
+namespace Doctrine\Tests\DBAL\Sharding\SQLAzure;
+
+use Doctrine\DBAL\Sharding\SQLAzure\SQLAzureSchemaSynchronizer;
+
+class FunctionalTest extends AbstractTestCase
+{
+    public function testSharding()
+    {
+        $schema = $this->createShopSchema();
+
+        $synchronizer = new SQLAzureSchemaSynchronizer($this->conn, $this->sm);
+        $synchronizer->dropAllSchema();
+        $synchronizer->createSchema($schema);
+
+        $this->sm->selectShard(0);
+
+        $this->conn->insert("Products", array(
+            "ProductID" => 1,
+            "SupplierID" => 2,
+            "ProductName" => "Test",
+            "Price" => 10.45
+        ));
+
+        $this->conn->insert("Customers", array(
+            "CustomerID" => 1,
+            "CompanyName" => "Foo",
+            "FirstName" => "Benjamin",
+            "LastName" => "E.",
+        ));
+
+        $query = "SELECT * FROM Products";
+        $data = $this->conn->fetchAll($query);
+        $this->assertTrue(count($data) > 0);
+
+        $query = "SELECT * FROM Customers";
+        $data = $this->conn->fetchAll($query);
+        $this->assertTrue(count($data) > 0);
+
+        $data = $this->sm->queryAll("SELECT * FROM Customers");
+        $this->assertTrue(count($data) > 0);
+    }
+}
+