File tree Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace PetrKnap \Binary \Coder ;
6+
7+ /**
8+ * Special implementation of {@see CoderInterface} which does not code
9+ */
10+ final class NoCoder implements CoderInterface
11+ {
12+ public function encode (string $ decoded ): string
13+ {
14+ return $ decoded ;
15+ }
16+
17+ public function decode (string $ encoded ): string
18+ {
19+ return $ encoded ;
20+ }
21+ }
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types=1 );
2+
3+ namespace PetrKnap \Binary \Coder ;
4+
5+ use PHPUnit \Framework \Attributes \DataProvider ;
6+
7+ final class NoCoderTest extends CoderTestCase
8+ {
9+ public static function data (): array
10+ {
11+ return [[self ::getDecodedData ()]];
12+ }
13+
14+ #[DataProvider('data ' )]
15+ public function testEncodes (string $ data ): void
16+ {
17+ self ::assertSame (
18+ $ data ,
19+ (new NoCoder ())->encode ($ data ),
20+ );
21+ }
22+
23+ #[DataProvider('data ' )]
24+ public function testDecodes (string $ data ): void
25+ {
26+ self ::assertSame (
27+ $ data ,
28+ (new NoCoder ())->decode ($ data ),
29+ );
30+ }
31+ }
You can’t perform that action at this time.
0 commit comments