Skip to content
This repository was archived by the owner on Mar 25, 2024. It is now read-only.

Commit 58a97aa

Browse files
authored
Update PHPUnit (#28)
1 parent 31535c6 commit 58a97aa

19 files changed

Lines changed: 22 additions & 287 deletions

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"require-dev": {
1919
"phpstan/phpstan": "^0.12",
20-
"phpunit/phpunit": "^8.5",
20+
"phpunit/phpunit": "^8.5 || ^9.0",
2121
"squizlabs/php_codesniffer": "^3.2",
2222
"phpstan/phpstan-phpunit": "^0.12"
2323
},

phpstan-baseline.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ parameters:
2121
path: tests/ResponseTraitTest.php
2222

2323
-
24-
message: "#^Method class@anonymous/tests/ResponseTraitTest\\.php\\:18\\:\\:parseResponse\\(\\) has parameter \\$response with no value type specified in iterable type array\\.$#"
24+
message: "#^Method class@anonymous/tests/ResponseTraitTest\\.php\\:16\\:\\:parseResponse\\(\\) has parameter \\$response with no value type specified in iterable type array\\.$#"
2525
count: 1
2626
path: tests/ResponseTraitTest.php
2727

tests/AppIdTraitTest.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,11 @@
44
namespace Firehed\U2F;
55

66
/**
7-
* @coversDefaultClass Firehed\U2F\AppIdTrait
8-
* @covers ::<protected>
9-
* @covers ::<private>
7+
* @covers Firehed\U2F\AppIdTrait
108
*/
119
class AppIdTraitTest extends \PHPUnit\Framework\TestCase
1210
{
1311

14-
/**
15-
* @covers ::getAppId
16-
* @covers ::setAppId
17-
*/
1812
public function testAccessors(): void
1913
{
2014
$obj = new class {
@@ -34,9 +28,6 @@ public function testAccessors(): void
3428
);
3529
}
3630

37-
/**
38-
* @covers ::getApplicationParameter
39-
*/
4031
public function testGetApplicationParameter(): void
4132
{
4233
$obj = new class {
@@ -51,9 +42,6 @@ public function testGetApplicationParameter(): void
5142
);
5243
}
5344

54-
/**
55-
* @covers ::getRpIdHash
56-
*/
5745
public function testGetRpIdHash(): void
5846
{
5947
$obj = new class {

tests/AttestationCertificateTest.php

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,10 @@
44
namespace Firehed\U2F;
55

66
/**
7-
* @coversDefaultClass Firehed\U2F\AttestationCertificate
8-
* @covers ::<protected>
9-
* @covers ::<private>
7+
* @covers Firehed\U2F\AttestationCertificate
108
*/
119
class AttestationCertificateTest extends \PHPUnit\Framework\TestCase
1210
{
13-
/**
14-
* @covers ::__construct
15-
*/
1611
public function testConstruct(): void
1712
{
1813
// Note: a future, stricter implementation which actually parses and
@@ -23,9 +18,6 @@ public function testConstruct(): void
2318
$this->assertInstanceOf(AttestationCertificateInterface::class, $cert);
2419
}
2520

26-
/**
27-
* @covers ::getBinary
28-
*/
2921
public function testGetBinary(): void
3022
{
3123
$raw = random_bytes(128);
@@ -37,9 +29,6 @@ public function testGetBinary(): void
3729
);
3830
}
3931

40-
/**
41-
* @covers ::getPemFormatted
42-
*/
4332
public function testGetPemFormatted(): void
4433
{
4534
$raw = random_bytes(128);
@@ -54,9 +43,6 @@ public function testGetPemFormatted(): void
5443
);
5544
}
5645

57-
/**
58-
* @covers ::__debugInfo
59-
*/
6046
public function testDebugInfoEncodesBinary(): void
6147
{
6248
$cert = new AttestationCertificate(random_bytes(128));

tests/ChallengeTraitTest.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,11 @@
44
namespace Firehed\U2F;
55

66
/**
7-
* @coversDefaultClass Firehed\U2F\ChallengeTrait
8-
* @covers ::<protected>
9-
* @covers ::<private>
7+
* @covers Firehed\U2F\ChallengeTrait
108
*/
119
class ChallengeTraitTest extends \PHPUnit\Framework\TestCase
1210
{
1311

14-
/**
15-
* @covers ::getChallenge
16-
* @covers ::setChallenge
17-
*/
1812
public function testAccessors(): void
1913
{
2014
$obj = new class {

tests/ClientDataTest.php

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,10 @@
44
namespace Firehed\U2F;
55

66
/**
7-
* @coversDefaultClass Firehed\U2F\ClientData
8-
* @covers ::<protected>
9-
* @covers ::<private>
7+
* @covers Firehed\U2F\ClientData
108
*/
119
class ClientDataTest extends \PHPUnit\Framework\TestCase
1210
{
13-
/**
14-
* @covers ::fromJson
15-
*/
1611
public function testFromValidJson(): void
1712
{
1813
$goodData = [
@@ -27,9 +22,6 @@ public function testFromValidJson(): void
2722
$this->assertInstanceOf(ClientData::class, $clientData);
2823
}
2924

30-
/**
31-
* @covers ::getChallengeParameter
32-
*/
3325
public function testGetChallengeParameter(): void
3426
{
3527
$expected_param = base64_decode('exDPjyyKbizXMAAUNLpv0QYJNyXClbUqewUWojPtp0g=');
@@ -53,9 +45,6 @@ public function testGetChallengeParameter(): void
5345
);
5446
}
5547

56-
/**
57-
* @covers ::getApplicationParameter
58-
*/
5948
public function testGetApplicationParameter(): void
6049
{
6150
$goodData = [
@@ -73,9 +62,6 @@ public function testGetApplicationParameter(): void
7362
);
7463
}
7564

76-
/**
77-
* @covers ::fromJson
78-
*/
7965
public function testBadJson(): void
8066
{
8167
$json = 'this is not json';
@@ -85,7 +71,6 @@ public function testBadJson(): void
8571
}
8672

8773
/**
88-
* @covers ::fromJson
8974
* @dataProvider missingData
9075
*/
9176
public function testDataValidation(string $json): void

tests/ClientErrorExceptionTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@
44
namespace Firehed\U2F;
55

66
/**
7-
* @coversDefaultClass Firehed\U2F\ClientErrorException
8-
* @covers ::<protected>
9-
* @covers ::<private>
7+
* @covers Firehed\U2F\ClientErrorException
108
*/
119
class ClientErrorExceptionTest extends \PHPUnit\Framework\TestCase
1210
{
1311
/**
14-
* @covers ::__construct
1512
* @dataProvider clientErrors
1613
*/
1714
public function testClientError(int $code): void

tests/ECPublicKeyTest.php

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,17 @@
44
namespace Firehed\U2F;
55

66
/**
7-
* @coversDefaultClass Firehed\U2F\ECPublicKey
8-
* @covers ::<protected>
9-
* @covers ::<private>
7+
* @covers Firehed\U2F\ECPublicKey
108
*/
119
class ECPublicKeyTest extends \PHPUnit\Framework\TestCase
1210
{
13-
/**
14-
* @covers ::__construct
15-
*/
1611
public function testConstruct(): void
1712
{
1813
$key = "\x04".\random_bytes(64);
1914
$obj = new ECPublicKey($key);
2015
$this->assertInstanceOf(PublicKeyInterface::class, $obj);
2116
}
2217

23-
/**
24-
* @covers ::__construct
25-
*/
2618
public function testConstructThrowsWithBadFirstByte(): void
2719
{
2820
$key = "\x01".\random_bytes(64);
@@ -32,9 +24,6 @@ public function testConstructThrowsWithBadFirstByte(): void
3224
}
3325

3426

35-
/**
36-
* @covers ::__construct
37-
*/
3827
public function testConstructThrowsWhenTooShort(): void
3928
{
4029
$key = "\x04".random_bytes(63);
@@ -43,9 +32,6 @@ public function testConstructThrowsWhenTooShort(): void
4332
new ECPublicKey($key);
4433
}
4534

46-
/**
47-
* @covers ::__construct
48-
*/
4935
public function testConstructThrowsWhenTooLong(): void
5036
{
5137
$key = "\x04".random_bytes(65);
@@ -54,9 +40,6 @@ public function testConstructThrowsWhenTooLong(): void
5440
new ECPublicKey($key);
5541
}
5642

57-
/**
58-
* @covers ::getBinary
59-
*/
6043
public function testGetBinary(): void
6144
{
6245
$key = "\x04".\random_bytes(64);
@@ -68,9 +51,6 @@ public function testGetBinary(): void
6851
);
6952
}
7053

71-
/**
72-
* @covers ::getPemFormatted
73-
*/
7454
public function testGetPublicKeyPem(): void
7555
{
7656
$key = hex2bin(
@@ -88,9 +68,6 @@ public function testGetPublicKeyPem(): void
8868
$this->assertSame($pem, $obj->getPemFormatted());
8969
}
9070

91-
/**
92-
* @covers ::__debugInfo
93-
*/
9471
public function testDebugInfoEncodesBinary(): void
9572
{
9673
$x = random_bytes(32);

tests/InvalidDataExceptionTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@
44
namespace Firehed\U2F;
55

66
/**
7-
* @coversDefaultClass Firehed\U2F\InvalidDataException
8-
* @covers ::<protected>
9-
* @covers ::<private>
7+
* @covers Firehed\U2F\InvalidDataException
108
*/
119
class InvalidDataExceptionTest extends \PHPUnit\Framework\TestCase
1210
{
1311
/**
14-
* @covers ::__construct
1512
* @dataProvider invalidDataExceptionCodes
1613
*/
1714
public function testInvalidDataException(int $code): void

tests/KeyHandleTraitTest.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,10 @@
44
namespace Firehed\U2F;
55

66
/**
7-
* @coversDefaultClass Firehed\U2F\KeyHandleTrait
8-
* @covers ::<protected>
9-
* @covers ::<private>
7+
* @covers Firehed\U2F\KeyHandleTrait
108
*/
119
class KeyHandleTraitTest extends \PHPUnit\Framework\TestCase
1210
{
13-
/**
14-
* @covers ::getKeyHandleBinary
15-
* @covers ::setKeyHandle
16-
*/
1711
public function testAccessors(): void
1812
{
1913
$obj = new class {
@@ -32,9 +26,6 @@ public function testAccessors(): void
3226
);
3327
}
3428

35-
/**
36-
* @covers ::getKeyHandleWeb
37-
*/
3829
public function testGetKeyHandleWeb(): void
3930
{
4031
$obj = new class {

0 commit comments

Comments
 (0)