Skip to content

Commit

Permalink
Merge pull request #5540 from doctrine/3.3.x
Browse files Browse the repository at this point in the history
Merge 3.3.x into 3.4.x
  • Loading branch information
morozov committed Jul 28, 2022
2 parents 3ae5312 + de42378 commit d6aaae9
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 23 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/lock-closed-issues.yml
@@ -0,0 +1,18 @@
name: Lock Closed Issues

on:
schedule:
- cron: 0 0 * * *

jobs:
lock:
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v3
with:
github-token: '${{ github.token }}'
issue-inactive-days: 30
issue-comment: >
This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -42,8 +42,8 @@
"require-dev": {
"doctrine/coding-standard": "9.0.0",
"jetbrains/phpstorm-stubs": "2022.1",
"phpstan/phpstan": "1.7.15",
"phpstan/phpstan-strict-rules": "^1.2",
"phpstan/phpstan": "1.8.2",
"phpstan/phpstan-strict-rules": "^1.3",
"phpunit/phpunit": "9.5.21",
"psalm/plugin-phpunit": "0.17.0",
"squizlabs/php_codesniffer": "3.7.1",
Expand Down
5 changes: 0 additions & 5 deletions phpstan.neon.dist
Expand Up @@ -14,11 +14,6 @@ parameters:
# some drivers actually do accept 2nd parameter...
- '~^Method Doctrine\\DBAL\\Platforms\\AbstractPlatform::getListTableForeignKeysSQL\(\) invoked with \d+ parameters, 1 required\.\z~'

# https://github.com/phpstan/phpstan/issues/3134
-
message: '~^Call to static method PHPUnit\\Framework\\Assert::assertSame\(\) with Doctrine\\DBAL\\Types\\Type and Doctrine\\DBAL\\Types\\Type will always evaluate to true\.$~'
path: tests/Types/TypeRegistryTest.php

# https://github.com/phpstan/phpstan-strict-rules/issues/103
-
message: '~^Construct empty\(\) is not allowed. Use more strict comparison\.~'
Expand Down
Expand Up @@ -8,8 +8,6 @@
use Doctrine\DBAL\Schema\Comparator;
use Doctrine\DBAL\Tests\FunctionalTestCase;

use function count;

final class NewPrimaryKeyWithNewAutoIncrementColumnTest extends FunctionalTestCase
{
protected function setUp(): void
Expand Down Expand Up @@ -63,7 +61,7 @@ public function testAlterPrimaryKeyToAutoIncrementColumn(callable $comparatorFac
self::assertTrue($validationTable->hasColumn('new_id'));
self::assertTrue($validationTable->getColumn('new_id')->getAutoincrement());
self::assertTrue($validationTable->hasPrimaryKey());
self::assertEquals(1, count($validationTable->getPrimaryKeyColumns()));
self::assertCount(1, $validationTable->getPrimaryKeyColumns());
self::assertArrayHasKey('new_id', $validationTable->getPrimaryKeyColumns());
}

Expand Down
26 changes: 13 additions & 13 deletions tests/Functional/Schema/SchemaManagerFunctionalTestCase.php
Expand Up @@ -461,7 +461,7 @@ public function testListTableIndexes(): void

$tableIndexes = $this->schemaManager->listTableIndexes('list_table_indexes_test');

self::assertEquals(3, count($tableIndexes));
self::assertCount(3, $tableIndexes);

self::assertArrayHasKey('primary', $tableIndexes, 'listTableIndexes() has to return a "primary" array key.');
self::assertEquals(['id', 'other_id'], array_map('strtolower', $tableIndexes['primary']->getColumns()));
Expand Down Expand Up @@ -537,7 +537,7 @@ public function testCreateTableWithForeignKeys(): void

$fkTable = $this->schemaManager->listTableDetails('test_create_fk');
$fkConstraints = $fkTable->getForeignKeys();
self::assertEquals(1, count($fkConstraints), "Table 'test_create_fk1' has to have one foreign key.");
self::assertCount(1, $fkConstraints, "Table 'test_create_fk' has to have one foreign key.");

$fkConstraint = current($fkConstraints);
self::assertInstanceOf(ForeignKeyConstraint::class, $fkConstraint);
Expand Down Expand Up @@ -565,7 +565,7 @@ public function testListForeignKeys(): void

$fkeys = $this->schemaManager->listTableForeignKeys('test_create_fk1');

self::assertEquals(1, count($fkeys), "Table 'test_create_fk1' has to have one foreign key.");
self::assertCount(1, $fkeys, "Table 'test_create_fk1' has to have one foreign key.");

self::assertInstanceOf(ForeignKeyConstraint::class, $fkeys[0]);
self::assertEquals(['foreign_key_test'], array_map('strtolower', $fkeys[0]->getLocalColumns()));
Expand Down Expand Up @@ -659,8 +659,8 @@ public function testAlterTableScenario(): void
self::assertTrue($table->hasColumn('id'));
self::assertTrue($table->hasColumn('test'));
self::assertTrue($table->hasColumn('foreign_key_test'));
self::assertEquals(0, count($table->getForeignKeys()));
self::assertEquals(1, count($table->getIndexes()));
self::assertCount(0, $table->getForeignKeys());
self::assertCount(1, $table->getIndexes());

$tableDiff = new TableDiff('alter_table');
$tableDiff->fromTable = $alterTable;
Expand All @@ -680,7 +680,7 @@ public function testAlterTableScenario(): void
$this->schemaManager->alterTable($tableDiff);

$table = $this->schemaManager->listTableDetails('alter_table');
self::assertEquals(2, count($table->getIndexes()));
self::assertCount(2, $table->getIndexes());
self::assertTrue($table->hasIndex('foo_idx'));
self::assertEquals(['foo'], array_map('strtolower', $table->getIndex('foo_idx')->getColumns()));
self::assertFalse($table->getIndex('foo_idx')->isPrimary());
Expand All @@ -693,7 +693,7 @@ public function testAlterTableScenario(): void
$this->schemaManager->alterTable($tableDiff);

$table = $this->schemaManager->listTableDetails('alter_table');
self::assertEquals(2, count($table->getIndexes()));
self::assertCount(2, $table->getIndexes());
self::assertTrue($table->hasIndex('foo_idx'));
self::assertEquals(
['foo', 'foreign_key_test'],
Expand All @@ -707,7 +707,7 @@ public function testAlterTableScenario(): void
$this->schemaManager->alterTable($tableDiff);

$table = $this->schemaManager->listTableDetails('alter_table');
self::assertEquals(2, count($table->getIndexes()));
self::assertCount(2, $table->getIndexes());
self::assertTrue($table->hasIndex('bar_idx'));
self::assertFalse($table->hasIndex('foo_idx'));
self::assertEquals(
Expand Down Expand Up @@ -930,7 +930,7 @@ public function testGetColumnComment(): void
$this->schemaManager->createTable($table);

$columns = $this->schemaManager->listTableColumns('column_comment_test');
self::assertEquals(1, count($columns));
self::assertCount(1, $columns);
self::assertEquals('This is a comment', $columns['id']->getComment());

$tableDiff = new TableDiff('column_comment_test');
Expand All @@ -952,7 +952,7 @@ public function testGetColumnComment(): void
$this->schemaManager->alterTable($tableDiff);

$columns = $this->schemaManager->listTableColumns('column_comment_test');
self::assertEquals(1, count($columns));
self::assertCount(1, $columns);
self::assertEmpty($columns['id']->getComment());
}

Expand All @@ -977,7 +977,7 @@ public function testAutomaticallyAppendCommentOnMarkedColumns(): void
$this->schemaManager->createTable($table);

$columns = $this->schemaManager->listTableColumns('column_comment_test2');
self::assertEquals(3, count($columns));
self::assertCount(3, $columns);
self::assertEquals('This is a comment', $columns['id']->getComment());
self::assertEquals('This is a comment', $columns['obj']->getComment());
self::assertInstanceOf(ObjectType::class, $columns['obj']->getType());
Expand Down Expand Up @@ -1005,7 +1005,7 @@ public function testCommentHintOnDateIntervalTypeColumn(): void
$this->schemaManager->createTable($table);

$columns = $this->schemaManager->listTableColumns('column_dateinterval_comment');
self::assertEquals(2, count($columns));
self::assertCount(2, $columns);
self::assertEquals('This is a comment', $columns['id']->getComment());
self::assertEquals('This is a comment', $columns['date_interval']->getComment());
self::assertInstanceOf(DateIntervalType::class, $columns['date_interval']->getType());
Expand Down Expand Up @@ -1136,7 +1136,7 @@ public function testListForeignKeysComposite(): void

$fkeys = $this->schemaManager->listTableForeignKeys('test_create_fk3');

self::assertEquals(1, count($fkeys), "Table 'test_create_fk3' has to have one foreign key.");
self::assertCount(1, $fkeys, "Table 'test_create_fk3' has to have one foreign key.");

self::assertInstanceOf(ForeignKeyConstraint::class, $fkeys[0]);
self::assertEquals(['id', 'foreign_key_test'], array_map('strtolower', $fkeys[0]->getLocalColumns()));
Expand Down

0 comments on commit d6aaae9

Please sign in to comment.