sqlitemigration.php 1.2 KB

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