Skip to content

Commit 08100b2

Browse files
committed
Use PHPUnit 11
1 parent 03d76d7 commit 08100b2

File tree

7 files changed

+35
-52
lines changed

7 files changed

+35
-52
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
"symfony/dependency-injection": "^7.0"
2525
},
2626
"require-dev": {
27-
"phpstan/phpstan": "^1.10",
28-
"phpunit/phpunit": "^10.5",
27+
"phpstan/phpstan": "^1.12",
28+
"phpunit/phpunit": "^11.4",
2929
"symfony/config": "^7.0"
3030
},
3131
"autoload": {

phpunit.xml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
<?xml version="1.0"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
4-
colors="true"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.4/phpunit.xsd"
4+
beStrictAboutCoverageMetadata="true"
5+
beStrictAboutOutputDuringTests="true"
56
bootstrap="tests/bootstrap.php"
7+
colors="true"
68
displayDetailsOnTestsThatTriggerDeprecations="true"
9+
displayDetailsOnTestsThatTriggerNotices="true"
10+
displayDetailsOnTestsThatTriggerWarnings="true"
11+
displayDetailsOnPhpunitDeprecations="true"
12+
executionOrder="depends,defects"
713
>
814
<testsuites>
915
<testsuite name="olvlvl/symfony-dependency-injection-proxy">

tests/FactoryRendererTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@
1414
use olvlvl\SymfonyDependencyInjectionProxy\FactoryRenderer;
1515
use olvlvl\SymfonyDependencyInjectionProxy\MethodRenderer;
1616
use PHPUnit\Framework\Assert;
17+
use PHPUnit\Framework\Attributes\Group;
1718
use PHPUnit\Framework\TestCase;
1819
use ReflectionMethod;
1920
use Serializable;
2021

21-
/**
22-
* @group unit
23-
*/
22+
#[Group('unit')]
2423
final class FactoryRendererTest extends TestCase
2524
{
2625
public function testRender(): void

tests/IntegrationTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
namespace tests\olvlvl\SymfonyDependencyInjectionProxy;
1313

1414
use olvlvl\SymfonyDependencyInjectionProxy\ProxyDumper;
15+
use PHPUnit\Framework\Attributes\DataProvider;
16+
use PHPUnit\Framework\Attributes\Group;
1517
use PHPUnit\Framework\TestCase;
1618
use Psr\Container\ContainerInterface;
1719
use Symfony\Component\DependencyInjection\Alias;
@@ -29,16 +31,13 @@
2931

3032
use function uniqid;
3133

32-
/**
33-
* @group integration
34-
*/
34+
#[Group('integration')]
3535
final class IntegrationTest extends TestCase
3636
{
3737
/**
38-
* @dataProvider provideDefinition
39-
*
4038
* @param Definition[] $definitions
4139
*/
40+
#[DataProvider('provideDefinition')]
4241
public function testCompilation(array $definitions, callable $assert, ?callable $tweakBuilder = null): void
4342
{
4443
$builder = new ContainerBuilder();

tests/InterfaceResolver/BasicInterfaceResolverTest.php

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,25 @@
11
<?php
22

3-
/*
4-
* This file is part of the olvlvl/symfony-dependency-injection-proxy package.
5-
*
6-
* (c) Olivier Laviale <[email protected]>
7-
*
8-
* For the full copyright and license information, please view the LICENSE
9-
* file that was distributed with this source code.
10-
*/
11-
123
namespace tests\olvlvl\SymfonyDependencyInjectionProxy\InterfaceResolver;
134

145
use ArrayIterator;
156
use DateTimeImmutable;
167
use DateTimeInterface;
178
use LogicException;
189
use olvlvl\SymfonyDependencyInjectionProxy\InterfaceResolver\BasicInterfaceResolver;
10+
use PHPUnit\Framework\Attributes\DataProvider;
11+
use PHPUnit\Framework\Attributes\Group;
12+
use PHPUnit\Framework\Attributes\Test;
1913
use PHPUnit\Framework\TestCase;
2014
use Throwable;
2115

22-
/**
23-
* @group unit
24-
*/
16+
#[Group('unit')]
2517
final class BasicInterfaceResolverTest extends TestCase
2618
{
2719
/**
28-
* @test
2920
* @throws Throwable
3021
*/
22+
#[Test]
3123
public function shouldFailIfClassImplementsManyInterfaces(): void
3224
{
3325
$stu = new BasicInterfaceResolver();
@@ -40,9 +32,9 @@ public function shouldFailIfClassImplementsManyInterfaces(): void
4032
}
4133

4234
/**
43-
* @test
4435
* @throws Throwable
4536
*/
37+
#[Test]
4638
public function shouldFailIfClassDoesNotExist(): void
4739
{
4840
$stu = new BasicInterfaceResolver();
@@ -55,12 +47,11 @@ public function shouldFailIfClassDoesNotExist(): void
5547
}
5648

5749
/**
58-
* @dataProvider provideResolveInterface
59-
*
6050
* @param class-string $class
6151
*
6252
* @throws Throwable
6353
*/
54+
#[DataProvider('provideResolveInterface')]
6455
public function testResolveInterface(string $class, string $expected): void
6556
{
6657
$stu = new BasicInterfaceResolver();

tests/MethodRendererTest.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,18 @@
1212
namespace tests\olvlvl\SymfonyDependencyInjectionProxy;
1313

1414
use olvlvl\SymfonyDependencyInjectionProxy\MethodRenderer;
15+
use PHPUnit\Framework\Attributes\DataProvider;
16+
use PHPUnit\Framework\Attributes\Group;
1517
use PHPUnit\Framework\TestCase;
1618
use ReflectionMethod;
1719
use tests\olvlvl\SymfonyDependencyInjectionProxy\cases\SampleInterfaceForMethodRenderer70;
1820
use tests\olvlvl\SymfonyDependencyInjectionProxy\cases\SampleInterfaceForMethodRenderer72;
1921
use tests\olvlvl\SymfonyDependencyInjectionProxy\cases\SampleInterfaceForMethodRenderer80;
2022

21-
/**
22-
* @group unit
23-
*/
23+
#[Group('unit')]
2424
final class MethodRendererTest extends TestCase
2525
{
26-
/**
27-
* @dataProvider provideRender
28-
*/
26+
#[DataProvider('provideRender')]
2927
public function testRender(ReflectionMethod $method, string $getterCode, string $expected): void
3028
{
3129
$stu = new MethodRenderer();

tests/ProxyDumperTest.php

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
<?php
22

3-
/*
4-
* This file is part of the olvlvl/symfony-dependency-injection-proxy package.
5-
*
6-
* (c) Olivier Laviale <[email protected]>
7-
*
8-
* For the full copyright and license information, please view the LICENSE
9-
* file that was distributed with this source code.
10-
*/
11-
123
namespace tests\olvlvl\SymfonyDependencyInjectionProxy;
134

145
use ArrayAccess;
@@ -18,18 +9,17 @@
189
use olvlvl\SymfonyDependencyInjectionProxy\FactoryRenderer;
1910
use olvlvl\SymfonyDependencyInjectionProxy\InterfaceResolver;
2011
use olvlvl\SymfonyDependencyInjectionProxy\ProxyDumper;
12+
use PHPUnit\Framework\Attributes\DataProvider;
13+
use PHPUnit\Framework\Attributes\Group;
14+
use PHPUnit\Framework\Attributes\Test;
2115
use PHPUnit\Framework\TestCase;
2216
use Symfony\Component\DependencyInjection\Definition;
2317
use Throwable;
2418

25-
/**
26-
* @group unit
27-
*/
19+
#[Group('unit')]
2820
final class ProxyDumperTest extends TestCase
2921
{
30-
/**
31-
* @dataProvider provideIsProxyCandidate
32-
*/
22+
#[DataProvider('provideIsProxyCandidate')]
3323
public function testIsProxyCandidate(Definition $definition, bool $expected): void
3424
{
3525
$stu = new ProxyDumper(
@@ -64,9 +54,9 @@ public static function provideIsProxyCandidate(): array
6454
}
6555

6656
/**
67-
* @test
6857
* @throws Throwable
6958
*/
59+
#[Test]
7060
public function shouldFailIfFactoryCodeIsEmpty(): void
7161
{
7262
$stu = new ProxyDumper(
@@ -81,8 +71,8 @@ public function shouldFailIfFactoryCodeIsEmpty(): void
8171

8272
/**
8373
* @throws Throwable
84-
* @dataProvider provideGetProxyFactoryCode
8574
*/
75+
#[DataProvider('provideGetProxyFactoryCode')]
8676
public function testGetProxyFactoryCode(string $id, bool $private, bool $shared, string $expectedStore): void
8777
{
8878
$definition = (new Definition())
@@ -132,7 +122,7 @@ public static function provideGetProxyFactoryCode(): array
132122
}
133123

134124
/**
135-
* @see https://github.com/symfony/symfony/issues/28852
125+
* @link https://github.com/symfony/symfony/issues/28852
136126
*/
137127
public function testGetProxyCode(): void
138128
{

0 commit comments

Comments
 (0)