1212use Cose \Key \OkpKey ;
1313use Cose \Key \SymmetricKey ;
1414use InvalidArgumentException ;
15+ use PHPUnit \Framework \Attributes \DataProvider ;
16+ use PHPUnit \Framework \Attributes \Test ;
1517use PHPUnit \Framework \TestCase ;
1618use function Safe \base64_decode ;
1719
1820final 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 (),
0 commit comments