44
55namespace PetrKnap \Binary \Coder ;
66
7- use PetrKnap \Shorts \Exception \MissingRequirement ;
87use PHPUnit \Framework \Attributes \DataProvider ;
98
109final class ChecksumTest extends CoderTestCase
@@ -21,9 +20,9 @@ public static function data(): array
2120 #[DataProvider('data ' )]
2221 public function testEncodes (string $ decoded , string $ encoded , string $ algorithm ): void
2322 {
24- self ::assertSame (
23+ self ::assertBinarySame (
2524 $ encoded ,
26- self :: getChecksum ( )->encode (
25+ ( new Checksum () )->encode (
2726 $ decoded ,
2827 algorithm: $ algorithm ,
2928 ),
@@ -35,7 +34,7 @@ public function testEncodeThrows(string $algorithm): void
3534 {
3635 self ::expectException (Exception \CoderCouldNotEncodeData::class);
3736
38- self :: getChecksum ( )->encode (
37+ ( new Checksum () )->encode (
3938 self ::getDecodedData (),
4039 algorithm: $ algorithm ,
4140 );
@@ -51,9 +50,9 @@ public static function dataEncodeThrows(): array
5150 #[DataProvider('data ' )]
5251 public function testDecodes (string $ decoded , string $ encoded , string $ algorithm ): void
5352 {
54- self ::assertSame (
53+ self ::assertBinarySame (
5554 $ decoded ,
56- self :: getChecksum ( )->decode (
55+ ( new Checksum () )->decode (
5756 $ encoded ,
5857 algorithm: $ algorithm ,
5958 ),
@@ -65,7 +64,7 @@ public function testDecodeThrows(string $data, string $algorithm): void
6564 {
6665 self ::expectException (Exception \CoderCouldNotDecodeData::class);
6766
68- self :: getChecksum ( )->decode (
67+ ( new Checksum () )->decode (
6968 $ data ,
7069 algorithm: $ algorithm ,
7170 );
@@ -80,13 +79,4 @@ public static function dataDecodeThrows(): array
8079 'wrong checksum ' => ['? ' . self ::getEncodedData (), Checksum::DEFAULT_ALGORITHM ],
8180 ];
8281 }
83-
84- private static function getChecksum (): Checksum
85- {
86- try {
87- return new Checksum ();
88- } catch (MissingRequirement $ reason ) {
89- self ::markTestSkipped ($ reason ->getMessage ());
90- }
91- }
9282}
0 commit comments