sqlitemigration.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * Copyright (c) 2014 Thomas Müller <deepdiver@owncloud.com>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. class TestSqliteMigration extends \Test\TestCase {
  9. /** @var \Doctrine\DBAL\Connection */
  10. private $connection;
  11. /** @var string */
  12. private $tableName;
  13. protected function setUp() {
  14. parent::setUp();
  15. $this->connection = \OC_DB::getConnection();
  16. if (!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) {
  17. $this->markTestSkipped("Test only relevant on Sqlite");
  18. }
  19. $dbPrefix = \OC::$server->getConfig()->getSystemValue("dbtableprefix");
  20. $this->tableName = $this->getUniqueID($dbPrefix . '_enum_bit_test');
  21. $this->connection->exec("CREATE TABLE $this->tableName(t0 tinyint unsigned, t1 tinyint)");
  22. }
  23. protected function tearDown() {
  24. $this->connection->getSchemaManager()->dropTable($this->tableName);
  25. parent::tearDown();
  26. }
  27. public function testNonOCTables() {
  28. $manager = new \OC\DB\MDB2SchemaManager($this->connection);
  29. $manager->updateDbFromStructure(__DIR__ . '/testschema.xml');
  30. $this->assertTrue(true);
  31. }
  32. }