@@ -13,38 +13,61 @@ public function testInit()
1313 $ this ->assertInstanceOf ('\violuke\Barcodes\BarcodeValidator ' , $ validator );
1414 }
1515
16- public function testEan ()
16+ public function testInvalid ()
1717 {
18-
1918 $ validator = new BarcodeValidator ('string123 ' );
2019 $ this ->assertFalse ($ validator ->isValid ());
20+ }
2121
22+ public function testInvalidLooksLikeBarcode ()
23+ {
2224 $ validator = new BarcodeValidator ('5060411950138 ' );
2325 $ this ->assertFalse ($ validator ->isValid ());
26+ }
2427
28+ public function testValid ()
29+ {
2530 $ validator = new BarcodeValidator ('001303050100 ' );
2631 $ this ->assertFalse ($ validator ->isValid ());
32+ }
2733
34+ public function testEanRestricted ()
35+ {
2836 $ validator = new BarcodeValidator ('2100000030019 ' );
2937 $ this ->assertTrue ($ validator ->isValid ());
3038 $ this ->assertSame (BarcodeValidator::TYPE_EAN_RESTRICTED , $ validator ->getType ());
39+ }
3140
41+ public function testUpcCouponCode ()
42+ {
3243 $ validator = new BarcodeValidator ('570691542245 ' );
3344 $ this ->assertTrue ($ validator ->isValid ());
3445 $ this ->assertSame (BarcodeValidator::TYPE_UPC_COUPON_CODE , $ validator ->getType ());
46+ }
3547
48+ public function testEan ()
49+ {
3650 $ validator = new BarcodeValidator ('8838108476586 ' );
3751 $ this ->assertTrue ($ validator ->isValid ());
3852 $ this ->assertSame (BarcodeValidator::TYPE_EAN , $ validator ->getType ());
53+ }
3954
55+ public function testEan2 ()
56+ {
4057 $ validator = new BarcodeValidator ('5060411950139 ' );
4158 $ this ->assertTrue ($ validator ->isValid ());
4259 $ this ->assertSame (BarcodeValidator::TYPE_EAN , $ validator ->getType ());
60+ }
4361
62+ public function testEan3 ()
63+ {
4464 $ validator = new BarcodeValidator ('0700867967774 ' );
4565 $ this ->assertTrue ($ validator ->isValid ());
4666 $ this ->assertSame (BarcodeValidator::TYPE_EAN , $ validator ->getType ());
67+ }
4768
69+ public function testUpc ()
70+ {
4871 $ validator = new BarcodeValidator ('700867967774 ' );
4972 $ this ->assertTrue ($ validator ->isValid ());
5073 $ this ->assertSame (BarcodeValidator::TYPE_UPC , $ validator ->getType ());
0 commit comments