Skip to content

Commit d53166b

Browse files
authored
Update to PHPUnit 12.5 (#121)
1 parent d4eac2e commit d53166b

20 files changed

Lines changed: 93 additions & 90 deletions

.github/workflows/tests.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ jobs:
6262
run: |
6363
composer require --dev --no-update phpunit/phpunit:^10.5
6464
sed -i 's/failOnPhpunitDeprecation="true"//g' phpunit.dist.xml
65+
sed -i 's/failOnPhpunitNotice="true"//g' phpunit.dist.xml
66+
67+
- name: Downgrade PHPUnit for PHP 8.2
68+
if: matrix.php == '8.2'
69+
run: |
70+
composer require --dev --no-update phpunit/phpunit:^11.5
71+
sed -i 's/failOnPhpunitNotice="true"//g' phpunit.dist.xml
6572
6673
- name: Install Dependencies
6774
uses: ramsey/composer-install@v3

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
},
4848
"require-dev": {
4949
"doctrine/common": "^3.2",
50-
"phpunit/phpunit": "^11.5",
50+
"phpunit/phpunit": "^12.5",
5151
"symfony/cache": "^5.4 || ^6.4 || ^7.4 || ^8.0",
5252
"symfony/doctrine-messenger": "^5.4 || ^6.4 || ^7.4 || ^8.0",
5353
"symfony/expression-language": "^5.4 || ^6.4 || ^7.4 || ^8.0",

phpunit.dist.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
failOnIncomplete="true"
1111
failOnNotice="true"
1212
failOnPhpunitDeprecation="true"
13+
failOnPhpunitNotice="true"
1314
failOnRisky="true"
1415
failOnWarning="true"
1516
>

tests/Cache/Configuration/CachedConfigurationLoaderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ protected function tearDown(): void
3838

3939
public function testSubscriptionsAreCached(): void
4040
{
41-
$purgeSubscriptionProvider = $this->createMock(PurgeSubscriptionProviderInterface::class);
41+
$purgeSubscriptionProvider = self::createStub(PurgeSubscriptionProviderInterface::class);
4242
$purgeSubscriptionProvider->method('provide')
4343
->willReturn([
4444
new PurgeSubscription(
@@ -61,7 +61,7 @@ class: 'Foo',
6161
),
6262
]);
6363

64-
$router = $this->createMock(RouterInterface::class);
64+
$router = self::createStub(RouterInterface::class);
6565
$router->method('getRouteCollection')
6666
->willReturn(new RouteCollection());
6767

tests/Cache/Configuration/ConfigurationLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ final class ConfigurationLoaderTest extends TestCase
2626
#[DataProvider('purgeSubscriptionProvider')]
2727
public function testSubscriptions(array $purgeSubscriptions, array $expectedConfiguration): void
2828
{
29-
$purgeSubscriptionProvider = $this->createMock(PurgeSubscriptionProviderInterface::class);
29+
$purgeSubscriptionProvider = self::createStub(PurgeSubscriptionProviderInterface::class);
3030
$purgeSubscriptionProvider->method('provide')
3131
->willReturn($purgeSubscriptions);
3232

tests/Cache/PropertyResolver/AssociationResolverTestCase.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function testResolveAssociations(
3030
bool $isGetAssociationMappedByTargetFieldCalled,
3131
bool $isAssociationInverseSide,
3232
): void {
33-
$extractor = $this->createMock(PropertyReadInfoExtractorInterface::class);
33+
$extractor = self::createStub(PropertyReadInfoExtractorInterface::class);
3434
$extractor->method('getReadInfo')
3535
->with('BarEntity', 'barProperty')
3636
->willReturn(
@@ -79,7 +79,7 @@ class: 'FooEntity',
7979
target: new ForProperties(['fooProperty']),
8080
if: new Expression('obj.isActive() === true'),
8181
),
82-
reflectionMethod: $this->createMock(\ReflectionMethod::class),
82+
reflectionMethod: self::createStub(\ReflectionMethod::class),
8383
),
8484
classMetadata: $classMetadata,
8585
routeParams: [
@@ -112,10 +112,10 @@ abstract public static function associationProvider(): iterable;
112112
public function testFieldNotAssociation(): void
113113
{
114114
$resolver = new AssociationResolver(
115-
$this->createMock(PropertyReadInfoExtractorInterface::class),
115+
self::createStub(PropertyReadInfoExtractorInterface::class),
116116
);
117117

118-
$classMetadata = $this->createMock(ClassMetadata::class);
118+
$classMetadata = self::createStub(ClassMetadata::class);
119119
$classMetadata->method('hasAssociation')
120120
->with('fooProperty')
121121
->willReturn(false);
@@ -128,7 +128,7 @@ public function testFieldNotAssociation(): void
128128
class: 'FooEntity',
129129
target: new ForProperties(['fooProperty']),
130130
),
131-
reflectionMethod: $this->createMock(\ReflectionMethod::class),
131+
reflectionMethod: self::createStub(\ReflectionMethod::class),
132132
),
133133
classMetadata: $classMetadata,
134134
routeParams: [],
@@ -146,7 +146,7 @@ classMetadata: $classMetadata,
146146
public function testInvalidAssociationType(array $associationMapping): void
147147
{
148148
$resolver = new AssociationResolver(
149-
$this->createMock(PropertyReadInfoExtractorInterface::class),
149+
self::createStub(PropertyReadInfoExtractorInterface::class),
150150
);
151151

152152
$classMetadata = $this->createMock(ClassMetadata::class);
@@ -167,7 +167,7 @@ public function testInvalidAssociationType(array $associationMapping): void
167167
class: 'FooEntity',
168168
target: new ForProperties(['fooProperty']),
169169
),
170-
reflectionMethod: $this->createMock(\ReflectionMethod::class),
170+
reflectionMethod: self::createStub(\ReflectionMethod::class),
171171
),
172172
classMetadata: $classMetadata,
173173
routeParams: [],

tests/Cache/PropertyResolver/EmbeddableResolverDoctrine3Test.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function testResolveEmbeddable(): void
3838
],
3939
]);
4040

41-
$embeddableClassMetadata = $this->createMock(ClassMetadata::class);
41+
$embeddableClassMetadata = self::createStub(ClassMetadata::class);
4242
$embeddableClassMetadata->method('getFieldNames')
4343
->willReturn(['foo', 'bar']);
4444

@@ -48,7 +48,7 @@ public function testResolveEmbeddable(): void
4848
->with('BarEntity')
4949
->willReturn($embeddableClassMetadata);
5050

51-
$managerRegistry = $this->createMock(ManagerRegistry::class);
51+
$managerRegistry = self::createStub(ManagerRegistry::class);
5252
$managerRegistry->method('getManagerForClass')
5353
->with('ParentClass')
5454
->willReturn($entityManager);
@@ -63,7 +63,7 @@ public function testResolveEmbeddable(): void
6363
class: 'FooEntity',
6464
target: new ForProperties(['foo']),
6565
),
66-
reflectionMethod: $this->createMock(\ReflectionMethod::class),
66+
reflectionMethod: self::createStub(\ReflectionMethod::class),
6767
),
6868
classMetadata: $classMetadata,
6969
routeParams: [],
@@ -116,7 +116,7 @@ public function testEmbeddableMetadataNotFound(): void
116116
class: 'FooEntity',
117117
target: new ForProperties(['foo']),
118118
),
119-
reflectionMethod: $this->createMock(\ReflectionMethod::class),
119+
reflectionMethod: self::createStub(\ReflectionMethod::class),
120120
),
121121
classMetadata: $classMetadata,
122122
routeParams: [],

tests/Cache/PropertyResolver/MethodResolverTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ public function testResolveMethod(string $target, int $invocationCount): void
4040
));
4141

4242
$resolver = new MethodResolver(
43-
[new PropertyResolver($this->createMock(ManagerRegistry::class))],
43+
[new PropertyResolver(self::createStub(ManagerRegistry::class))],
4444
$propertyReadInfoExtractor,
4545
);
4646

47-
$classMetadata = $this->createMock(ClassMetadata::class);
47+
$classMetadata = self::createStub(ClassMetadata::class);
4848
$classMetadata->method('hasField')
4949
->willReturnCallback(fn (string $property) => match ($property) {
5050
'bar' => true,
@@ -59,7 +59,7 @@ public function testResolveMethod(string $target, int $invocationCount): void
5959
class: DummyEntity::class,
6060
target: new ForProperties([$target]),
6161
),
62-
reflectionMethod: $this->createMock(\ReflectionMethod::class),
62+
reflectionMethod: self::createStub(\ReflectionMethod::class),
6363
),
6464
classMetadata: $classMetadata,
6565
routeParams: [],
@@ -100,7 +100,7 @@ public function testTargetNotMethod(): void
100100
$propertyReadInfoExtractor,
101101
);
102102

103-
$classMetadata = $this->createMock(ClassMetadata::class);
103+
$classMetadata = self::createStub(ClassMetadata::class);
104104

105105
$purgeSubscriptions = $resolver->resolveSubscription(
106106
routeMetadata: new RouteMetadata(
@@ -110,7 +110,7 @@ public function testTargetNotMethod(): void
110110
class: DummyEntity::class,
111111
target: new ForProperties(['bar']),
112112
),
113-
reflectionMethod: $this->createMock(\ReflectionMethod::class),
113+
reflectionMethod: self::createStub(\ReflectionMethod::class),
114114
),
115115
classMetadata: $classMetadata,
116116
routeParams: [],

tests/Cache/PropertyResolver/PropertyResolverTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ final class PropertyResolverTest extends TestCase
2525
public function testResolveField(): void
2626
{
2727
$resolver = new PropertyResolver(
28-
managerRegistry: $this->createMock(ManagerRegistry::class),
28+
managerRegistry: self::createStub(ManagerRegistry::class),
2929
);
3030

31-
$classMetadata = $this->createMock(ClassMetadata::class);
31+
$classMetadata = self::createStub(ClassMetadata::class);
3232
$classMetadata->subClasses = [];
3333
$classMetadata->method('hasField')
3434
->with('fooProperty')
@@ -42,7 +42,7 @@ public function testResolveField(): void
4242
class: 'FooEntity',
4343
target: new ForProperties(['fooProperty']),
4444
),
45-
reflectionMethod: $this->createMock(\ReflectionMethod::class),
45+
reflectionMethod: self::createStub(\ReflectionMethod::class),
4646
),
4747
classMetadata: $classMetadata,
4848
routeParams: [],
@@ -64,10 +64,10 @@ classMetadata: $classMetadata,
6464
public function testTargetNotField(): void
6565
{
6666
$resolver = new PropertyResolver(
67-
managerRegistry: $this->createMock(ManagerRegistry::class),
67+
managerRegistry: self::createStub(ManagerRegistry::class),
6868
);
6969

70-
$classMetadata = $this->createMock(ClassMetadata::class);
70+
$classMetadata = self::createStub(ClassMetadata::class);
7171
$classMetadata->subClasses = [];
7272
$classMetadata->method('hasField')
7373
->with('fooProperty')
@@ -81,7 +81,7 @@ public function testTargetNotField(): void
8181
class: 'FooEntity',
8282
target: new ForProperties(['fooProperty']),
8383
),
84-
reflectionMethod: $this->createMock(\ReflectionMethod::class),
84+
reflectionMethod: self::createStub(\ReflectionMethod::class),
8585
),
8686
classMetadata: $classMetadata,
8787
routeParams: [],
@@ -98,10 +98,10 @@ classMetadata: $classMetadata,
9898
public function testResolveAssociation(): void
9999
{
100100
$resolver = new PropertyResolver(
101-
managerRegistry: $this->createMock(ManagerRegistry::class),
101+
managerRegistry: self::createStub(ManagerRegistry::class),
102102
);
103103

104-
$classMetadata = $this->createMock(ClassMetadata::class);
104+
$classMetadata = self::createStub(ClassMetadata::class);
105105
$classMetadata->subClasses = [];
106106
$classMetadata->method('hasField')
107107
->with('fooProperty')
@@ -124,7 +124,7 @@ public function testResolveAssociation(): void
124124
class: 'FooEntity',
125125
target: new ForProperties(['fooProperty']),
126126
),
127-
reflectionMethod: $this->createMock(\ReflectionMethod::class),
127+
reflectionMethod: self::createStub(\ReflectionMethod::class),
128128
),
129129
classMetadata: $classMetadata,
130130
routeParams: [],
@@ -182,7 +182,7 @@ public function testResolveFieldFromSubClass(): void
182182
class: 'FooEntity',
183183
target: new ForProperties(['fooProperty']),
184184
),
185-
reflectionMethod: $this->createMock(\ReflectionMethod::class),
185+
reflectionMethod: self::createStub(\ReflectionMethod::class),
186186
),
187187
classMetadata: $classMetadata,
188188
routeParams: [],
@@ -256,7 +256,7 @@ public function testResolveAssociationFromSubClass(): void
256256
class: 'FooEntity',
257257
target: new ForProperties(['fooProperty']),
258258
),
259-
reflectionMethod: $this->createMock(\ReflectionMethod::class),
259+
reflectionMethod: self::createStub(\ReflectionMethod::class),
260260
),
261261
classMetadata: $classMetadata,
262262
routeParams: [],
@@ -329,7 +329,7 @@ public function testResolveFieldFromChildOfMappedSuperclass(): void
329329
class: DummyEntity::class,
330330
target: new ForProperties(['foo']),
331331
),
332-
reflectionMethod: $this->createMock(\ReflectionMethod::class),
332+
reflectionMethod: self::createStub(\ReflectionMethod::class),
333333
),
334334
classMetadata: $classMetadata,
335335
routeParams: [],

tests/Cache/RouteMetadata/AttributeMetadataProviderTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function testRouteMetadata(): void
3838
$collection->add(name: 'foo_bar', route: $fooBarRoute);
3939
$collection->add(name: 'foo_baz', route: $fooBazRoute);
4040

41-
$router = $this->createMock(RouterInterface::class);
41+
$router = self::createStub(RouterInterface::class);
4242
$router->method('getRouteCollection')
4343
->willReturn($collection);
4444

@@ -125,7 +125,7 @@ public function testRouteMetadataWitExplicitRoute(): void
125125
$collection->add(name: 'foo_baz2', route: $fooBazRoute2);
126126
$collection->add(name: 'foo_baz3', route: $fooBazRoute3);
127127

128-
$router = $this->createMock(RouterInterface::class);
128+
$router = self::createStub(RouterInterface::class);
129129
$router->method('getRouteCollection')
130130
->willReturn($collection);
131131

@@ -184,7 +184,7 @@ public function testRouteMetadataOnClass(): void
184184
$collection->add(name: 'foo', route: $fooRoute);
185185
$collection->add(name: 'foo_bar', route: $fooBarRoute);
186186

187-
$router = $this->createMock(RouterInterface::class);
187+
$router = self::createStub(RouterInterface::class);
188188
$router->method('getRouteCollection')
189189
->willReturn($collection);
190190

@@ -224,7 +224,7 @@ classMap: [
224224

225225
public function testNotResolvableController(): void
226226
{
227-
$router = $this->createMock(RouterInterface::class);
227+
$router = self::createStub(RouterInterface::class);
228228

229229
$collection = new RouteCollection();
230230

@@ -270,7 +270,7 @@ public function testRouteIgnorePattern(): void
270270
$collection->add(name: 'foo_bar', route: $fooBarRoute);
271271
$collection->add(name: 'foo_baz', route: $fooBazRoute);
272272

273-
$router = $this->createMock(RouterInterface::class);
273+
$router = self::createStub(RouterInterface::class);
274274
$router->method('getRouteCollection')
275275
->willReturn($collection);
276276

@@ -299,7 +299,7 @@ public function testRouteWithNoController(): void
299299

300300
$collection->add(name: 'foo_bar', route: $fooBarRoute);
301301

302-
$router = $this->createMock(RouterInterface::class);
302+
$router = self::createStub(RouterInterface::class);
303303
$router->method('getRouteCollection')
304304
->willReturn($collection);
305305

0 commit comments

Comments
 (0)