| @@ 113-136 (lines=24) @@ | ||
| 110 | $this->assertEquals(($weight + $weight_option) * $quantity, $this->item->weight()); |
|
| 111 | } |
|
| 112 | ||
| 113 | public function testHasOption() |
|
| 114 | { |
|
| 115 | $identifier = 1; |
|
| 116 | ||
| 117 | $item = [ |
|
| 118 | 'id' => 'foo', |
|
| 119 | 'name' => 'bar', |
|
| 120 | 'price' => 100, |
|
| 121 | 'quantity' => 1, |
|
| 122 | 'weight' => 200, |
|
| 123 | 'options' => [ |
|
| 124 | [ |
|
| 125 | 'name' => 'Size', |
|
| 126 | 'value' => 'L', |
|
| 127 | 'weight' => 50, |
|
| 128 | 'price' => 100, |
|
| 129 | ], |
|
| 130 | ], |
|
| 131 | ]; |
|
| 132 | ||
| 133 | $this->item = new Item($identifier, $item, new RuntimeStore()); |
|
| 134 | $this->assertTrue($this->item->hasOptions()); |
|
| 135 | ||
| 136 | } |
|
| 137 | ||
| 138 | public function testHasNotOption() |
|
| 139 | { |
|
| @@ 138-160 (lines=23) @@ | ||
| 135 | ||
| 136 | } |
|
| 137 | ||
| 138 | public function testHasNotOption() |
|
| 139 | { |
|
| 140 | $identifier = 1; |
|
| 141 | ||
| 142 | $item = [ |
|
| 143 | 'id' => 'foo', |
|
| 144 | 'name' => 'bar', |
|
| 145 | 'price' => 100, |
|
| 146 | 'quantity' => 1, |
|
| 147 | 'weight' => 200, |
|
| 148 | 'options' => [ |
|
| 149 | [ |
|
| 150 | 'name' => 'Size', |
|
| 151 | 'value' => 'L', |
|
| 152 | 'weight' => 50, |
|
| 153 | 'price' => 100, |
|
| 154 | ], |
|
| 155 | ], |
|
| 156 | ]; |
|
| 157 | ||
| 158 | $this->item = new Item($identifier, $item, new RuntimeStore()); |
|
| 159 | $this->assertEquals(250, $this->item->weight()); |
|
| 160 | } |
|
| 161 | ||
| 162 | } |
|
| 163 | ||