summaryrefslogtreecommitdiffstats
path: root/tests/lib/DB/MigratorTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/DB/MigratorTest.php')
-rw-r--r--tests/lib/DB/MigratorTest.php53
1 files changed, 0 insertions, 53 deletions
diff --git a/tests/lib/DB/MigratorTest.php b/tests/lib/DB/MigratorTest.php
index 6b758534897..12ff3bd0749 100644
--- a/tests/lib/DB/MigratorTest.php
+++ b/tests/lib/DB/MigratorTest.php
@@ -15,7 +15,6 @@ use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\SchemaConfig;
-use OC\DB\SchemaWrapper;
use OCP\IConfig;
/**
@@ -131,58 +130,6 @@ class MigratorTest extends \Test\TestCase {
return $this->connection->getDatabasePlatform() instanceof MySQLPlatform;
}
-
- public function testDuplicateKeyUpgrade() {
- $this->expectException(Exception\UniqueConstraintViolationException::class);
-
- if ($this->isSQLite()) {
- $this->markTestSkipped('sqlite does not throw errors when creating a new key on existing data');
- }
- [$startSchema, $endSchema] = $this->getDuplicateKeySchemas();
- $migrator = $this->manager->getMigrator();
- $migrator->migrate($startSchema);
-
- $this->connection->insert($this->tableName, ['id' => 1, 'name' => 'foo']);
- $this->connection->insert($this->tableName, ['id' => 2, 'name' => 'bar']);
- $this->connection->insert($this->tableName, ['id' => 2, 'name' => 'qwerty']);
-
- try {
- $migrator->migrate($endSchema);
- } catch (Exception\UniqueConstraintViolationException $e) {
- if (!$this->isMySQL()) {
- $this->connection->rollBack();
- }
- throw $e;
- }
- }
-
- public function testChangeToString() {
- [$startSchema, $endSchema] = $this->getChangedTypeSchema('integer', 'string');
- $migrator = $this->manager->getMigrator();
- $migrator->migrate($startSchema);
- $schema = new SchemaWrapper($this->connection);
- $table = $schema->getTable(substr($this->tableName, 3));
- $this->assertEquals('integer', $table->getColumn('id')->getType()->getName());
-
- $this->connection->insert($this->tableName, ['id' => 1, 'name' => 'foo']);
- $this->connection->insert($this->tableName, ['id' => 2, 'name' => 'bar']);
- $this->connection->insert($this->tableName, ['id' => 3, 'name' => 'qwerty']);
-
- $migrator->migrate($endSchema);
- $this->addToAssertionCount(1);
-
- $qb = $this->connection->getQueryBuilder();
- $result = $qb->select('*')->from(substr($this->tableName, 3))->execute();
- $this->assertEquals([
- ['id' => 1, 'name' => 'foo'],
- ['id' => 2, 'name' => 'bar'],
- ['id' => 3, 'name' => 'qwerty']
- ], $result->fetchAll());
- $schema = new SchemaWrapper($this->connection);
- $table = $schema->getTable(substr($this->tableName, 3));
- $this->assertEquals('string', $table->getColumn('id')->getType()->getName());
- }
-
public function testUpgrade() {
[$startSchema, $endSchema] = $this->getDuplicateKeySchemas();
$migrator = $this->manager->getMigrator();