Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / dbal / tests / Doctrine / Tests / DBAL / Sharding / SQLAzure / FunctionalTest.php
1 <?php
2 namespace Doctrine\Tests\DBAL\Sharding\SQLAzure;
3
4 use Doctrine\DBAL\Sharding\SQLAzure\SQLAzureSchemaSynchronizer;
5
6 class FunctionalTest extends AbstractTestCase
7 {
8     public function testSharding()
9     {
10         $schema = $this->createShopSchema();
11
12         $synchronizer = new SQLAzureSchemaSynchronizer($this->conn, $this->sm);
13         $synchronizer->dropAllSchema();
14         $synchronizer->createSchema($schema);
15
16         $this->sm->selectShard(0);
17
18         $this->conn->insert("Products", array(
19             "ProductID" => 1,
20             "SupplierID" => 2,
21             "ProductName" => "Test",
22             "Price" => 10.45
23         ));
24
25         $this->conn->insert("Customers", array(
26             "CustomerID" => 1,
27             "CompanyName" => "Foo",
28             "FirstName" => "Benjamin",
29             "LastName" => "E.",
30         ));
31
32         $query = "SELECT * FROM Products";
33         $data = $this->conn->fetchAll($query);
34         $this->assertTrue(count($data) > 0);
35
36         $query = "SELECT * FROM Customers";
37         $data = $this->conn->fetchAll($query);
38         $this->assertTrue(count($data) > 0);
39
40         $data = $this->sm->queryAll("SELECT * FROM Customers");
41         $this->assertTrue(count($data) > 0);
42     }
43 }
44