Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
petrknap committed Nov 2, 2024
1 parent 4869812 commit da52724
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tests/Coder/CoderTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,32 @@
namespace PetrKnap\Binary\Coder;

use LogicException;
use PetrKnap\Binary\DecoderTest;
use PetrKnap\Binary\EncoderTest;
use PetrKnap\Binary\TestCase;

abstract class CoderTestCase extends TestCase
{
public const DATA_BASE64 = '2jmj7l5rSw0yVb/vlWAYkK/YBwnaOaPuXmtLDTJVv++VYBiQr9gHCdo5o+5ea0sNMlW/75VgGJCv2AcJ';

abstract public static function data(): array;
protected const DATA_BASE64 = '2jmj7l5rSw0yVb/vlWAYkK/YBwnaOaPuXmtLDTJVv++VYBiQr9gHCdo5o+5ea0sNMlW/75VgGJCv2AcJ';

/**
* @internal reused in {@see EncoderTest} and {@see DecoderTest}
*/
public static function getDecodedData(): string
{
return base64_decode(self::DATA_BASE64);
}

/**
* @internal reused in {@see EncoderTest} and {@see DecoderTest}
*/
public static function getEncodedData(): string
{
foreach (static::data() as $data) {
return $data[1];
}
throw new LogicException('Empty data set.');
}

abstract public static function data(): array;
}

0 comments on commit da52724

Please sign in to comment.