SqliteMigrationTest.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. namespace Test\DB;
  9. /**
  10. * Class SqliteMigration
  11. *
  12. * @group DB
  13. */
  14. class SqliteMigrationTest extends \Test\TestCase {
  15. /** @var \Doctrine\DBAL\Connection */
  16. private $connection;
  17. /** @var string */
  18. private $tableName;
  19. protected function setUp() {
  20. parent::setUp();
  21. $this->connection = \OC::$server->getDatabaseConnection();
  22. if (!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) {
  23. $this->markTestSkipped("Test only relevant on Sqlite");
  24. }
  25. $dbPrefix = \OC::$server->getConfig()->getSystemValue("dbtableprefix");
  26. $this->tableName = $this->getUniqueID($dbPrefix . '_enum_bit_test');
  27. $this->connection->exec("CREATE TABLE $this->tableName(t0 tinyint unsigned, t1 tinyint)");
  28. }
  29. protected function tearDown() {
  30. $this->connection->getSchemaManager()->dropTable($this->tableName);
  31. parent::tearDown();
  32. }
  33. public function testNonOCTables() {
  34. $manager = new \OC\DB\MDB2SchemaManager($this->connection);
  35. $manager->updateDbFromStructure(__DIR__ . '/testschema.xml');
  36. $this->addToAssertionCount(1);
  37. }
  38. }