diff --git a/tests/ChecksumBarcodeTest.php b/tests/ChecksumBarcodeTest.php new file mode 100644 index 0000000..9a83b9a --- /dev/null +++ b/tests/ChecksumBarcodeTest.php @@ -0,0 +1,37 @@ + TypeEan13::class, 'barcodes' => [ + '081231723897' => '0812317238973', + '004900000463' => '0049000004632', + ]], + ['type' => TypeITF14::class, 'barcodes' => [ + '0001234560001' => '00012345600012', + '0540014128876' => '05400141288766', + ]], + ]; + + public function testAllSupportedBarcodeTypes() + { + foreach ($this::$supportedBarcodes as $barcodeTestSet) { + $barcodeType = $this->getBarcodeType($barcodeTestSet['type']); + + foreach ($barcodeTestSet['barcodes'] as $testBarcode => $expectedBarcode) { + $this->assertEquals($barcodeType->getBarcodeData($testBarcode)->getBarcode(), $expectedBarcode); + } + } + } + + + private function getBarcodeType(string $typeClass): TypeInterface + { + return new $typeClass; + } +}