1
0

MySqlMigrationTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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(): void {
  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(): void {
  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. }