Przeglądaj źródła

Rename the method to match what it does

Signed-off-by: Joas Schilling <coding@schilljs.com>
tags/v22.0.0beta1
Joas Schilling 3 lat temu
rodzic
commit
f9d4fa2d38
No account linked to committer's email address
2 zmienionych plików z 25 dodań i 25 usunięć
  1. 3
    3
      lib/private/DB/MigrationService.php
  2. 22
    22
      tests/lib/DB/MigrationsTest.php

+ 3
- 3
lib/private/DB/MigrationService.php Wyświetl plik

@@ -459,7 +459,7 @@ class MigrationService {
$targetSchema = $toSchema->getWrappedSchema();
if ($this->checkOracle) {
$beforeSchema = $this->connection->createSchema();
$this->ensureOracleIdentifierLengthLimit($beforeSchema, $targetSchema, strlen($this->connection->getPrefix()));
$this->ensureOracleConstraints($beforeSchema, $targetSchema, strlen($this->connection->getPrefix()));
}
$this->connection->migrateToSchema($targetSchema);
$toSchema->performDropTableCalls();
@@ -536,7 +536,7 @@ class MigrationService {
$targetSchema = $toSchema->getWrappedSchema();
if ($this->checkOracle) {
$sourceSchema = $this->connection->createSchema();
$this->ensureOracleIdentifierLengthLimit($sourceSchema, $targetSchema, strlen($this->connection->getPrefix()));
$this->ensureOracleConstraints($sourceSchema, $targetSchema, strlen($this->connection->getPrefix()));
}
$this->connection->migrateToSchema($targetSchema);
$toSchema->performDropTableCalls();
@@ -569,7 +569,7 @@ class MigrationService {
* @param int $prefixLength
* @throws \Doctrine\DBAL\Exception
*/
public function ensureOracleIdentifierLengthLimit(Schema $sourceSchema, Schema $targetSchema, int $prefixLength) {
public function ensureOracleConstraints(Schema $sourceSchema, Schema $targetSchema, int $prefixLength) {
$sequences = $targetSchema->getSequences();

foreach ($targetSchema->getTables() as $table) {

+ 22
- 22
tests/lib/DB/MigrationsTest.php Wyświetl plik

@@ -220,7 +220,7 @@ class MigrationsTest extends \Test\TestCase {
$this->migrationService->migrate();
}

public function testEnsureOracleIdentifierLengthLimitValid() {
public function testEnsureOracleConstraintsValid() {
$column = $this->createMock(Column::class);
$column->expects($this->once())
->method('getName')
@@ -275,10 +275,10 @@ class MigrationsTest extends \Test\TestCase {
->method('hasSequence')
->willReturn(false);

self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
self::invokePrivate($this->migrationService, 'ensureOracleConstraints', [$sourceSchema, $schema, 3]);
}

public function testEnsureOracleIdentifierLengthLimitValidWithPrimaryKey() {
public function testEnsureOracleConstraintsValidWithPrimaryKey() {
$index = $this->createMock(Index::class);
$index->expects($this->any())
->method('getName')
@@ -318,10 +318,10 @@ class MigrationsTest extends \Test\TestCase {
->method('hasSequence')
->willReturn(false);

self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
self::invokePrivate($this->migrationService, 'ensureOracleConstraints', [$sourceSchema, $schema, 3]);
}

public function testEnsureOracleIdentifierLengthLimitValidWithPrimaryKeyDefault() {
public function testEnsureOracleConstraintsValidWithPrimaryKeyDefault() {
$defaultName = 'PRIMARY';
if ($this->db->getDatabasePlatform() instanceof PostgreSqlPlatform) {
$defaultName = \str_repeat('a', 26) . '_' . \str_repeat('b', 30) . '_seq';
@@ -371,11 +371,11 @@ class MigrationsTest extends \Test\TestCase {
->method('hasSequence')
->willReturn(false);

self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
self::invokePrivate($this->migrationService, 'ensureOracleConstraints', [$sourceSchema, $schema, 3]);
}


public function testEnsureOracleIdentifierLengthLimitTooLongTableName() {
public function testEnsureOracleConstraintsTooLongTableName() {
$this->expectException(\InvalidArgumentException::class);

$table = $this->createMock(Table::class);
@@ -396,11 +396,11 @@ class MigrationsTest extends \Test\TestCase {
->method('hasSequence')
->willReturn(false);

self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
self::invokePrivate($this->migrationService, 'ensureOracleConstraints', [$sourceSchema, $schema, 3]);
}


public function testEnsureOracleIdentifierLengthLimitTooLongPrimaryWithDefault() {
public function testEnsureOracleConstraintsTooLongPrimaryWithDefault() {
$this->expectException(\InvalidArgumentException::class);

$defaultName = 'PRIMARY';
@@ -449,11 +449,11 @@ class MigrationsTest extends \Test\TestCase {
->method('hasSequence')
->willReturn(false);

self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
self::invokePrivate($this->migrationService, 'ensureOracleConstraints', [$sourceSchema, $schema, 3]);
}


public function testEnsureOracleIdentifierLengthLimitTooLongPrimaryWithName() {
public function testEnsureOracleConstraintsTooLongPrimaryWithName() {
$this->expectException(\InvalidArgumentException::class);

$index = $this->createMock(Index::class);
@@ -492,11 +492,11 @@ class MigrationsTest extends \Test\TestCase {
->method('hasSequence')
->willReturn(false);

self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
self::invokePrivate($this->migrationService, 'ensureOracleConstraints', [$sourceSchema, $schema, 3]);
}


public function testEnsureOracleIdentifierLengthLimitTooLongColumnName() {
public function testEnsureOracleConstraintsTooLongColumnName() {
$this->expectException(\InvalidArgumentException::class);

$column = $this->createMock(Column::class);
@@ -526,11 +526,11 @@ class MigrationsTest extends \Test\TestCase {
->method('hasSequence')
->willReturn(false);

self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
self::invokePrivate($this->migrationService, 'ensureOracleConstraints', [$sourceSchema, $schema, 3]);
}


public function testEnsureOracleIdentifierLengthLimitTooLongIndexName() {
public function testEnsureOracleConstraintsTooLongIndexName() {
$this->expectException(\InvalidArgumentException::class);

$index = $this->createMock(Index::class);
@@ -563,11 +563,11 @@ class MigrationsTest extends \Test\TestCase {
->method('hasSequence')
->willReturn(false);

self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
self::invokePrivate($this->migrationService, 'ensureOracleConstraints', [$sourceSchema, $schema, 3]);
}


public function testEnsureOracleIdentifierLengthLimitTooLongForeignKeyName() {
public function testEnsureOracleConstraintsTooLongForeignKeyName() {
$this->expectException(\InvalidArgumentException::class);

$foreignKey = $this->createMock(ForeignKeyConstraint::class);
@@ -603,11 +603,11 @@ class MigrationsTest extends \Test\TestCase {
->method('hasSequence')
->willReturn(false);

self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
self::invokePrivate($this->migrationService, 'ensureOracleConstraints', [$sourceSchema, $schema, 3]);
}


public function testEnsureOracleIdentifierLengthLimitTooLongSequenceName() {
public function testEnsureOracleConstraintsTooLongSequenceName() {
$this->expectException(\InvalidArgumentException::class);

$sequence = $this->createMock(Sequence::class);
@@ -631,11 +631,11 @@ class MigrationsTest extends \Test\TestCase {
->method('hasSequence')
->willReturn(false);

self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
self::invokePrivate($this->migrationService, 'ensureOracleConstraints', [$sourceSchema, $schema, 3]);
}


public function testEnsureOracleIdentifierLengthLimitBooleanNotNull() {
public function testEnsureOracleConstraintsBooleanNotNull() {
$this->expectException(\InvalidArgumentException::class);

$column = $this->createMock(Column::class);
@@ -671,6 +671,6 @@ class MigrationsTest extends \Test\TestCase {
->method('hasSequence')
->willReturn(false);

self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
self::invokePrivate($this->migrationService, 'ensureOracleConstraints', [$sourceSchema, $schema, 3]);
}
}

Ładowanie…
Anuluj
Zapisz