From 58472a2660734ceff22aa72f704938c3179d7cd1 Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Fri, 25 Jul 2014 08:46:43 +0200 Subject: migration test for sqlite - adding type mapping for 'tinyint unsigned' --- tests/lib/db/migration.php | 39 --------------------------------------- tests/lib/db/mysqlmigration.php | 39 +++++++++++++++++++++++++++++++++++++++ tests/lib/db/sqlitemigration.php | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 39 deletions(-) delete mode 100644 tests/lib/db/migration.php create mode 100644 tests/lib/db/mysqlmigration.php create mode 100644 tests/lib/db/sqlitemigration.php (limited to 'tests') diff --git a/tests/lib/db/migration.php b/tests/lib/db/migration.php deleted file mode 100644 index 820a1431f54..00000000000 --- a/tests/lib/db/migration.php +++ /dev/null @@ -1,39 +0,0 @@ - - * This file is licensed under the Affero General Public License version 3 or - * later. - * See the COPYING-README file. - */ - -class TestMigration extends \PHPUnit_Framework_TestCase { - - /** @var \Doctrine\DBAL\Connection */ - private $connection; - - /** @var string */ - private $tableName; - - public function setUp() { - $this->connection = \OC_DB::getConnection(); - if (!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySqlPlatform) { - $this->markTestSkipped("Test only relevant on MySql"); - } - - $dbPrefix = \OC::$server->getConfig()->getSystemValue("dbtableprefix"); - $this->tableName = uniqid($dbPrefix . "_enum_bit_test"); - $this->connection->exec("CREATE TABLE $this->tableName(b BIT, e ENUM('1','2','3','4'))"); - } - - public function tearDown() { - $this->connection->getSchemaManager()->dropTable($this->tableName); - } - - public function testNonOCTables() { - $manager = new \OC\DB\MDB2SchemaManager($this->connection); - $manager->updateDbFromStructure(__DIR__ . '/testschema.xml'); - - $this->assertTrue(true); - } - -} diff --git a/tests/lib/db/mysqlmigration.php b/tests/lib/db/mysqlmigration.php new file mode 100644 index 00000000000..584df1d4465 --- /dev/null +++ b/tests/lib/db/mysqlmigration.php @@ -0,0 +1,39 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +class TestMySqlMigration extends \PHPUnit_Framework_TestCase { + + /** @var \Doctrine\DBAL\Connection */ + private $connection; + + /** @var string */ + private $tableName; + + public function setUp() { + $this->connection = \OC_DB::getConnection(); + if (!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySqlPlatform) { + $this->markTestSkipped("Test only relevant on MySql"); + } + + $dbPrefix = \OC::$server->getConfig()->getSystemValue("dbtableprefix"); + $this->tableName = uniqid($dbPrefix . "_enum_bit_test"); + $this->connection->exec("CREATE TABLE $this->tableName(b BIT, e ENUM('1','2','3','4'))"); + } + + public function tearDown() { + $this->connection->getSchemaManager()->dropTable($this->tableName); + } + + public function testNonOCTables() { + $manager = new \OC\DB\MDB2SchemaManager($this->connection); + $manager->updateDbFromStructure(__DIR__ . '/testschema.xml'); + + $this->assertTrue(true); + } + +} diff --git a/tests/lib/db/sqlitemigration.php b/tests/lib/db/sqlitemigration.php new file mode 100644 index 00000000000..adfc03a2ca7 --- /dev/null +++ b/tests/lib/db/sqlitemigration.php @@ -0,0 +1,39 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +class TestSqliteMigration extends \PHPUnit_Framework_TestCase { + + /** @var \Doctrine\DBAL\Connection */ + private $connection; + + /** @var string */ + private $tableName; + + public function setUp() { + $this->connection = \OC_DB::getConnection(); + if (!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) { + $this->markTestSkipped("Test only relevant on Sqlite"); + } + + $dbPrefix = \OC::$server->getConfig()->getSystemValue("dbtableprefix"); + $this->tableName = uniqid($dbPrefix . "_enum_bit_test"); + $this->connection->exec("CREATE TABLE $this->tableName(t0 tinyint unsigned, t1 tinyint)"); + } + + public function tearDown() { + $this->connection->getSchemaManager()->dropTable($this->tableName); + } + + public function testNonOCTables() { + $manager = new \OC\DB\MDB2SchemaManager($this->connection); + $manager->updateDbFromStructure(__DIR__ . '/testschema.xml'); + + $this->assertTrue(true); + } + +} -- cgit v1.2.3