MySqlMigrationTest.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 MySqlMigration
  11. *
  12. * @group DB
  13. */
  14. class MySqlMigrationTest 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\MySqlPlatform) {
  23. $this->markTestSkipped("Test only relevant on MySql");
  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(b BIT, e ENUM('1','2','3','4'))");
  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->assertTrue(true);
  37. }
  38. }