From 3d46e078875263370565beb28733931fce7a4a9f Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Sun, 15 Nov 2020 13:24:31 +0100 Subject: [PATCH] PHP8 Support (#8303) * Update doctrine/dbal to 2.12 for PHP 8 support. * Change Query\Parser::match to Query\Parser::matchToken including DQL functions. * Fix phpunit constraint to 9.4, adjust @group usage to workaround PHPUnit bug. * Fix PHPUnit API related changes. * Add PHP 8 support for EntityGenerator namespace detection. * Use new assertEqualsWithDetla for QueryDqlFunctionTest with date comparisons * Replace ReflectionParameter::getClass usage with non-deprecated ::getType instead. * Revert "Change Query\Parser::match to Query\Parser::matchToken including DQL functions." This reverts commit 279070491d50deaa4d41e17b28bb5a68f5a22796. * More matchToken => match reverts * Housekeeping: phpcs * Housekeeping: phpcs * Housekeeping: phpcs * Housekeeping: phpcs * Add PHP 8 testrunner, update composer.json and small fix in OrmFunctionalTestCase for new PHPUnit behvaior * Update doctrine/coding-standard to 8.x * Update rule names for doctrine/coding-standard v8.0 * Update to Psalm 4. * Not failOnWarning anymore. * Fix phpcs * fix phpcs * remove 7.2 for now until we can support in DBAL. * Relax doctrine/dbal requirement and add 7.2 CI support again. --- .github/workflows/continuous-integration.yml | 1 + ci/github/phpunit/mysqli.xml | 1 - ci/github/phpunit/pdo_mysql.xml | 1 - ci/github/phpunit/pdo_pgsql.xml | 1 - ci/github/phpunit/sqlite.xml | 1 - composer.json | 6 +++--- lib/Doctrine/ORM/Tools/EntityGenerator.php | 5 +++++ phpcs.xml.dist | 12 ++++++------ .../OneToOneInverseSideLoadAfterDqlQueryTest.php | 2 +- .../Tests/ORM/Functional/QueryDqlFunctionTest.php | 6 ++---- .../Tests/ORM/Functional/Ticket/DDC144Test.php | 1 - .../Tests/ORM/Functional/Ticket/DDC3123Test.php | 7 ++++--- .../Tests/ORM/Functional/Ticket/DDC3303Test.php | 6 +++--- .../Tests/ORM/Functional/Ticket/DDC3597Test.php | 3 ++- .../Tests/ORM/Functional/Ticket/GH2947Test.php | 2 +- .../Tests/ORM/Functional/Ticket/GH5562Test.php | 2 +- .../Tests/ORM/Functional/Ticket/GH5804Test.php | 2 +- .../Tests/ORM/Functional/Ticket/GH5887Test.php | 2 +- .../Tests/ORM/Functional/Ticket/GH6029Test.php | 4 ++-- .../Tests/ORM/Functional/Ticket/GH6141Test.php | 2 +- .../Tests/ORM/Functional/Ticket/GH6362Test.php | 2 +- .../Tests/ORM/Functional/Ticket/GH6402Test.php | 2 +- .../Tests/ORM/Functional/Ticket/GH6531Test.php | 6 +++--- .../Tests/ORM/Functional/Ticket/GH6682Test.php | 2 +- .../Tests/ORM/Functional/Ticket/GH6699Test.php | 2 +- .../Tests/ORM/Functional/Ticket/GH6740Test.php | 10 +++++----- .../Tests/ORM/Functional/Ticket/GH6937Test.php | 2 +- .../Tests/ORM/Functional/Ticket/GH7012Test.php | 2 +- .../Tests/ORM/Functional/Ticket/GH7062Test.php | 2 +- .../Tests/ORM/Functional/Ticket/GH7067Test.php | 2 +- .../Tests/ORM/Functional/Ticket/GH7259Test.php | 4 ++-- .../Tests/ORM/Persisters/ManyToManyPersisterTest.php | 4 +--- tests/Doctrine/Tests/ORM/Query/LexerTest.php | 4 ---- tests/Doctrine/Tests/ORM/Query/QueryTest.php | 5 +---- .../Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php | 11 +++++------ tests/Doctrine/Tests/OrmFunctionalTestCase.php | 4 ++-- 36 files changed, 61 insertions(+), 70 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 6664512c92a..12623adf05b 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -18,6 +18,7 @@ jobs: - "7.2" - "7.3" - "7.4" + - "8.0" deps: - "normal" include: diff --git a/ci/github/phpunit/mysqli.xml b/ci/github/phpunit/mysqli.xml index e94fd135986..916e43397ff 100644 --- a/ci/github/phpunit/mysqli.xml +++ b/ci/github/phpunit/mysqli.xml @@ -5,7 +5,6 @@ beStrictAboutOutputDuringTests="true" beStrictAboutTodoAnnotatedTests="true" failOnRisky="true" - failOnWarning="true" > diff --git a/ci/github/phpunit/pdo_mysql.xml b/ci/github/phpunit/pdo_mysql.xml index 4e7b131638a..9469d9af0f8 100644 --- a/ci/github/phpunit/pdo_mysql.xml +++ b/ci/github/phpunit/pdo_mysql.xml @@ -5,7 +5,6 @@ beStrictAboutOutputDuringTests="true" beStrictAboutTodoAnnotatedTests="true" failOnRisky="true" - failOnWarning="true" > diff --git a/ci/github/phpunit/pdo_pgsql.xml b/ci/github/phpunit/pdo_pgsql.xml index b980fb94e0d..570042dbf40 100644 --- a/ci/github/phpunit/pdo_pgsql.xml +++ b/ci/github/phpunit/pdo_pgsql.xml @@ -5,7 +5,6 @@ beStrictAboutOutputDuringTests="true" beStrictAboutTodoAnnotatedTests="true" failOnRisky="true" - failOnWarning="true" > diff --git a/ci/github/phpunit/sqlite.xml b/ci/github/phpunit/sqlite.xml index edadb0c088e..90943141657 100644 --- a/ci/github/phpunit/sqlite.xml +++ b/ci/github/phpunit/sqlite.xml @@ -5,7 +5,6 @@ beStrictAboutOutputDuringTests="true" beStrictAboutTodoAnnotatedTests="true" failOnRisky="true" - failOnWarning="true" > diff --git a/composer.json b/composer.json index 9049b1ee733..1e5ddefee7e 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "sort-packages": true }, "require": { - "php": "^7.2", + "php": "^7.2|^8.0", "ext-pdo": "*", "composer/package-versions-deprecated": "^1.8", "doctrine/annotations": "^1.11.1", @@ -32,9 +32,9 @@ "symfony/console": "^3.0|^4.0|^5.0" }, "require-dev": { - "doctrine/coding-standard": "^6.0", + "doctrine/coding-standard": "^8.0", "phpstan/phpstan": "^0.12.18", - "phpunit/phpunit": "^8.0", + "phpunit/phpunit": "^8.5|^9.4", "symfony/yaml": "^3.4|^4.0|^5.0", "vimeo/psalm": "4.1.1" }, diff --git a/lib/Doctrine/ORM/Tools/EntityGenerator.php b/lib/Doctrine/ORM/Tools/EntityGenerator.php index 788f8ac6e59..ff3820a55e1 100644 --- a/lib/Doctrine/ORM/Tools/EntityGenerator.php +++ b/lib/Doctrine/ORM/Tools/EntityGenerator.php @@ -26,6 +26,7 @@ use Doctrine\ORM\Mapping\ClassMetadataInfo; use ReflectionClass; use const E_USER_DEPRECATED; +use const PHP_VERSION_ID; use function str_replace; use function trigger_error; use function var_export; @@ -819,6 +820,8 @@ function ($type, $variable) use ($maxParamTypeLength) { /** * @todo this won't work if there is a namespace in brackets and a class outside of it. * + * @psalm-suppress UndefinedConstant + * * @param string $src * * @return void @@ -842,6 +845,8 @@ protected function parseTokensInEntityFile($src) if ($inNamespace) { if (in_array($token[0], [T_NS_SEPARATOR, T_STRING], true)) { $lastSeenNamespace .= $token[1]; + } elseif (PHP_VERSION_ID >= 80000 && ($token[0] === T_NAME_QUALIFIED || $token[0] === T_NAME_FULLY_QUALIFIED)) { + $lastSeenNamespace .= $token[1]; } elseif (is_string($token) && in_array($token, [';', '{'], true)) { $inNamespace = false; } diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 12a1abc8f43..68bcaa5f4b0 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -16,7 +16,7 @@ */tests/Doctrine/Tests/Proxies/__CG__/* - + @@ -37,7 +37,7 @@ lib/Doctrine/ORM/Tools/ToolEvents.php - + lib/Doctrine/ORM/Annotation/* @@ -109,7 +109,7 @@ lib/Doctrine/ORM/EntityManagerInterface.php - + */tests/* @@ -117,7 +117,7 @@ */tests/* - + */tests/* @@ -125,11 +125,11 @@ */tests/* - + */tests/* - + */tests/* diff --git a/tests/Doctrine/Tests/ORM/Functional/OneToOneInverseSideLoadAfterDqlQueryTest.php b/tests/Doctrine/Tests/ORM/Functional/OneToOneInverseSideLoadAfterDqlQueryTest.php index 1ab31b7a3fb..f0c51538c30 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OneToOneInverseSideLoadAfterDqlQueryTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OneToOneInverseSideLoadAfterDqlQueryTest.php @@ -26,7 +26,7 @@ protected function setUp() : void } /** - * @group 6759 + * @group GH-6759 */ public function testInverseSideOneToOneLoadedAfterDqlQuery(): void { diff --git a/tests/Doctrine/Tests/ORM/Functional/QueryDqlFunctionTest.php b/tests/Doctrine/Tests/ORM/Functional/QueryDqlFunctionTest.php index ec326e4f83c..3bb3d3378d0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/QueryDqlFunctionTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/QueryDqlFunctionTest.php @@ -312,8 +312,7 @@ public function testDateAdd(string $unit, int $amount, int $delta = 0) : void self::assertEqualsWithDelta( (new \DateTimeImmutable($result['now']))->modify(sprintf('+%d %s', $amount, $unit)), new \DateTimeImmutable($result['add']), - $delta, - '' + $delta ); } @@ -342,8 +341,7 @@ public function testDateSub(string $unit, int $amount, int $delta = 0) : void self::assertEqualsWithDelta( (new \DateTimeImmutable($result['now']))->modify(sprintf('-%d %s', $amount, $unit)), new \DateTimeImmutable($result['sub']), - $delta, - '' + $delta ); } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC144Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC144Test.php index 56a48919ea7..1c68764a7b3 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC144Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC144Test.php @@ -16,7 +16,6 @@ protected function setUp() : void $this->_em->getClassMetadata(DDC144Operand::class), ] ); - } /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3123Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3123Test.php index 64b055e5a31..4ec22f77bae 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3123Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3123Test.php @@ -5,7 +5,7 @@ use Doctrine\ORM\Events; use Doctrine\ORM\UnitOfWork; use Doctrine\Tests\Models\CMS\CmsUser; -use ReflectionClass; +use ReflectionObject; /** * @group DDC-3123 @@ -38,8 +38,9 @@ public function testIssue() ->expects($this->once()) ->method(Events::postFlush) ->will($this->returnCallback(function () use ($uow, $test) { - $class = new ReflectionClass(UnitOfWork::class); - $property = $class->getProperty('extraUpdates'); + $reflection = new ReflectionObject($uow); + $property = $reflection->getProperty('extraUpdates'); + $property->setAccessible(true); $test->assertEmpty( $property->getValue($uow), diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3303Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3303Test.php index 61515be80a4..77e1e5837d0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3303Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3303Test.php @@ -13,9 +13,9 @@ protected function setUp() : void } /** - * @group 4097 - * @group 4277 - * @group 5867 + * @group GH-4097 + * @group GH-4277 + * @group GH-5867 * * When using an embedded field in an inheritance, private properties should also be inherited. */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3597Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3597Test.php index 89c76810e82..736f29d934d 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3597Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3597Test.php @@ -27,7 +27,8 @@ protected function setUp() : void /** * @group DDC-3597 */ - public function testSaveImageEntity() { + public function testSaveImageEntity(): void + { $imageEntity = new DDC3597Image('foobar'); $imageEntity->setFormat('JPG'); $imageEntity->setSize(123); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH2947Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH2947Test.php index bfc3ca3a111..2f9516536bf 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH2947Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH2947Test.php @@ -6,7 +6,7 @@ use Doctrine\Tests\OrmFunctionalTestCase; /** - * @group 2947 + * @group GH-2947 */ class GH2947Test extends OrmFunctionalTestCase { diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5562Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5562Test.php index 2b42e2be904..31366feabfa 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5562Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5562Test.php @@ -25,7 +25,7 @@ protected function setUp() : void } /** - * @group 5562 + * @group GH-5562 */ public function testCacheShouldBeUpdatedWhenAssociationChanges() { diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5804Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5804Test.php index b4d530fde46..684e08ead3e 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5804Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5804Test.php @@ -9,7 +9,7 @@ use Doctrine\Tests\OrmFunctionalTestCase; /** - * @group 5804 + * @group GH-5804 */ final class GH5804Test extends OrmFunctionalTestCase { diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5887Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5887Test.php index dbe402da322..7503c20d665 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5887Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5887Test.php @@ -8,7 +8,7 @@ use Doctrine\Tests\OrmFunctionalTestCase; /** - * @group 5887 + * @group GH-5887 */ class GH5887Test extends OrmFunctionalTestCase { diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6029Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6029Test.php index a7ab5890427..acd91231b31 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6029Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6029Test.php @@ -30,7 +30,7 @@ protected function setUp() : void * Verifies that when wrong entity is persisted via relationship field, the error message does not correctly state * the expected class name. * - * @group 6029 + * @group GH-6029 */ public function testManyToManyAssociation() : void { @@ -55,7 +55,7 @@ public function testManyToManyAssociation() : void * Verifies that when wrong entity is persisted via relationship field, the error message does not correctly state * the expected class name. * - * @group 6029 + * @group GH-6029 */ public function testOneToManyAssociation() : void { diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6141Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6141Test.php index 550ba87b4b9..b6fd3e2e350 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6141Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6141Test.php @@ -29,7 +29,7 @@ protected function setUp() : void * of using objects as discriminators (which makes things a bit * more dynamic as you can see on the mapping of `GH6141Person`) * - * @group 6141 + * @group GH-6141 */ public function testEnumDiscriminatorsShouldBeConvertedToString() { diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6362Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6362Test.php index ec7b38faa72..40259653d53 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6362Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6362Test.php @@ -24,7 +24,7 @@ protected function setUp() : void } /** - * @group 6362 + * @group GH-6362 * * SELECT a as base, b, c, d * FROM Start a diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6402Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6402Test.php index 8436e5fdb11..d517f7168f0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6402Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6402Test.php @@ -9,7 +9,7 @@ use Doctrine\Tests\OrmFunctionalTestCase; /** - * @group 6402 + * @group GH-6402 */ class GH6402Test extends OrmFunctionalTestCase { diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6531Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6531Test.php index 56473f11219..a8096afb517 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6531Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6531Test.php @@ -24,7 +24,7 @@ protected function setUp() : void } /** - * @group 6531 + * @group GH-6531 */ public function testSimpleDerivedIdentity() : void { @@ -41,7 +41,7 @@ public function testSimpleDerivedIdentity() : void } /** - * @group 6531 + * @group GH-6531 */ public function testDynamicAttributes() : void { @@ -58,7 +58,7 @@ public function testDynamicAttributes() : void } /** - * @group 6531 + * @group GH-6531 */ public function testJoinTableWithMetadata() : void { diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6682Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6682Test.php index a8fd76fa2d0..4d11eb79b4e 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6682Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6682Test.php @@ -8,7 +8,7 @@ final class GH6682Test extends OrmFunctionalTestCase { /** - * @group 6682 + * @group GH-6682 */ public function testIssue() : void { diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6699Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6699Test.php index c1e32fdef26..3929f3d6409 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6699Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6699Test.php @@ -6,7 +6,7 @@ use Doctrine\Tests\OrmFunctionalTestCase; /** - * @group 6699 + * @group GH-6699 */ final class GH6699Test extends OrmFunctionalTestCase { diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6740Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6740Test.php index dccf69d5fd8..58b49bdc8e0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6740Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6740Test.php @@ -52,7 +52,7 @@ protected function setUp() : void } /** - * @group 6740 + * @group GH-6740 */ public function testCollectionFilteringLteOperator() : void { @@ -63,7 +63,7 @@ public function testCollectionFilteringLteOperator() : void } /** - * @group 6740 + * @group GH-6740 */ public function testCollectionFilteringLtOperator() : void { @@ -74,7 +74,7 @@ public function testCollectionFilteringLtOperator() : void } /** - * @group 6740 + * @group GH-6740 */ public function testCollectionFilteringGteOperator() : void { @@ -85,7 +85,7 @@ public function testCollectionFilteringGteOperator() : void } /** - * @group 6740 + * @group GH-6740 */ public function testCollectionFilteringGtOperator() : void { @@ -96,7 +96,7 @@ public function testCollectionFilteringGtOperator() : void } /** - * @group 6740 + * @group GH-6740 */ public function testCollectionFilteringEqualsOperator() : void { diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6937Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6937Test.php index 756111b9898..091e500e6a0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6937Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6937Test.php @@ -6,7 +6,7 @@ use Doctrine\Tests\OrmFunctionalTestCase; /** - * @group 6937 + * @group GH-6937 */ final class GH6937Test extends OrmFunctionalTestCase { diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7012Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7012Test.php index 38f57c57c6c..069e5b37c38 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7012Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7012Test.php @@ -19,7 +19,7 @@ protected function setUp() : void } /** - * @group 7012 + * @group GH-7012 */ public function testUpdateEntityWithIdentifierAssociationWithQuotedJoinColumn() : void { diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7062Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7062Test.php index 47409ac8feb..2b167ec4208 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7062Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7062Test.php @@ -27,7 +27,7 @@ protected function setUp() : void } /** - * @group 7062 + * @group GH-7062 */ public function testEntityWithAssociationKeyIdentityCanBeUpdated() : void { diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7067Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7067Test.php index 18b81f434fb..972161ec988 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7067Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7067Test.php @@ -14,7 +14,7 @@ protected function setUp() : void } /** - * @group 7067 + * @group GH-7067 */ public function testSLCWithVersion() : void { diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7259Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7259Test.php index 948259815c4..3ddbb945254 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7259Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7259Test.php @@ -15,7 +15,7 @@ protected function setUp() : void } /** - * @group 7259 + * @group GH-7259 */ public function testPersistFileBeforeVersion() : void { @@ -42,7 +42,7 @@ public function testPersistFileBeforeVersion() : void } /** - * @group 7259 + * @group GH-7259 */ public function testPersistFileAfterVersion() : void { diff --git a/tests/Doctrine/Tests/ORM/Persisters/ManyToManyPersisterTest.php b/tests/Doctrine/Tests/ORM/Persisters/ManyToManyPersisterTest.php index 989fc849346..843ff239536 100644 --- a/tests/Doctrine/Tests/ORM/Persisters/ManyToManyPersisterTest.php +++ b/tests/Doctrine/Tests/ORM/Persisters/ManyToManyPersisterTest.php @@ -15,10 +15,8 @@ final class ManyToManyPersisterTest extends OrmTestCase { /** - * @group 6991 + * @group GH-6991 * @group ManyToManyPersister - * - * @throws \Doctrine\ORM\ORMException */ public function testDeleteManyToManyCollection(): void { diff --git a/tests/Doctrine/Tests/ORM/Query/LexerTest.php b/tests/Doctrine/Tests/ORM/Query/LexerTest.php index 8140d621d1f..46f2038c6f5 100644 --- a/tests/Doctrine/Tests/ORM/Query/LexerTest.php +++ b/tests/Doctrine/Tests/ORM/Query/LexerTest.php @@ -9,10 +9,6 @@ class LexerTest extends OrmTestCase { private $_lexer; - protected function setUp() : void - { - } - /** * @dataProvider provideTokens */ diff --git a/tests/Doctrine/Tests/ORM/Query/QueryTest.php b/tests/Doctrine/Tests/ORM/Query/QueryTest.php index f4e923eb077..2d2d5241229 100644 --- a/tests/Doctrine/Tests/ORM/Query/QueryTest.php +++ b/tests/Doctrine/Tests/ORM/Query/QueryTest.php @@ -461,10 +461,7 @@ public function testResultCacheProfileCanBeRemovedViaSetter() : void $query->enableResultCache(); $query->setResultCacheProfile(); - $class = new ReflectionClass(Query::class); - $property = $class->getProperty('_queryCacheProfile'); - $property->setAccessible(true); - self::assertNull($property->getValue($query)); + self::assertNull($query->getQueryCacheProfile()); } /** @group 7527 */ diff --git a/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php b/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php index 37cb4c1c782..a3b70b2e6b5 100644 --- a/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php @@ -325,7 +325,7 @@ public function testGeneratedEntityClass() $reflMethod = new \ReflectionMethod($metadata->name, 'setIsbn'); $reflParameters = $reflMethod->getParameters(); - $this->assertEquals($isbnMetadata->name, $reflParameters[0]->getClass()->name); + $this->assertEquals($isbnMetadata->name, $reflParameters[0]->getType()->getName()); } public function testBooleanDefaultValue() @@ -673,7 +673,6 @@ public function testGenerateEntityWithMultipleInverseJoinColumns() '@JoinColumn(name="idpais", referencedColumnName="idpais")', $docComment ); - } /** @@ -954,7 +953,7 @@ public function testGeneratedMutableEmbeddablesClass() $reflMethod = new \ReflectionMethod($metadata->name, 'setTest'); $reflParameters = $reflMethod->getParameters(); - $this->assertEquals($embeddedMetadata->name, $reflParameters[0]->getClass()->name); + $this->assertEquals($embeddedMetadata->name, $reflParameters[0]->getType()->getName()); } /** @@ -992,7 +991,7 @@ public function testGeneratedImmutableEmbeddablesClass() $this->assertCount(6, $reflParameters); - $this->assertSame($embeddedMetadata->name, $reflParameters[0]->getClass()->name); + $this->assertSame($embeddedMetadata->name, $reflParameters[0]->getType()->getName()); $this->assertSame('test', $reflParameters[0]->getName()); $this->assertFalse($reflParameters[0]->isOptional()); @@ -1019,14 +1018,14 @@ public function testGeneratedImmutableEmbeddablesClass() $this->assertSame('field1', $reflParameters[0]->getName()); $this->assertFalse($reflParameters[0]->isOptional()); - $this->assertSame('DateTime', $reflParameters[1]->getClass()->name); + $this->assertSame('DateTime', $reflParameters[1]->getType()->getName()); $this->assertSame('field3', $reflParameters[1]->getName()); $this->assertFalse($reflParameters[1]->isOptional()); $this->assertSame('field2', $reflParameters[2]->getName()); $this->assertTrue($reflParameters[2]->isOptional()); - $this->assertSame('DateTime', $reflParameters[3]->getClass()->name); + $this->assertSame('DateTime', $reflParameters[3]->getType()->getName()); $this->assertSame('field4', $reflParameters[3]->getName()); $this->assertTrue($reflParameters[3]->isOptional()); } diff --git a/tests/Doctrine/Tests/OrmFunctionalTestCase.php b/tests/Doctrine/Tests/OrmFunctionalTestCase.php index 66b6cfda305..2ca95f52a82 100644 --- a/tests/Doctrine/Tests/OrmFunctionalTestCase.php +++ b/tests/Doctrine/Tests/OrmFunctionalTestCase.php @@ -4,7 +4,6 @@ use Doctrine\Common\Cache\ArrayCache; use Doctrine\DBAL\Driver\Connection; -use Doctrine\DBAL\Driver\PDOSqlite\Driver as SqliteDriver; use Doctrine\DBAL\Logging\DebugStack; use Doctrine\DBAL\Types\Type; use Doctrine\ORM\Cache\CacheConfiguration; @@ -19,6 +18,7 @@ use Doctrine\Tests\EventListener\CacheMetadataListener; use Doctrine\Tests\Models; use PHPUnit\Framework\AssertionFailedError; +use PHPUnit\Framework\Warning; use Throwable; /** @@ -787,7 +787,7 @@ protected function _getEntityManager( */ protected function onNotSuccessfulTest(Throwable $e) : void { - if ($e instanceof AssertionFailedError) { + if ($e instanceof AssertionFailedError || $e instanceof Warning) { throw $e; }