Skip to content

Commit 21e9fcb

Browse files
authored
Merge pull request #12146 from greg0ire/upg-phpunit
PHPUnit 11
2 parents 28735af + db45697 commit 21e9fcb

17 files changed

+64
-36
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,24 @@ jobs:
9595
ENABLE_SECOND_LEVEL_CACHE: 0
9696
ENABLE_NATIVE_LAZY_OBJECTS: ${{ matrix.native_lazy }}
9797

98-
- name: "Run PHPUnit with Second Level Cache"
99-
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --exclude-group performance,non-cacheable,locking_functional --coverage-clover=coverage-cache.xml"
98+
- name: "Run PHPUnit with Second Level Cache and PHPUnit 10"
99+
run: |
100+
vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml \
101+
--exclude-group=performance,non-cacheable,locking_functional \
102+
--coverage-clover=coverage-cache.xml
103+
if: "${{ matrix.php-version == '8.1' }}"
104+
env:
105+
ENABLE_SECOND_LEVEL_CACHE: 1
106+
ENABLE_NATIVE_LAZY_OBJECTS: ${{ matrix.native_lazy }}
107+
108+
- name: "Run PHPUnit with Second Level Cache and PHPUnit 11+"
109+
run: |
110+
vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml \
111+
--exclude-group=performance \
112+
--exclude-group=non-cacheable \
113+
--exclude-group=locking_functional \
114+
--coverage-clover=coverage-cache.xml
115+
if: "${{ matrix.php-version != '8.1' }}"
100116
env:
101117
ENABLE_SECOND_LEVEL_CACHE: 1
102118
ENABLE_NATIVE_LAZY_OBJECTS: ${{ matrix.native_lazy }}
@@ -319,8 +335,22 @@ jobs:
319335
env:
320336
ENABLE_SECOND_LEVEL_CACHE: 0
321337

322-
- name: "Run PHPUnit with Second Level Cache"
323-
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --exclude-group performance,non-cacheable,locking_functional --coverage-clover=coverage-no-cache.xml"
338+
- name: "Run PHPUnit with Second Level Cache and PHPUnit 10"
339+
run: |
340+
vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml \
341+
--exclude-group=performance,non-cacheable,locking_functional \
342+
--coverage-clover=coverage-no-cache.xml"
343+
if: "${{ matrix.php-version == '8.1' }}"
344+
env:
345+
ENABLE_SECOND_LEVEL_CACHE: 1
346+
- name: "Run PHPUnit with Second Level Cache and PHPUnit 11+"
347+
run: |
348+
vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml \
349+
--exclude-group=performance \
350+
--exclude-group=non-cacheable \
351+
--exclude-group=locking_functional \
352+
--coverage-clover=coverage-no-cache.xml
353+
if: "${{ matrix.php-version != '8.1' }}"
324354
env:
325355
ENABLE_SECOND_LEVEL_CACHE: 1
326356

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"phpstan/extension-installer": "^1.4",
4444
"phpstan/phpstan": "2.1.22",
4545
"phpstan/phpstan-deprecation-rules": "^2",
46-
"phpunit/phpunit": "^10.4.0",
46+
"phpunit/phpunit": "^10.4.0 || ^11.5",
4747
"psr/log": "^1 || ^2 || ^3",
4848
"squizlabs/php_codesniffer": "3.13.2",
4949
"symfony/cache": "^5.4 || ^6.2 || ^7.0"

tests/Tests/ORM/Functional/EagerFetchOneToManyWithCompositeKeyTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
use Doctrine\Tests\Models\EagerFetchedCompositeOneToMany\RootEntity;
88
use Doctrine\Tests\Models\EagerFetchedCompositeOneToMany\SecondLevel;
99
use Doctrine\Tests\OrmFunctionalTestCase;
10+
use PHPUnit\Framework\Attributes\Group;
1011

1112
final class EagerFetchOneToManyWithCompositeKeyTest extends OrmFunctionalTestCase
1213
{
13-
/** @ticket 11154 */
14+
#[Group('GH11154')]
1415
public function testItDoesNotThrowAnExceptionWhenTriggeringALoad(): void
1516
{
1617
$this->setUpEntitySchema([RootEntity::class, SecondLevel::class]);

tests/Tests/ORM/Functional/QueryCacheTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ public function testQueryCacheHitDoesNotSaveParserResult(): void
122122

123123
$query = $this->_em->createQuery('select ux from Doctrine\Tests\Models\CMS\CmsUser ux');
124124

125-
$sqlExecMock = $this->getMockBuilder(AbstractSqlExecutor::class)
126-
->getMockForAbstractClass();
125+
$sqlExecMock = $this->createMock(AbstractSqlExecutor::class);
127126

128127
$sqlExecMock->expects(self::once())
129128
->method('execute')

tests/Tests/ORM/Functional/Ticket/DDC3042Test.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
use Doctrine\Tests\OrmFunctionalTestCase;
1212
use PHPUnit\Framework\Attributes\Group;
1313

14+
use function substr_count;
15+
1416
#[Group('DDC-3042')]
1517
class DDC3042Test extends OrmFunctionalTestCase
1618
{
@@ -23,14 +25,18 @@ protected function setUp(): void
2325

2426
public function testSQLGenerationDoesNotProvokeAliasCollisions(): void
2527
{
26-
self::assertStringNotMatchesFormat(
27-
'%sfield11%sfield11%s',
28-
$this
28+
self::assertSame(
29+
1,
30+
substr_count(
31+
$this
2932
->_em
3033
->createQuery(
3134
'SELECT f, b FROM ' . __NAMESPACE__ . '\DDC3042Foo f JOIN ' . __NAMESPACE__ . '\DDC3042Bar b WITH 1 = 1',
3235
)
3336
->getSQL(),
37+
'field_11',
38+
),
39+
'The alias "field11" should only appear once in the SQL query.',
3440
);
3541
}
3642
}

tests/Tests/ORM/Functional/Ticket/GH10049/GH10049Test.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Doctrine\Tests\ORM\Functional\Ticket\GH10049;
66

77
use Doctrine\Tests\OrmFunctionalTestCase;
8+
use PHPUnit\Framework\Attributes\DoesNotPerformAssertions;
89

910
class GH10049Test extends OrmFunctionalTestCase
1011
{
@@ -18,7 +19,7 @@ public function setUp(): void
1819
);
1920
}
2021

21-
/** @doesNotPerformAssertions */
22+
#[DoesNotPerformAssertions]
2223
public function testInheritedReadOnlyPropertyValueCanBeSet(): void
2324
{
2425
$child = new ReadOnlyPropertyInheritor(10049);

tests/Tests/ORM/Hydration/AbstractHydratorTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ protected function setUp(): void
5454

5555
$this->hydrator = $this
5656
->getMockBuilder(AbstractHydrator::class)
57+
->onlyMethods(['hydrateAllData'])
5758
->setConstructorArgs([$mockEntityManagerInterface])
58-
->getMockForAbstractClass();
59+
->getMock();
5960
}
6061

6162
/**

tests/Tests/ORM/Mapping/DefaultQuoteStrategyTest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@
55
namespace Doctrine\Tests\ORM\Mapping;
66

77
use Doctrine\DBAL\Platforms\AbstractPlatform;
8-
use Doctrine\DBAL\Schema\Name\UnquotedIdentifierFolding;
8+
use Doctrine\DBAL\Platforms\SQLitePlatform;
99
use Doctrine\ORM\Mapping\ClassMetadata;
1010
use Doctrine\ORM\Mapping\DefaultQuoteStrategy;
1111
use Doctrine\Tests\Models\NonPublicSchemaJoins\User as NonPublicSchemaUser;
1212
use Doctrine\Tests\OrmTestCase;
1313
use PHPUnit\Framework\Attributes\DataProvider;
1414
use PHPUnit\Framework\Attributes\Group;
1515

16-
use function assert;
17-
use function enum_exists;
1816
use function sprintf;
1917

2018
/**
@@ -29,8 +27,7 @@ public function testGetJoinTableName(): void
2927
$em = $this->getTestEntityManager();
3028
$metadata = $em->getClassMetadata(NonPublicSchemaUser::class);
3129
$strategy = new DefaultQuoteStrategy();
32-
$platform = $this->getMockForAbstractClass(AbstractPlatform::class, enum_exists(UnquotedIdentifierFolding::class) ? [UnquotedIdentifierFolding::UPPER] : []);
33-
assert($platform instanceof AbstractPlatform);
30+
$platform = new SQLitePlatform();
3431

3532
self::assertSame(
3633
'readers.author_reader',

tests/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ public function testUpdateUsesTypeValuesSQL(): void
6868

6969
$platform = $this->getMockBuilder(AbstractPlatform::class)
7070
->setConstructorArgs(enum_exists(UnquotedIdentifierFolding::class) ? [UnquotedIdentifierFolding::UPPER] : [])
71-
->onlyMethods(['supportsIdentityColumns'])
72-
->getMockForAbstractClass();
71+
->getMock();
7372
$platform->method('supportsIdentityColumns')
7473
->willReturn(true);
7574

tests/Tests/ORM/Persisters/ManyToManyPersisterTest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
use Doctrine\DBAL\Connection;
88
use Doctrine\DBAL\Driver;
9-
use Doctrine\DBAL\Platforms\AbstractPlatform;
10-
use Doctrine\DBAL\Schema\Name\UnquotedIdentifierFolding;
9+
use Doctrine\DBAL\Platforms\SQLitePlatform;
1110
use Doctrine\ORM\Persisters\Collection\ManyToManyPersister;
1211
use Doctrine\Tests\Models\ManyToManyPersister\ChildClass;
1312
use Doctrine\Tests\Models\ManyToManyPersister\OtherParentClass;
@@ -16,8 +15,6 @@
1615
use PHPUnit\Framework\Attributes\CoversClass;
1716
use PHPUnit\Framework\Attributes\Group;
1817

19-
use function enum_exists;
20-
2118
#[CoversClass(ManyToManyPersister::class)]
2219
final class ManyToManyPersisterTest extends OrmTestCase
2320
{
@@ -34,7 +31,7 @@ public function testDeleteManyToManyCollection(): void
3431
->onlyMethods(['executeStatement', 'getDatabasePlatform'])
3532
->getMock();
3633
$connection->method('getDatabasePlatform')
37-
->willReturn($this->getMockForAbstractClass(AbstractPlatform::class, enum_exists(UnquotedIdentifierFolding::class) ? [UnquotedIdentifierFolding::UPPER] : []));
34+
->willReturn(new SQLitePlatform());
3835

3936
$parent = new ParentClass(1);
4037
$otherParent = new OtherParentClass(42);

0 commit comments

Comments
 (0)