Skip to content

Commit 9e0cc49

Browse files
authored
Merge pull request #43 from web-auth/4.1.x-merge-up-into-4.2.x_1FYZPetv
Merge release 4.1.3 into 4.2.x
2 parents a59084d + 8dd9fde commit 9e0cc49

File tree

8 files changed

+50
-79
lines changed

8 files changed

+50
-79
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"phpstan/phpstan-deprecation-rules": "^1.0",
3535
"phpstan/phpstan-phpunit": "^1.1",
3636
"phpstan/phpstan-strict-rules": "^1.2",
37-
"phpunit/phpunit": "^9.5",
37+
"phpunit/phpunit": "^10.0",
3838
"rector/rector": "^0.15",
3939
"symplify/easy-coding-standard": "^11.0",
4040
"symfony/phpunit-bridge": "^6.1",

phpunit.xml.dist

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,26 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
45
colors="true"
6+
cacheDirectory=".phpunit.cache"
57
>
6-
<coverage processUncoveredFiles="true">
8+
<coverage>
79
<include>
810
<directory suffix=".php">src</directory>
911
</include>
1012
</coverage>
11-
1213
<testsuites>
1314
<testsuite name="all">
1415
<directory>tests/</directory>
1516
</testsuite>
1617
</testsuites>
17-
1818
<php>
19-
<ini name="display_errors" value="1" />
19+
<ini name="display_errors" value="1"/>
2020
<ini name="error_reporting" value="-1"/>
2121
<ini name="memory_limit" value="-1"/>
22-
<server name="APP_ENV" value="test" force="true" />
23-
<server name="SHELL_VERBOSITY" value="-1" />
22+
<server name="APP_ENV" value="test" force="true"/>
23+
<server name="SHELL_VERBOSITY" value="-1"/>
2424
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/>
2525
</php>
26-
<listeners>
27-
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
28-
<listener class="Symfony\Bridge\PhpUnit\CoverageListener" />
29-
</listeners>
3026
</phpunit>

rector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
return static function (RectorConfig $config): void {
1414
$config->import(SetList::DEAD_CODE);
1515
$config->import(LevelSetList::UP_TO_PHP_81);
16-
$config->import(SymfonyLevelSetList::UP_TO_SYMFONY_60);
16+
$config->import(SymfonyLevelSetList::UP_TO_SYMFONY_62);
1717
$config->import(SymfonySetList::SYMFONY_CODE_QUALITY);
1818
$config->import(SymfonySetList::SYMFONY_52_VALIDATOR_ATTRIBUTES);
1919
$config->import(SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION);
2020
$config->import(SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES);
2121
$config->import(PHPUnitSetList::PHPUNIT_EXCEPTION);
2222
$config->import(PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD);
23-
$config->import(PHPUnitSetList::PHPUNIT_91);
23+
$config->import(PHPUnitSetList::PHPUNIT_100);
2424
$config->import(PHPUnitSetList::PHPUNIT_YIELD_DATA_PROVIDER);
2525
$config->paths([__DIR__ . '/src', __DIR__ . '/tests']);
2626
$config->phpVersion(PhpVersion::PHP_81);

tests/Algorithm/Mac/HmacTest.php

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
use Cose\Key\OkpKey;
1313
use Cose\Key\SymmetricKey;
1414
use InvalidArgumentException;
15+
use PHPUnit\Framework\Attributes\DataProvider;
16+
use PHPUnit\Framework\Attributes\Test;
1517
use PHPUnit\Framework\TestCase;
1618
use function Safe\base64_decode;
1719

1820
final class HmacTest extends TestCase
1921
{
20-
/**
21-
* @test
22-
* @dataProvider getVectors
23-
*/
22+
#[Test]
23+
#[DataProvider('getVectors')]
2424
public function theAlgorithsmHaveCorrectInnerParameters(): void
2525
{
2626
// Then
@@ -30,10 +30,8 @@ public function theAlgorithsmHaveCorrectInnerParameters(): void
3030
static::assertSame(7, HS512::identifier());
3131
}
3232

33-
/**
34-
* @test
35-
* @dataProvider getVectors
36-
*/
33+
#[Test]
34+
#[DataProvider('getVectors')]
3735
public function aMacCanBeComputed(Hmac $algorithm, string $k, string $data, string $expectedHash): void
3836
{
3937
// Given
@@ -51,10 +49,8 @@ public function aMacCanBeComputed(Hmac $algorithm, string $k, string $data, stri
5149
static::assertSame($expectedHash, $hash);
5250
}
5351

54-
/**
55-
* @test
56-
* @dataProvider getVectors
57-
*/
52+
#[Test]
53+
#[DataProvider('getVectors')]
5854
public function aMacCanBeVerified(Hmac $algorithm, string $k, string $data, string $hash): void
5955
{
6056
// Given
@@ -70,9 +66,7 @@ public function aMacCanBeVerified(Hmac $algorithm, string $k, string $data, stri
7066
static::assertTrue($isValid);
7167
}
7268

73-
/**
74-
* @test
75-
*/
69+
#[Test]
7670
public function theKeyTypeIsInvalid(): void
7771
{
7872
// Then
@@ -94,9 +88,7 @@ public function theKeyTypeIsInvalid(): void
9488
);
9589
}
9690

97-
/**
98-
* @test
99-
*/
91+
#[Test]
10092
public function theKeyDataIsInvalid(): void
10193
{
10294
// Then
@@ -119,7 +111,7 @@ public function theKeyDataIsInvalid(): void
119111
/**
120112
* @return array<string>[]
121113
*/
122-
public function getVectors(): iterable
114+
public static function getVectors(): iterable
123115
{
124116
yield [
125117
HS256::create(),

tests/Algorithm/Signature/ECDSA/ECDSATest.php

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
use Cose\Key\Ec2Key;
1313
use Cose\Key\OkpKey;
1414
use InvalidArgumentException;
15+
use PHPUnit\Framework\Attributes\DataProvider;
16+
use PHPUnit\Framework\Attributes\Test;
1517
use PHPUnit\Framework\TestCase;
1618

1719
final class ECDSATest extends TestCase
1820
{
19-
/**
20-
* @test
21-
*/
21+
#[Test]
2222
public function theAlgorithmsHaveCorrectInnerParameters(): void
2323
{
2424
// Then
@@ -28,10 +28,8 @@ public function theAlgorithmsHaveCorrectInnerParameters(): void
2828
static::assertSame(-36, ES512::identifier());
2929
}
3030

31-
/**
32-
* @test
33-
* @dataProvider getVectors
34-
*/
31+
#[Test]
32+
#[DataProvider('getVectors')]
3533
public function aSignatureCanBeComputedAndVerified(
3634
ECDSA $algorithm,
3735
int $curve,
@@ -57,10 +55,8 @@ public function aSignatureCanBeComputedAndVerified(
5755
static::assertTrue($isValid);
5856
}
5957

60-
/**
61-
* @test
62-
* @dataProvider getVectors
63-
*/
58+
#[Test]
59+
#[DataProvider('getVectors')]
6460
public function aSignatureCanBeVerified(
6561
ECDSA $algorithm,
6662
int $curve,
@@ -86,9 +82,7 @@ public function aSignatureCanBeVerified(
8682
static::assertTrue($isValid);
8783
}
8884

89-
/**
90-
* @test
91-
*/
85+
#[Test]
9286
public function theKeyTypeIsNotValid(): void
9387
{
9488
// Then
@@ -110,9 +104,7 @@ public function theKeyTypeIsNotValid(): void
110104
);
111105
}
112106

113-
/**
114-
* @test
115-
*/
107+
#[Test]
116108
public function theKeyCurveTypeIsNotValid(): void
117109
{
118110
// Then
@@ -139,7 +131,7 @@ public function theKeyCurveTypeIsNotValid(): void
139131
/**
140132
* @return array<string>[]
141133
*/
142-
public function getVectors(): iterable
134+
public static function getVectors(): iterable
143135
{
144136
yield [
145137
'alg' => ES256::create(),

tests/Algorithm/Signature/EdDSA/EdDSATest.php

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
use Cose\Algorithm\Signature\EdDSA\Ed512;
1010
use Cose\Algorithm\Signature\EdDSA\EdDSA;
1111
use Cose\Key\OkpKey;
12+
use PHPUnit\Framework\Attributes\DataProvider;
13+
use PHPUnit\Framework\Attributes\Test;
1214
use PHPUnit\Framework\TestCase;
1315

1416
final class EdDSATest extends TestCase
1517
{
16-
/**
17-
* @test
18-
*/
18+
#[Test]
1919
public function theAlgorithmsHaveCorrectInnerParameters(): void
2020
{
2121
// Then
@@ -24,10 +24,8 @@ public function theAlgorithmsHaveCorrectInnerParameters(): void
2424
static::assertSame(-8, Ed25519::identifier());
2525
}
2626

27-
/**
28-
* @test
29-
* @dataProvider getVectors
30-
*/
27+
#[Test]
28+
#[DataProvider('getVectors')]
3129
public function aSignatureCanBeComputedAndVerified(
3230
EdDSA $algorithm,
3331
int $curve,
@@ -51,10 +49,8 @@ public function aSignatureCanBeComputedAndVerified(
5149
static::assertTrue($isValid);
5250
}
5351

54-
/**
55-
* @test
56-
* @dataProvider getVectors
57-
*/
52+
#[Test]
53+
#[DataProvider('getVectors')]
5854
public function aSignatureCanBeVerified(
5955
EdDSA $algorithm,
6056
int $curve,
@@ -81,7 +77,7 @@ public function aSignatureCanBeVerified(
8177
/**
8278
* @return array<string>[]
8379
*/
84-
public function getVectors(): iterable
80+
public static function getVectors(): iterable
8581
{
8682
yield [
8783
'alg' => Ed25519::create(),

tests/Algorithm/Signature/RSA/RSATest.php

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
use Cose\Algorithm\Signature\RSA\RS512;
1515
use Cose\Algorithm\Signature\RSA\RSA;
1616
use Cose\Key\RsaKey;
17+
use PHPUnit\Framework\Attributes\DataProvider;
18+
use PHPUnit\Framework\Attributes\Test;
1719
use PHPUnit\Framework\TestCase;
1820

1921
final class RSATest extends TestCase
2022
{
21-
/**
22-
* @test
23-
*/
23+
#[Test]
2424
public function theAlgorithmsHaveCorrectInnerParameters(): void
2525
{
2626
// Then
@@ -33,10 +33,8 @@ public function theAlgorithmsHaveCorrectInnerParameters(): void
3333
static::assertSame(-39, PS512::identifier());
3434
}
3535

36-
/**
37-
* @test
38-
* @dataProvider getVectors
39-
*/
36+
#[Test]
37+
#[DataProvider('getVectors')]
4038
public function aSignatureCanBeComputedAndVerified(RSA|PSSRSA $algorithm, RsaKey $key, string $data): void
4139
{
4240
// Given
@@ -49,10 +47,8 @@ public function aSignatureCanBeComputedAndVerified(RSA|PSSRSA $algorithm, RsaKey
4947
static::assertTrue($isValid);
5048
}
5149

52-
/**
53-
* @test
54-
* @dataProvider getVectors
55-
*/
50+
#[Test]
51+
#[DataProvider('getVectors')]
5652
public function aSignatureCanBeVerified(RSA|PSSRSA $algorithm, RsaKey $key, string $data, string $signature): void
5753
{
5854
// Given
@@ -67,7 +63,7 @@ public function aSignatureCanBeVerified(RSA|PSSRSA $algorithm, RsaKey $key, stri
6763
/**
6864
* @return array<string>[]
6965
*/
70-
public function getVectors(): iterable
66+
public static function getVectors(): iterable
7167
{
7268
$key1 = RsaKey::create([
7369
RsaKey::TYPE => RsaKey::TYPE_RSA,

tests/Key/RSAKeyTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66

77
use Cose\Algorithm\Signature\RSA\RS256;
88
use Cose\Key\RsaKey;
9+
use PHPUnit\Framework\Attributes\Test;
910
use PHPUnit\Framework\TestCase;
1011

1112
final class RSAKeyTest extends TestCase
1213
{
13-
/**
14-
* @test
15-
*/
14+
#[Test]
1615
public function theKeyIsCorrectlyEncoded(): void
1716
{
1817
// Given

0 commit comments

Comments
 (0)