summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorCôme Chilliet <91878298+come-nc@users.noreply.github.com>2022-03-31 11:37:43 +0200
committerGitHub <noreply@github.com>2022-03-31 11:37:43 +0200
commitdd357d7f9b4f40e8d3f5cd5dfe2aa37663c049b1 (patch)
treebdab6a65b28f4bd83a47ca86a480902c4bfaeaa5 /tests
parentf5485489248d410859048b950ffb5824ae457552 (diff)
parentddfa2f221ec454447f607c5b0fd3034b5f5a2d85 (diff)
downloadnextcloud-server-dd357d7f9b4f40e8d3f5cd5dfe2aa37663c049b1.tar.gz
nextcloud-server-dd357d7f9b4f40e8d3f5cd5dfe2aa37663c049b1.zip
Merge pull request #31679 from nextcloud/bugfix/noid/ensure-string-columns-to-be-maximum-of-4000
Ensure string column limit of 4.000 characters
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/DB/MigrationsTest.php40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/lib/DB/MigrationsTest.php b/tests/lib/DB/MigrationsTest.php
index b00b094b4aa..206fe1a3798 100644
--- a/tests/lib/DB/MigrationsTest.php
+++ b/tests/lib/DB/MigrationsTest.php
@@ -716,4 +716,44 @@ class MigrationsTest extends \Test\TestCase {
self::invokePrivate($this->migrationService, 'ensureOracleConstraints', [$sourceSchema, $schema, 3]);
}
+
+
+ public function testEnsureOracleConstraintsStringLength4000() {
+ $this->expectException(\InvalidArgumentException::class);
+
+ $column = $this->createMock(Column::class);
+ $column->expects($this->any())
+ ->method('getName')
+ ->willReturn('aaaa');
+ $column->expects($this->any())
+ ->method('getType')
+ ->willReturn(Type::getType('string'));
+ $column->expects($this->any())
+ ->method('getLength')
+ ->willReturn(4001);
+
+ $table = $this->createMock(Table::class);
+ $table->expects($this->any())
+ ->method('getName')
+ ->willReturn(\str_repeat('a', 30));
+
+ $table->expects($this->once())
+ ->method('getColumns')
+ ->willReturn([$column]);
+
+ $schema = $this->createMock(Schema::class);
+ $schema->expects($this->once())
+ ->method('getTables')
+ ->willReturn([$table]);
+
+ $sourceSchema = $this->createMock(Schema::class);
+ $sourceSchema->expects($this->any())
+ ->method('getTable')
+ ->willThrowException(new SchemaException());
+ $sourceSchema->expects($this->any())
+ ->method('hasSequence')
+ ->willReturn(false);
+
+ self::invokePrivate($this->migrationService, 'ensureOracleConstraints', [$sourceSchema, $schema, 3]);
+ }
}