Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/DB/MigrationsTest.php')
-rw-r--r--tests/lib/DB/MigrationsTest.php68
1 files changed, 34 insertions, 34 deletions
diff --git a/tests/lib/DB/MigrationsTest.php b/tests/lib/DB/MigrationsTest.php
index 8f38b3addd0..58f775febb0 100644
--- a/tests/lib/DB/MigrationsTest.php
+++ b/tests/lib/DB/MigrationsTest.php
@@ -36,7 +36,7 @@ class MigrationsTest extends \Test\TestCase {
/** @var \PHPUnit_Framework_MockObject_MockObject | IDBConnection $db */
private $db;
- public function setUp(): void {
+ protected function setUp(): void {
parent::setUp();
$this->db = $this->createMock(Connection::class);
@@ -60,27 +60,27 @@ class MigrationsTest extends \Test\TestCase {
$this->assertEquals('test_oc_migrations', $this->migrationService->getMigrationsTableName());
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Version 20170130180000 is unknown.
- */
+
public function testExecuteUnknownStep() {
+ $this->expectException(\InvalidArgumentException::class);
+ $this->expectExceptionMessage('Version 20170130180000 is unknown.');
+
$this->migrationService->executeStep('20170130180000');
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage App not found
- */
+
public function testUnknownApp() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('App not found');
+
$migrationService = new MigrationService('unknown-bloody-app', $this->db);
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage Migration step 'X' is unknown
- */
+
public function testExecuteStepWithUnknownClass() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('Migration step \'X\' is unknown');
+
$this->migrationService = $this->getMockBuilder(MigrationService::class)
->setMethods(['findMigrations'])
->setConstructorArgs(['testing', $this->db])
@@ -375,10 +375,10 @@ class MigrationsTest extends \Test\TestCase {
self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
}
- /**
- * @expectedException \InvalidArgumentException
- */
+
public function testEnsureOracleIdentifierLengthLimitTooLongTableName() {
+ $this->expectException(\InvalidArgumentException::class);
+
$table = $this->createMock(Table::class);
$table->expects($this->any())
->method('getName')
@@ -400,10 +400,10 @@ class MigrationsTest extends \Test\TestCase {
self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
}
- /**
- * @expectedException \InvalidArgumentException
- */
+
public function testEnsureOracleIdentifierLengthLimitTooLongPrimaryWithDefault() {
+ $this->expectException(\InvalidArgumentException::class);
+
$defaultName = 'PRIMARY';
if ($this->db->getDatabasePlatform() instanceof PostgreSqlPlatform) {
$defaultName = \str_repeat('a', 27) . '_' . \str_repeat('b', 30) . '_seq';
@@ -453,10 +453,10 @@ class MigrationsTest extends \Test\TestCase {
self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
}
- /**
- * @expectedException \InvalidArgumentException
- */
+
public function testEnsureOracleIdentifierLengthLimitTooLongPrimaryWithName() {
+ $this->expectException(\InvalidArgumentException::class);
+
$index = $this->createMock(Index::class);
$index->expects($this->any())
->method('getName')
@@ -496,10 +496,10 @@ class MigrationsTest extends \Test\TestCase {
self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
}
- /**
- * @expectedException \InvalidArgumentException
- */
+
public function testEnsureOracleIdentifierLengthLimitTooLongColumnName() {
+ $this->expectException(\InvalidArgumentException::class);
+
$column = $this->createMock(Column::class);
$column->expects($this->any())
->method('getName')
@@ -530,10 +530,10 @@ class MigrationsTest extends \Test\TestCase {
self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
}
- /**
- * @expectedException \InvalidArgumentException
- */
+
public function testEnsureOracleIdentifierLengthLimitTooLongIndexName() {
+ $this->expectException(\InvalidArgumentException::class);
+
$index = $this->createMock(Index::class);
$index->expects($this->any())
->method('getName')
@@ -567,10 +567,10 @@ class MigrationsTest extends \Test\TestCase {
self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
}
- /**
- * @expectedException \InvalidArgumentException
- */
+
public function testEnsureOracleIdentifierLengthLimitTooLongForeignKeyName() {
+ $this->expectException(\InvalidArgumentException::class);
+
$foreignKey = $this->createMock(ForeignKeyConstraint::class);
$foreignKey->expects($this->any())
->method('getName')
@@ -607,10 +607,10 @@ class MigrationsTest extends \Test\TestCase {
self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
}
- /**
- * @expectedException \InvalidArgumentException
- */
+
public function testEnsureOracleIdentifierLengthLimitTooLongSequenceName() {
+ $this->expectException(\InvalidArgumentException::class);
+
$sequence = $this->createMock(Sequence::class);
$sequence->expects($this->any())
->method('getName')