Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / dbal / tests / Doctrine / Tests / DBAL / Functional / Ticket / DBAL202Test.php
1 <?php
2
3 namespace Doctrine\Tests\DBAL\Functional\Ticket;
4
5 /**
6  * @group DBAL-202
7  */
8 class DBAL202Test extends \Doctrine\Tests\DbalFunctionalTestCase
9 {
10     protected function setUp()
11     {
12         parent::setUp();
13
14         if ($this->_conn->getDatabasePlatform()->getName() != 'oracle') {
15             $this->markTestSkipped('OCI8 only test');
16         }
17
18         if ($this->_conn->getSchemaManager()->tablesExist('DBAL202')) {
19             $this->_conn->executeQuery('DELETE FROM DBAL202');
20         } else {
21             $table = new \Doctrine\DBAL\Schema\Table('DBAL202');
22             $table->addColumn('id', 'integer');
23             $table->setPrimaryKey(array('id'));
24
25             $this->_conn->getSchemaManager()->createTable($table);
26         }
27     }
28
29     public function testStatementRollback()
30     {
31         $stmt = $this->_conn->prepare('INSERT INTO DBAL202 VALUES (8)');
32         $this->_conn->beginTransaction();
33         $stmt->execute();
34         $this->_conn->rollback();
35
36         $this->assertEquals(0, $this->_conn->query('SELECT COUNT(1) FROM DBAL202')->fetchColumn());
37     }
38
39     public function testStatementCommit()
40     {
41         $stmt = $this->_conn->prepare('INSERT INTO DBAL202 VALUES (8)');
42         $this->_conn->beginTransaction();
43         $stmt->execute();
44         $this->_conn->commit();
45
46         $this->assertEquals(1, $this->_conn->query('SELECT COUNT(1) FROM DBAL202')->fetchColumn());
47     }
48 }