Skip to content

Commit f90c388

Browse files
author
Alex Westergaard
committed
Add arrayable test on Item
1 parent 6a1d068 commit f90c388

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

test/Unit/ItemTest.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,44 @@ public function test_can_configure_and_export()
4747
$this->assertIsArray($asArray['item_category']);
4848
}
4949

50+
public function test_can_configure_arrayable()
51+
{
52+
$item = Item::new();
53+
54+
$item['item_id'] = '1';
55+
$item['item_name'] = 'First Product';
56+
$item['affiliation'] = 'unit test';
57+
$item['coupon'] = 'code';
58+
$item['currency'] = $this->prefill['currency'];
59+
$item['item_brand'] = 'phpunit';
60+
$item['item_list_id'] = 'test-list';
61+
$item['item_list_name'] = 'test list';
62+
$item['item_variant'] = 'test';
63+
$item['location_id'] = 'L1';
64+
$item['discount'] = 1.11;
65+
$item['price'] = 7.39;
66+
$item['quantity'] = 2;
67+
$item['index'] = 1;
68+
$item['item_category'] = 'unit';
69+
70+
$this->assertArrayHasKey('item_id', $item);
71+
$this->assertArrayHasKey('item_name', $item);
72+
$this->assertArrayHasKey('affiliation', $item);
73+
$this->assertArrayHasKey('coupon', $item);
74+
$this->assertArrayHasKey('currency', $item);
75+
$this->assertArrayHasKey('item_brand', $item);
76+
$this->assertArrayHasKey('item_list_id', $item);
77+
$this->assertArrayHasKey('item_list_name', $item);
78+
$this->assertArrayHasKey('item_variant', $item);
79+
$this->assertArrayHasKey('location_id', $item);
80+
$this->assertArrayHasKey('discount', $item);
81+
$this->assertArrayHasKey('price', $item);
82+
$this->assertArrayHasKey('quantity', $item);
83+
$this->assertArrayHasKey('index', $item);
84+
$this->assertArrayHasKey('item_category', $item);
85+
$this->assertIsArray($item['item_category']);
86+
}
87+
5088
public function test_can_export_to_array()
5189
{
5290
$this->assertInstanceOf(Item::class, $this->item);

0 commit comments

Comments
 (0)