diff options
author | Joas Schilling <coding@schilljs.com> | 2022-03-23 15:04:18 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-03-25 12:44:51 +0100 |
commit | 129bae62d42d58166f51d8f7167b00b4761d60c5 (patch) | |
tree | 5697ac7f02294a3ffbfbc94474dc64ff79596b20 /tests | |
parent | c407bb978684f00ce07a4f168d3e380da3812028 (diff) | |
download | nextcloud-server-129bae62d42d58166f51d8f7167b00b4761d60c5.tar.gz nextcloud-server-129bae62d42d58166f51d8f7167b00b4761d60c5.zip |
Ensure string column limit of 4.000 characters
https://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/datatype-limits.html#GUID-963C79C9-9303-49FE-8F2D-C8AAF04D3095
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/DB/MigrationsTest.php | 40 |
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]); + } } |