22
33namespace TarfinLabs \ZbarPhp \Tests ;
44
5+ use PHPUnit \Framework \Attributes \Test ;
56use PHPUnit \Framework \TestCase ;
67use TarfinLabs \ZbarPhp \Exceptions \InvalidFormat ;
78use TarfinLabs \ZbarPhp \Exceptions \UnableToOpen ;
1011
1112class ZbarTest extends TestCase
1213{
13- /**
14- * @var string
15- */
16- protected $ qrcode ;
17-
18- /**
19- * @var string
20- */
21- protected $ barcode ;
22-
23- /**
24- * @var string
25- */
26- protected $ invalidFile ;
27- /**
28- * @var string
29- */
30- protected $ emptyImage ;
31-
32- /**
33- * @var string
34- */
35- protected $ ean13 ;
36-
37- /**
38- * @var string
39- */
40- protected $ code128 ;
14+ protected string $ qrcode ;
15+
16+ protected string $ barcode ;
17+
18+ protected string $ invalidFile ;
19+
20+ protected string $ emptyImage ;
21+
22+ protected string $ ean13 ;
23+
24+ protected string $ code128 ;
4125
4226 protected function setUp (): void
4327 {
@@ -51,69 +35,69 @@ protected function setUp(): void
5135 $ this ->code128 = __DIR__ .'/files/code-128.png ' ;
5236 }
5337
54- /** @test */
55- public function it_will_throw_unable_to_open_exception_when_try_to_scan_non_existing_file ()
38+ #[Test]
39+ public function it_will_throw_unable_to_open_exception_when_try_to_scan_non_existing_file (): void
5640 {
5741 $ this ->expectException (UnableToOpen::class);
5842
5943 new Zbar ('nonexisting.png ' );
6044 }
6145
62- /** @test */
63- public function it_will_throw_invalid_format_exception_when_try_to_scan_invalid_file_type ()
46+ #[Test]
47+ public function it_will_throw_invalid_format_exception_when_try_to_scan_invalid_file_type (): void
6448 {
6549 $ this ->expectException (InvalidFormat::class);
6650
6751 new Zbar ($ this ->invalidFile );
6852 }
6953
70- /** @test */
71- public function it_can_scan_qrcode ()
54+ #[Test]
55+ public function it_can_scan_qrcode (): void
7256 {
7357 $ zbar = new Zbar ($ this ->qrcode );
7458 $ code = $ zbar ->scan ();
7559
7660 $ this ->assertSame ('tarfin ' , $ code );
7761 }
7862
79- /** @test */
80- public function it_will_throw_error_when_try_to_scan_empty_image ()
63+ #[Test]
64+ public function it_will_throw_error_when_try_to_scan_empty_image (): void
8165 {
8266 $ this ->expectException (ZbarError::class);
8367
8468 $ zbar = new Zbar ($ this ->emptyImage );
8569 $ code = $ zbar ->scan ();
8670 }
8771
88- /** @test */
89- public function it_can_scan_barcode ()
72+ #[Test]
73+ public function it_can_scan_barcode (): void
9074 {
9175 $ zbar = new Zbar ($ this ->barcode );
9276 $ code = $ zbar ->scan ();
9377
9478 $ this ->assertSame ('tarfin-1234 ' , $ code );
9579 }
9680
97- /** @test */
98- public function it_can_get_ean13_bar_code_type ()
81+ #[Test]
82+ public function it_can_get_ean13_bar_code_type (): void
9983 {
10084 $ zbar = new Zbar ($ this ->ean13 );
10185 $ type = $ zbar ->type ();
10286
10387 $ this ->assertSame ('EAN-13 ' , $ type );
10488 }
10589
106- /** @test */
107- public function it_can_get_code128_bar_code_type ()
90+ #[Test]
91+ public function it_can_get_code128_bar_code_type (): void
10892 {
10993 $ zbar = new ZBar ($ this ->code128 );
11094 $ type = $ zbar ->type ();
11195
11296 $ this ->assertSame ('CODE-128 ' , $ type );
11397 }
11498
115- /** @test */
116- public function it_can_get_bar_code_and_type_of_code128_bar_code ()
99+ #[Test]
100+ public function it_can_get_bar_code_and_type_of_code128_bar_code (): void
117101 {
118102 $ zbar = new ZBar ($ this ->code128 );
119103 $ barCode = $ zbar ->decode ();
@@ -122,8 +106,8 @@ public function it_can_get_bar_code_and_type_of_code128_bar_code()
122106 $ this ->assertSame ('CODE-128 ' , $ barCode ->type ());
123107 }
124108
125- /** @test */
126- public function it_can_get_bar_code_and_type_of_ean13_bar_code ()
109+ #[Test]
110+ public function it_can_get_bar_code_and_type_of_ean13_bar_code (): void
127111 {
128112 $ zbar = new ZBar ($ this ->ean13 );
129113 $ barCode = $ zbar ->decode ();
@@ -132,8 +116,8 @@ public function it_can_get_bar_code_and_type_of_ean13_bar_code()
132116 $ this ->assertSame ('EAN-13 ' , $ barCode ->type ());
133117 }
134118
135- /** @test */
136- public function it_can_get_bar_code_and_type_of_qrcode ()
119+ #[Test]
120+ public function it_can_get_bar_code_and_type_of_qrcode (): void
137121 {
138122 $ zbar = new ZBar ($ this ->qrcode );
139123 $ barCode = $ zbar ->decode ();
0 commit comments