Initial import
This commit is contained in:
109
one-api/vendor/picqer/php-barcode-generator/tests/BarcodeTest.php
vendored
Normal file
109
one-api/vendor/picqer/php-barcode-generator/tests/BarcodeTest.php
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
class BarcodeTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function png_barcode_generator_can_generate_code_128_barcode()
|
||||
{
|
||||
$generator = new Picqer\Barcode\BarcodeGeneratorPNG();
|
||||
$generated = $generator->getBarcode('081231723897', $generator::TYPE_CODE_128);
|
||||
|
||||
$this->assertEquals('PNG', substr($generated, 1, 3));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function svg_barcode_generator_can_generate_ean_13_barcode()
|
||||
{
|
||||
$generator = new Picqer\Barcode\BarcodeGeneratorSVG();
|
||||
$generated = $generator->getBarcode('081231723897', $generator::TYPE_EAN_13);
|
||||
|
||||
$this->assertStringEqualsFile('tests/verified-files/081231723897-ean13.svg', $generated);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function html_barcode_generator_can_generate_code_128_barcode()
|
||||
{
|
||||
$generator = new Picqer\Barcode\BarcodeGeneratorHTML();
|
||||
$generated = $generator->getBarcode('081231723897', $generator::TYPE_CODE_128);
|
||||
|
||||
$this->assertStringEqualsFile('tests/verified-files/081231723897-code128.html', $generated);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function jpg_barcode_generator_can_generate_code_128_barcode()
|
||||
{
|
||||
$generator = new Picqer\Barcode\BarcodeGeneratorJPG();
|
||||
$generator->getBarcode('081231723897', $generator::TYPE_CODE_128);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @expectedException \Picqer\Barcode\Exceptions\InvalidCharacterException
|
||||
*/
|
||||
public function ean13_generator_throws_exception_if_invalid_chars_are_used()
|
||||
{
|
||||
$generator = new Picqer\Barcode\BarcodeGeneratorSVG();
|
||||
$generator->getBarcode('A123', $generator::TYPE_EAN_13);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function ean13_generator_accepting_13_chars()
|
||||
{
|
||||
$generator = new Picqer\Barcode\BarcodeGeneratorSVG();
|
||||
$generated = $generator->getBarcode('0049000004632', $generator::TYPE_EAN_13);
|
||||
|
||||
$this->assertStringEqualsFile('tests/verified-files/0049000004632-ean13.svg', $generated);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function ean13_generator_accepting_12_chars_and_generates_13th_check_digit()
|
||||
{
|
||||
$generator = new Picqer\Barcode\BarcodeGeneratorSVG();
|
||||
$generated = $generator->getBarcode('004900000463', $generator::TYPE_EAN_13);
|
||||
|
||||
$this->assertStringEqualsFile('tests/verified-files/0049000004632-ean13.svg', $generated);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function ean13_generator_accepting_11_chars_and_generates_13th_check_digit_and_adds_leading_zero()
|
||||
{
|
||||
$generator = new Picqer\Barcode\BarcodeGeneratorSVG();
|
||||
$generated = $generator->getBarcode('04900000463', $generator::TYPE_EAN_13);
|
||||
|
||||
$this->assertStringEqualsFile('tests/verified-files/0049000004632-ean13.svg', $generated);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @expectedException \Picqer\Barcode\Exceptions\InvalidCheckDigitException
|
||||
*/
|
||||
public function ean13_generator_throws_exception_when_wrong_check_digit_is_given()
|
||||
{
|
||||
$generator = new Picqer\Barcode\BarcodeGeneratorSVG();
|
||||
$generator->getBarcode('0049000004633', $generator::TYPE_EAN_13);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @expectedException \Picqer\Barcode\Exceptions\UnknownTypeException
|
||||
*/
|
||||
public function generator_throws_unknown_type_exceptions()
|
||||
{
|
||||
$generator = new Picqer\Barcode\BarcodeGeneratorSVG();
|
||||
$generator->getBarcode('0049000004633', 'vladimir');
|
||||
}
|
||||
}
|
||||
37
one-api/vendor/picqer/php-barcode-generator/tests/verified-files/0049000004632-ean13.svg
vendored
Normal file
37
one-api/vendor/picqer/php-barcode-generator/tests/verified-files/0049000004632-ean13.svg
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" standalone="no" ?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg width="190" height="30" viewBox="0 0 190 30" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||
<desc>0049000004632</desc>
|
||||
<g id="bars" fill="black" stroke="none">
|
||||
<rect x="0" y="0" width="2" height="30" />
|
||||
<rect x="4" y="0" width="2" height="30" />
|
||||
<rect x="12" y="0" width="4" height="30" />
|
||||
<rect x="18" y="0" width="2" height="30" />
|
||||
<rect x="22" y="0" width="2" height="30" />
|
||||
<rect x="30" y="0" width="4" height="30" />
|
||||
<rect x="40" y="0" width="2" height="30" />
|
||||
<rect x="44" y="0" width="4" height="30" />
|
||||
<rect x="54" y="0" width="4" height="30" />
|
||||
<rect x="60" y="0" width="2" height="30" />
|
||||
<rect x="68" y="0" width="4" height="30" />
|
||||
<rect x="74" y="0" width="2" height="30" />
|
||||
<rect x="82" y="0" width="4" height="30" />
|
||||
<rect x="88" y="0" width="2" height="30" />
|
||||
<rect x="92" y="0" width="2" height="30" />
|
||||
<rect x="96" y="0" width="2" height="30" />
|
||||
<rect x="100" y="0" width="6" height="30" />
|
||||
<rect x="110" y="0" width="2" height="30" />
|
||||
<rect x="114" y="0" width="6" height="30" />
|
||||
<rect x="124" y="0" width="2" height="30" />
|
||||
<rect x="128" y="0" width="2" height="30" />
|
||||
<rect x="132" y="0" width="6" height="30" />
|
||||
<rect x="142" y="0" width="2" height="30" />
|
||||
<rect x="146" y="0" width="2" height="30" />
|
||||
<rect x="156" y="0" width="2" height="30" />
|
||||
<rect x="166" y="0" width="2" height="30" />
|
||||
<rect x="170" y="0" width="4" height="30" />
|
||||
<rect x="176" y="0" width="4" height="30" />
|
||||
<rect x="184" y="0" width="2" height="30" />
|
||||
<rect x="188" y="0" width="2" height="30" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
32
one-api/vendor/picqer/php-barcode-generator/tests/verified-files/081231723897-code128.html
vendored
Normal file
32
one-api/vendor/picqer/php-barcode-generator/tests/verified-files/081231723897-code128.html
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<div style="font-size:0;position:relative;width:202px;height:30px;">
|
||||
<div style="background-color:black;width:4px;height:30px;position:absolute;left:0px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:2px;height:30px;position:absolute;left:6px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:6px;height:30px;position:absolute;left:12px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:2px;height:30px;position:absolute;left:22px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:4px;height:30px;position:absolute;left:30px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:2px;height:30px;position:absolute;left:38px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:2px;height:30px;position:absolute;left:44px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:4px;height:30px;position:absolute;left:48px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:6px;height:30px;position:absolute;left:56px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:4px;height:30px;position:absolute;left:66px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:4px;height:30px;position:absolute;left:72px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:4px;height:30px;position:absolute;left:82px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:2px;height:30px;position:absolute;left:88px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:4px;height:30px;position:absolute;left:94px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:2px;height:30px;position:absolute;left:106px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:2px;height:30px;position:absolute;left:110px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:4px;height:30px;position:absolute;left:118px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:2px;height:30px;position:absolute;left:128px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:8px;height:30px;position:absolute;left:132px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:2px;height:30px;position:absolute;left:142px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:2px;height:30px;position:absolute;left:146px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:6px;height:30px;position:absolute;left:154px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:2px;height:30px;position:absolute;left:162px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:4px;height:30px;position:absolute;left:166px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:4px;height:30px;position:absolute;left:176px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:6px;height:30px;position:absolute;left:186px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:2px;height:30px;position:absolute;left:194px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:4px;height:30px;position:absolute;left:198px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:0px;height:30px;position:absolute;left:202px;top:0px;"> </div>
|
||||
<div style="background-color:black;width:0px;height:30px;position:absolute;left:202px;top:0px;"> </div>
|
||||
</div>
|
||||
37
one-api/vendor/picqer/php-barcode-generator/tests/verified-files/081231723897-ean13.svg
vendored
Normal file
37
one-api/vendor/picqer/php-barcode-generator/tests/verified-files/081231723897-ean13.svg
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" standalone="no" ?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg width="190" height="30" viewBox="0 0 190 30" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||
<desc>0812317238973</desc>
|
||||
<g id="bars" fill="black" stroke="none">
|
||||
<rect x="0" y="0" width="2" height="30" />
|
||||
<rect x="4" y="0" width="2" height="30" />
|
||||
<rect x="8" y="0" width="4" height="30" />
|
||||
<rect x="14" y="0" width="6" height="30" />
|
||||
<rect x="24" y="0" width="4" height="30" />
|
||||
<rect x="32" y="0" width="2" height="30" />
|
||||
<rect x="38" y="0" width="2" height="30" />
|
||||
<rect x="44" y="0" width="4" height="30" />
|
||||
<rect x="50" y="0" width="8" height="30" />
|
||||
<rect x="60" y="0" width="2" height="30" />
|
||||
<rect x="66" y="0" width="4" height="30" />
|
||||
<rect x="74" y="0" width="2" height="30" />
|
||||
<rect x="78" y="0" width="6" height="30" />
|
||||
<rect x="86" y="0" width="4" height="30" />
|
||||
<rect x="92" y="0" width="2" height="30" />
|
||||
<rect x="96" y="0" width="2" height="30" />
|
||||
<rect x="100" y="0" width="4" height="30" />
|
||||
<rect x="106" y="0" width="4" height="30" />
|
||||
<rect x="114" y="0" width="2" height="30" />
|
||||
<rect x="124" y="0" width="2" height="30" />
|
||||
<rect x="128" y="0" width="2" height="30" />
|
||||
<rect x="134" y="0" width="2" height="30" />
|
||||
<rect x="142" y="0" width="6" height="30" />
|
||||
<rect x="150" y="0" width="2" height="30" />
|
||||
<rect x="156" y="0" width="2" height="30" />
|
||||
<rect x="164" y="0" width="2" height="30" />
|
||||
<rect x="170" y="0" width="2" height="30" />
|
||||
<rect x="180" y="0" width="2" height="30" />
|
||||
<rect x="184" y="0" width="2" height="30" />
|
||||
<rect x="188" y="0" width="2" height="30" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
Reference in New Issue
Block a user