diff --git a/src/Types/TypeCode39.php b/src/Types/TypeCode39.php index cce4e82b..5a4a2d27 100644 --- a/src/Types/TypeCode39.php +++ b/src/Types/TypeCode39.php @@ -70,8 +70,6 @@ public function getBarcodeData(string $code): Barcode throw new InvalidLengthException('You should provide a barcode string.'); } - $code = strtoupper($code); - if ($this->extended) { // extended mode $code = $this->encode_code39_ext($code); diff --git a/tests/TypesTest.php b/tests/TypesTest.php index 16b30834..6bc78609 100644 --- a/tests/TypesTest.php +++ b/tests/TypesTest.php @@ -7,19 +7,27 @@ class TypesTest extends TestCase public function test_generator_can_generate_code_39_barcode() { $generator = new Picqer\Barcode\BarcodeGeneratorSVG(); - $result = $generator->getBarcode('1234567890abcABC', $generator::TYPE_CODE_39); + $result = $generator->getBarcode('1234567890ABC', $generator::TYPE_CODE_39); - $this->assertStringEqualsFile('tests/verified-files/C39-1234567890abcABC.svg', $result); + $this->assertStringEqualsFile('tests/verified-files/C39-1234567890ABC.svg', $result); } public function test_generator_can_generate_code_39_checksum_barcode() { $generator = new Picqer\Barcode\BarcodeGeneratorSVG(); - $result = $generator->getBarcode('1234567890abcABC', $generator::TYPE_CODE_39_CHECKSUM); + $result = $generator->getBarcode('1234567890ABC', $generator::TYPE_CODE_39_CHECKSUM); $this->assertGreaterThan(100, strlen($result)); } + public function test_generator_can_generate_code_39_extended_barcode() + { + $generator = new Picqer\Barcode\BarcodeGeneratorSVG(); + $result = $generator->getBarcode('1234567890abcABC', $generator::TYPE_CODE_39E); + + $this->assertStringEqualsFile('tests/verified-files/C39E-1234567890abcABC.svg', $result); + } + public function test_generator_can_generate_code_39_extended_checksum_barcode() { $generator = new Picqer\Barcode\BarcodeGeneratorSVG(); diff --git a/tests/VerifiedBarcodeTest.php b/tests/VerifiedBarcodeTest.php index 95e4ae34..9c6ac3e8 100644 --- a/tests/VerifiedBarcodeTest.php +++ b/tests/VerifiedBarcodeTest.php @@ -14,8 +14,9 @@ class VerifiedBarcodeTest extends TestCase { public static $supportedBarcodes = [ - ['type' => BarcodeGenerator::TYPE_CODE_39, 'barcodes' => ['1234567890abcABC']], - ['type' => BarcodeGenerator::TYPE_CODE_39_CHECKSUM, 'barcodes' => ['1234567890abcABC']], + ['type' => BarcodeGenerator::TYPE_CODE_39, 'barcodes' => ['1234567890ABC']], + ['type' => BarcodeGenerator::TYPE_CODE_39_CHECKSUM, 'barcodes' => ['1234567890ABC']], + ['type' => BarcodeGenerator::TYPE_CODE_39E, 'barcodes' => ['1234567890abcABC']], ['type' => BarcodeGenerator::TYPE_CODE_39E_CHECKSUM, 'barcodes' => ['1234567890abcABC']], ['type' => BarcodeGenerator::TYPE_CODE_93, 'barcodes' => ['1234567890abcABC']], ['type' => BarcodeGenerator::TYPE_STANDARD_2_5, 'barcodes' => ['1234567890']], diff --git a/tests/verified-files/C39-1234567890abcABC.svg b/tests/verified-files/C39+-1234567890ABC.svg similarity index 78% rename from tests/verified-files/C39-1234567890abcABC.svg rename to tests/verified-files/C39+-1234567890ABC.svg index a1b97924..280551ac 100644 --- a/tests/verified-files/C39-1234567890abcABC.svg +++ b/tests/verified-files/C39+-1234567890ABC.svg @@ -1,7 +1,7 @@ - - *1234567890ABCABC* + + *1234567890ABCZ* @@ -73,25 +73,15 @@ - - - - - + + + + + - - - - - - - - - - - - - - + + + + diff --git a/tests/verified-files/C39+-1234567890abcABC.svg b/tests/verified-files/C39-1234567890ABC.svg similarity index 74% rename from tests/verified-files/C39+-1234567890abcABC.svg rename to tests/verified-files/C39-1234567890ABC.svg index f5ae78de..448792d4 100644 --- a/tests/verified-files/C39+-1234567890abcABC.svg +++ b/tests/verified-files/C39-1234567890ABC.svg @@ -1,7 +1,7 @@ - - *1234567890ABCABCP* + + *1234567890ABC* @@ -73,30 +73,10 @@ - + - - - - - - - - - - - - - - - - - - - - - - - + + + diff --git a/tests/verified-files/C39E+-1234567890abcABC.svg b/tests/verified-files/C39E+-1234567890abcABC.svg index f5ae78de..a1a87c5d 100644 --- a/tests/verified-files/C39E+-1234567890abcABC.svg +++ b/tests/verified-files/C39E+-1234567890abcABC.svg @@ -1,7 +1,7 @@ - - *1234567890ABCABCP* + + *1234567890+A+B+CABCJ* @@ -58,45 +58,60 @@ - + - - - + + + - - - - + + + + - - + + - + - + - - - + + + - + - - - - + + + + + + + + + + + + + + + + + + + diff --git a/tests/verified-files/C39E-1234567890abcABC.svg b/tests/verified-files/C39E-1234567890abcABC.svg new file mode 100644 index 00000000..d85cc717 --- /dev/null +++ b/tests/verified-files/C39E-1234567890abcABC.svg @@ -0,0 +1,112 @@ + + + + *1234567890+A+B+CABC* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +