File tree Expand file tree Collapse file tree 2 files changed +52
-3
lines changed
Expand file tree Collapse file tree 2 files changed +52
-3
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Entity ;
6+
7+ use PH7 \ApiSimpleMenu \Entity \Item as ItemEntity ;
8+ use PHPUnit \Framework \TestCase ;
9+ use Ramsey \Uuid \Uuid ;
10+
11+ final class ItemTest extends TestCase
12+ {
13+ private ItemEntity $ itemEntity ;
14+
15+ protected function setUp (): void
16+ {
17+ $ this ->itemEntity = new ItemEntity ();
18+ }
19+
20+ public function testSequentialId (): void
21+ {
22+ $ expectedValue = 1 ;
23+
24+ $ this ->itemEntity ->setSequentialId ($ expectedValue );
25+
26+ $ this ->assertSame ($ expectedValue , $ this ->itemEntity ->getSequentialId ());
27+ }
28+
29+ public function testUnserialize (): void
30+ {
31+ $ uuid = Uuid::uuid4 ()->toString ();
32+
33+ $ expectedItemData = [
34+ 'id ' => 500 ,
35+ 'item_uuid ' => $ uuid ,
36+ 'name ' => 'Société® Roquefort ' ,
37+ 'price ' => 22.00 ,
38+ 'available ' => true
39+ ];
40+
41+ $ this ->itemEntity ->unserialize ($ expectedItemData );
42+
43+ $ this ->assertSame ($ expectedItemData ['id ' ], $ this ->itemEntity ->getSequentialId ());
44+ $ this ->assertSame ($ expectedItemData ['item_uuid ' ], $ this ->itemEntity ->getItemUuid ());
45+ $ this ->assertSame ($ expectedItemData ['name ' ], $ this ->itemEntity ->getName ());
46+ $ this ->assertSame ($ expectedItemData ['price ' ], $ this ->itemEntity ->getPrice ());
47+ $ this ->assertTrue ($ expectedItemData ['available ' ]);
48+ }
49+ }
Original file line number Diff line number Diff line change @@ -21,11 +21,11 @@ protected function setUp(): void
2121
2222 public function testSequentialId (): void
2323 {
24- $ sequentialId = 55 ;
24+ $ expectedSequentialId = 55 ;
2525
26- $ this ->userEntity ->setSequentialId ($ sequentialId );
26+ $ this ->userEntity ->setSequentialId ($ expectedSequentialId );
2727
28- $ this ->assertSame ($ sequentialId , $ this ->userEntity ->getSequentialId ());
28+ $ this ->assertSame ($ expectedSequentialId , $ this ->userEntity ->getSequentialId ());
2929 }
3030
3131 public function testUserUuid (): void
You can’t perform that action at this time.
0 commit comments