[PR #5883] Make test suite compatible with PHPUnit 5.4. #9770

Open
opened 2026-01-22 16:05:21 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/5883

State: closed
Merged: Yes


  • Use createMock() and getMockBuilder() instead of getMock()
  • Use expectException() and expectExceptionMessage() instead of setExpectedException()

Output with PHPUnit 4.8 before these changes

PHPUnit 4.8.26-3-ga973e60 by Sebastian Bergmann and contributors.

.........................................................E...   61 / 3111 (  1%)
............S................................................  122 / 3111 (  3%)
.............................................................  183 / 3111 (  5%)
.............................................................  244 / 3111 (  7%)
.............................................................  305 / 3111 (  9%)
.............................................................  366 / 3111 ( 11%)
.........................................S........SSSS.S.....  427 / 3111 ( 13%)
.............................................................  488 / 3111 ( 15%)
............................................F................  549 / 3111 ( 17%)
....................................SS.......................  610 / 3111 ( 19%)
.............................................................  671 / 3111 ( 21%)
.............................................................  732 / 3111 ( 23%)
.............................................................  793 / 3111 ( 25%)
.............................................................  854 / 3111 ( 27%)
....................F........................................  915 / 3111 ( 29%)
.............................................................  976 / 3111 ( 31%)
......................................S.SSSSSSSSSSSS......... 1037 / 3111 ( 33%)
......................................................F...... 1098 / 3111 ( 35%)
..................................................SS......... 1159 / 3111 ( 37%)
.....................S...S...........S....................... 1220 / 3111 ( 39%)
.......S.......................................F......F...... 1281 / 3111 ( 41%)
.............................S............................... 1342 / 3111 ( 43%)
......F...................................................... 1403 / 3111 ( 45%)
............................................................. 1464 / 3111 ( 47%)
..................SS.................................S....... 1525 / 3111 ( 49%)
............................................................. 1586 / 3111 ( 50%)
............................................................. 1647 / 3111 ( 52%)
............................................................. 1708 / 3111 ( 54%)
............................................................. 1769 / 3111 ( 56%)
............................................................. 1830 / 3111 ( 58%)
............................................................. 1891 / 3111 ( 60%)
............................................................. 1952 / 3111 ( 62%)
.............................................S............... 2013 / 3111 ( 64%)
...SSS.............................II........................ 2074 / 3111 ( 66%)
S................SSS......................................... 2135 / 3111 ( 68%)
............................................................. 2196 / 3111 ( 70%)
............................................................. 2257 / 3111 ( 72%)
............................................................. 2318 / 3111 ( 74%)
............................................................. 2379 / 3111 ( 76%)
............................................................. 2440 / 3111 ( 78%)
............................................................. 2501 / 3111 ( 80%)
............................................................. 2562 / 3111 ( 82%)
............................................................. 2623 / 3111 ( 84%)
............................................................. 2684 / 3111 ( 86%)
............................................................. 2745 / 3111 ( 88%)
............................................................. 2806 / 3111 ( 90%)
............................................................. 2867 / 3111 ( 92%)
............................................................. 2928 / 3111 ( 94%)
...................S.......S......S.......S.................. 2989 / 3111 ( 96%)
.....S...........S........................................... 3050 / 3111 ( 98%)
............................................................. 3111 / 3111 (100%)


Time: 10.07 seconds, Memory: 148.00MB

There was 1 error:

1) Doctrine\Tests\ORM\Cache\DefaultQueryCacheTest::testPutToOneAssociation2LevelsQueryResult
Undefined property: Doctrine\Tests\Models\Cache\City::$country

/usr/local/src/doctrine2/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php:782
/usr/local/src/doctrine2/lib/Doctrine/ORM/Cache/DefaultQueryCache.php:266
/usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Cache/DefaultQueryCacheTest.php:183

--

There were 6 failures:

1) Doctrine\Tests\ORM\Functional\ExtraLazyCollectionTest::testGetIndexByIdentifier
Getting the same entity should not cause an extra query to be executed
Failed asserting that 30 matches expected 28.

/usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Functional/ExtraLazyCollectionTest.php:772

2) Doctrine\Tests\ORM\Functional\ProxiesLikeEntitiesTest::testPersistUpdate
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'Marco Pivetta'
+'Marco'

/usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Functional/ProxiesLikeEntitiesTest.php:65

3) Doctrine\Tests\ORM\Functional\SecondLevelCacheOneToManyTest::testLoadOneToManyCollectionFromDatabaseWhenEntityMissing
Failed asserting that 17 matches expected 16.

/usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheOneToManyTest.php:151

4) Doctrine\Tests\ORM\Functional\Ticket\DDC1655Test::testPostLoadInheritanceChild
Failed asserting that 2 matches expected 1.

/usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1655Test.php:69

5) Doctrine\Tests\ORM\Functional\Ticket\DDC1690Test::testChangeTracking
Failed asserting that actual size 1 matches expected size 0.

/usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1690Test.php:57

6) Doctrine\Tests\ORM\Functional\Ticket\DDC2862Test::testIssueReopened
Failed asserting that 8 matches expected 7.

/usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2862Test.php:107

FAILURES!
Tests: 3111, Assertions: 11368, Errors: 1, Failures: 6, Skipped: 46, Incomplete: 2.

Output with PHPUnit 5.5-dev after these changes

PHPUnit 5.5-gf570814 by Sebastian Bergmann and contributors.

.........................................................E...   61 / 3111 (  1%)
............S................................................  122 / 3111 (  3%)
.............................................................  183 / 3111 (  5%)
.............................................................  244 / 3111 (  7%)
.............................................................  305 / 3111 (  9%)
.............................................................  366 / 3111 ( 11%)
.........................................S........SSSS.S.....  427 / 3111 ( 13%)
.............................................................  488 / 3111 ( 15%)
............................................F................  549 / 3111 ( 17%)
....................................SS.......................  610 / 3111 ( 19%)
.............................................................  671 / 3111 ( 21%)
.............................................................  732 / 3111 ( 23%)
.............................................................  793 / 3111 ( 25%)
.............................................................  854 / 3111 ( 27%)
....................F........................................  915 / 3111 ( 29%)
.............................................................  976 / 3111 ( 31%)
......................................S.SSSSSSSSSSSS......... 1037 / 3111 ( 33%)
......................................................F...... 1098 / 3111 ( 35%)
..................................................SS......... 1159 / 3111 ( 37%)
.....................S...S...........S....................... 1220 / 3111 ( 39%)
.......S.......................................F......F...... 1281 / 3111 ( 41%)
.............................S............................... 1342 / 3111 ( 43%)
......F...................................................... 1403 / 3111 ( 45%)
............................................................. 1464 / 3111 ( 47%)
..................SS.................................S....... 1525 / 3111 ( 49%)
............................................................. 1586 / 3111 ( 50%)
............................................................. 1647 / 3111 ( 52%)
............................................................. 1708 / 3111 ( 54%)
............................................................. 1769 / 3111 ( 56%)
............................................................. 1830 / 3111 ( 58%)
............................................................. 1891 / 3111 ( 60%)
............................................................. 1952 / 3111 ( 62%)
.............................................S............... 2013 / 3111 ( 64%)
...SSS.............................II........................ 2074 / 3111 ( 66%)
S................SSS......................................... 2135 / 3111 ( 68%)
............................................................. 2196 / 3111 ( 70%)
............................................................. 2257 / 3111 ( 72%)
............................................................. 2318 / 3111 ( 74%)
............................................................. 2379 / 3111 ( 76%)
............................................................. 2440 / 3111 ( 78%)
............................................................. 2501 / 3111 ( 80%)
............................................................. 2562 / 3111 ( 82%)
............................................................. 2623 / 3111 ( 84%)
............................................................. 2684 / 3111 ( 86%)
............................................................. 2745 / 3111 ( 88%)
............................................................. 2806 / 3111 ( 90%)
............................................................. 2867 / 3111 ( 92%)
............................................................. 2928 / 3111 ( 94%)
...................S.......S......S.......S.................. 2989 / 3111 ( 96%)
.....S...........S........................................... 3050 / 3111 ( 98%)
............................................................. 3111 / 3111 (100%)


Time: 9.82 seconds, Memory: 152.00MB

There was 1 error:

1) Doctrine\Tests\ORM\Cache\DefaultQueryCacheTest::testPutToOneAssociation2LevelsQueryResult
Undefined property: Doctrine\Tests\Models\Cache\City::$country

/usr/local/src/doctrine2/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php:782
/usr/local/src/doctrine2/lib/Doctrine/ORM/Cache/DefaultQueryCache.php:266
/usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Cache/DefaultQueryCacheTest.php:183

--

There were 6 failures:

1) Doctrine\Tests\ORM\Functional\ExtraLazyCollectionTest::testGetIndexByIdentifier
Getting the same entity should not cause an extra query to be executed
Failed asserting that 30 matches expected 28.

/usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Functional/ExtraLazyCollectionTest.php:772

2) Doctrine\Tests\ORM\Functional\ProxiesLikeEntitiesTest::testPersistUpdate
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'Marco Pivetta'
+'Marco'

/usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Functional/ProxiesLikeEntitiesTest.php:65

3) Doctrine\Tests\ORM\Functional\SecondLevelCacheOneToManyTest::testLoadOneToManyCollectionFromDatabaseWhenEntityMissing
Failed asserting that 17 matches expected 16.

/usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheOneToManyTest.php:151

4) Doctrine\Tests\ORM\Functional\Ticket\DDC1655Test::testPostLoadInheritanceChild
Failed asserting that 2 matches expected 1.

/usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1655Test.php:69

5) Doctrine\Tests\ORM\Functional\Ticket\DDC1690Test::testChangeTracking
Failed asserting that actual size 1 matches expected size 0.

/usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1690Test.php:57

6) Doctrine\Tests\ORM\Functional\Ticket\DDC2862Test::testIssueReopened
Failed asserting that 8 matches expected 7.

/usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2862Test.php:107
**Original Pull Request:** https://github.com/doctrine/orm/pull/5883 **State:** closed **Merged:** Yes --- - Use createMock() and getMockBuilder() instead of getMock() - Use expectException() and expectExceptionMessage() instead of setExpectedException() ## Output with PHPUnit 4.8 before these changes ``` PHPUnit 4.8.26-3-ga973e60 by Sebastian Bergmann and contributors. .........................................................E... 61 / 3111 ( 1%) ............S................................................ 122 / 3111 ( 3%) ............................................................. 183 / 3111 ( 5%) ............................................................. 244 / 3111 ( 7%) ............................................................. 305 / 3111 ( 9%) ............................................................. 366 / 3111 ( 11%) .........................................S........SSSS.S..... 427 / 3111 ( 13%) ............................................................. 488 / 3111 ( 15%) ............................................F................ 549 / 3111 ( 17%) ....................................SS....................... 610 / 3111 ( 19%) ............................................................. 671 / 3111 ( 21%) ............................................................. 732 / 3111 ( 23%) ............................................................. 793 / 3111 ( 25%) ............................................................. 854 / 3111 ( 27%) ....................F........................................ 915 / 3111 ( 29%) ............................................................. 976 / 3111 ( 31%) ......................................S.SSSSSSSSSSSS......... 1037 / 3111 ( 33%) ......................................................F...... 1098 / 3111 ( 35%) ..................................................SS......... 1159 / 3111 ( 37%) .....................S...S...........S....................... 1220 / 3111 ( 39%) .......S.......................................F......F...... 1281 / 3111 ( 41%) .............................S............................... 1342 / 3111 ( 43%) ......F...................................................... 1403 / 3111 ( 45%) ............................................................. 1464 / 3111 ( 47%) ..................SS.................................S....... 1525 / 3111 ( 49%) ............................................................. 1586 / 3111 ( 50%) ............................................................. 1647 / 3111 ( 52%) ............................................................. 1708 / 3111 ( 54%) ............................................................. 1769 / 3111 ( 56%) ............................................................. 1830 / 3111 ( 58%) ............................................................. 1891 / 3111 ( 60%) ............................................................. 1952 / 3111 ( 62%) .............................................S............... 2013 / 3111 ( 64%) ...SSS.............................II........................ 2074 / 3111 ( 66%) S................SSS......................................... 2135 / 3111 ( 68%) ............................................................. 2196 / 3111 ( 70%) ............................................................. 2257 / 3111 ( 72%) ............................................................. 2318 / 3111 ( 74%) ............................................................. 2379 / 3111 ( 76%) ............................................................. 2440 / 3111 ( 78%) ............................................................. 2501 / 3111 ( 80%) ............................................................. 2562 / 3111 ( 82%) ............................................................. 2623 / 3111 ( 84%) ............................................................. 2684 / 3111 ( 86%) ............................................................. 2745 / 3111 ( 88%) ............................................................. 2806 / 3111 ( 90%) ............................................................. 2867 / 3111 ( 92%) ............................................................. 2928 / 3111 ( 94%) ...................S.......S......S.......S.................. 2989 / 3111 ( 96%) .....S...........S........................................... 3050 / 3111 ( 98%) ............................................................. 3111 / 3111 (100%) Time: 10.07 seconds, Memory: 148.00MB There was 1 error: 1) Doctrine\Tests\ORM\Cache\DefaultQueryCacheTest::testPutToOneAssociation2LevelsQueryResult Undefined property: Doctrine\Tests\Models\Cache\City::$country /usr/local/src/doctrine2/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php:782 /usr/local/src/doctrine2/lib/Doctrine/ORM/Cache/DefaultQueryCache.php:266 /usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Cache/DefaultQueryCacheTest.php:183 -- There were 6 failures: 1) Doctrine\Tests\ORM\Functional\ExtraLazyCollectionTest::testGetIndexByIdentifier Getting the same entity should not cause an extra query to be executed Failed asserting that 30 matches expected 28. /usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Functional/ExtraLazyCollectionTest.php:772 2) Doctrine\Tests\ORM\Functional\ProxiesLikeEntitiesTest::testPersistUpdate Failed asserting that two strings are equal. --- Expected +++ Actual @@ @@ -'Marco Pivetta' +'Marco' /usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Functional/ProxiesLikeEntitiesTest.php:65 3) Doctrine\Tests\ORM\Functional\SecondLevelCacheOneToManyTest::testLoadOneToManyCollectionFromDatabaseWhenEntityMissing Failed asserting that 17 matches expected 16. /usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheOneToManyTest.php:151 4) Doctrine\Tests\ORM\Functional\Ticket\DDC1655Test::testPostLoadInheritanceChild Failed asserting that 2 matches expected 1. /usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1655Test.php:69 5) Doctrine\Tests\ORM\Functional\Ticket\DDC1690Test::testChangeTracking Failed asserting that actual size 1 matches expected size 0. /usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1690Test.php:57 6) Doctrine\Tests\ORM\Functional\Ticket\DDC2862Test::testIssueReopened Failed asserting that 8 matches expected 7. /usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2862Test.php:107 FAILURES! Tests: 3111, Assertions: 11368, Errors: 1, Failures: 6, Skipped: 46, Incomplete: 2. ``` ## Output with PHPUnit 5.5-dev after these changes ``` PHPUnit 5.5-gf570814 by Sebastian Bergmann and contributors. .........................................................E... 61 / 3111 ( 1%) ............S................................................ 122 / 3111 ( 3%) ............................................................. 183 / 3111 ( 5%) ............................................................. 244 / 3111 ( 7%) ............................................................. 305 / 3111 ( 9%) ............................................................. 366 / 3111 ( 11%) .........................................S........SSSS.S..... 427 / 3111 ( 13%) ............................................................. 488 / 3111 ( 15%) ............................................F................ 549 / 3111 ( 17%) ....................................SS....................... 610 / 3111 ( 19%) ............................................................. 671 / 3111 ( 21%) ............................................................. 732 / 3111 ( 23%) ............................................................. 793 / 3111 ( 25%) ............................................................. 854 / 3111 ( 27%) ....................F........................................ 915 / 3111 ( 29%) ............................................................. 976 / 3111 ( 31%) ......................................S.SSSSSSSSSSSS......... 1037 / 3111 ( 33%) ......................................................F...... 1098 / 3111 ( 35%) ..................................................SS......... 1159 / 3111 ( 37%) .....................S...S...........S....................... 1220 / 3111 ( 39%) .......S.......................................F......F...... 1281 / 3111 ( 41%) .............................S............................... 1342 / 3111 ( 43%) ......F...................................................... 1403 / 3111 ( 45%) ............................................................. 1464 / 3111 ( 47%) ..................SS.................................S....... 1525 / 3111 ( 49%) ............................................................. 1586 / 3111 ( 50%) ............................................................. 1647 / 3111 ( 52%) ............................................................. 1708 / 3111 ( 54%) ............................................................. 1769 / 3111 ( 56%) ............................................................. 1830 / 3111 ( 58%) ............................................................. 1891 / 3111 ( 60%) ............................................................. 1952 / 3111 ( 62%) .............................................S............... 2013 / 3111 ( 64%) ...SSS.............................II........................ 2074 / 3111 ( 66%) S................SSS......................................... 2135 / 3111 ( 68%) ............................................................. 2196 / 3111 ( 70%) ............................................................. 2257 / 3111 ( 72%) ............................................................. 2318 / 3111 ( 74%) ............................................................. 2379 / 3111 ( 76%) ............................................................. 2440 / 3111 ( 78%) ............................................................. 2501 / 3111 ( 80%) ............................................................. 2562 / 3111 ( 82%) ............................................................. 2623 / 3111 ( 84%) ............................................................. 2684 / 3111 ( 86%) ............................................................. 2745 / 3111 ( 88%) ............................................................. 2806 / 3111 ( 90%) ............................................................. 2867 / 3111 ( 92%) ............................................................. 2928 / 3111 ( 94%) ...................S.......S......S.......S.................. 2989 / 3111 ( 96%) .....S...........S........................................... 3050 / 3111 ( 98%) ............................................................. 3111 / 3111 (100%) Time: 9.82 seconds, Memory: 152.00MB There was 1 error: 1) Doctrine\Tests\ORM\Cache\DefaultQueryCacheTest::testPutToOneAssociation2LevelsQueryResult Undefined property: Doctrine\Tests\Models\Cache\City::$country /usr/local/src/doctrine2/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php:782 /usr/local/src/doctrine2/lib/Doctrine/ORM/Cache/DefaultQueryCache.php:266 /usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Cache/DefaultQueryCacheTest.php:183 -- There were 6 failures: 1) Doctrine\Tests\ORM\Functional\ExtraLazyCollectionTest::testGetIndexByIdentifier Getting the same entity should not cause an extra query to be executed Failed asserting that 30 matches expected 28. /usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Functional/ExtraLazyCollectionTest.php:772 2) Doctrine\Tests\ORM\Functional\ProxiesLikeEntitiesTest::testPersistUpdate Failed asserting that two strings are equal. --- Expected +++ Actual @@ @@ -'Marco Pivetta' +'Marco' /usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Functional/ProxiesLikeEntitiesTest.php:65 3) Doctrine\Tests\ORM\Functional\SecondLevelCacheOneToManyTest::testLoadOneToManyCollectionFromDatabaseWhenEntityMissing Failed asserting that 17 matches expected 16. /usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheOneToManyTest.php:151 4) Doctrine\Tests\ORM\Functional\Ticket\DDC1655Test::testPostLoadInheritanceChild Failed asserting that 2 matches expected 1. /usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1655Test.php:69 5) Doctrine\Tests\ORM\Functional\Ticket\DDC1690Test::testChangeTracking Failed asserting that actual size 1 matches expected size 0. /usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1690Test.php:57 6) Doctrine\Tests\ORM\Functional\Ticket\DDC2862Test::testIssueReopened Failed asserting that 8 matches expected 7. /usr/local/src/doctrine2/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2862Test.php:107 ```
admin added the pull-request label 2026-01-22 16:05:21 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#9770