| @@ 248-267 (lines=20) @@ | ||
| 245 | $this->assertEquals($this->basket->totalItems(true), $adding); |
|
| 246 | } |
|
| 247 | ||
| 248 | public function testItemRemoval() |
|
| 249 | { |
|
| 250 | $this->basket->insert([ |
|
| 251 | 'id' => 'foo', |
|
| 252 | 'name' => 'bar', |
|
| 253 | 'price' => 100, |
|
| 254 | 'quantity' => 1, |
|
| 255 | 'weight' => 200, |
|
| 256 | ]); |
|
| 257 | ||
| 258 | $contents = &$this->basket->contents(); |
|
| 259 | ||
| 260 | $this->assertNotEmpty($contents); |
|
| 261 | ||
| 262 | foreach ($contents as $item) { |
|
| 263 | $item->remove(); |
|
| 264 | } |
|
| 265 | ||
| 266 | $this->assertEmpty($contents); |
|
| 267 | } |
|
| 268 | ||
| 269 | public function testAlternateItemRemoval() |
|
| 270 | { |
|
| @@ 269-288 (lines=20) @@ | ||
| 266 | $this->assertEmpty($contents); |
|
| 267 | } |
|
| 268 | ||
| 269 | public function testAlternateItemRemoval() |
|
| 270 | { |
|
| 271 | $this->basket->insert([ |
|
| 272 | 'id' => 'foo', |
|
| 273 | 'name' => 'bar', |
|
| 274 | 'price' => 100, |
|
| 275 | 'quantity' => 1, |
|
| 276 | 'weight' => 200, |
|
| 277 | ]); |
|
| 278 | ||
| 279 | $contents = &$this->basket->contents(); |
|
| 280 | ||
| 281 | $this->assertNotEmpty($contents); |
|
| 282 | ||
| 283 | foreach ($contents as $identifier => $item) { |
|
| 284 | $this->basket->remove($identifier); |
|
| 285 | } |
|
| 286 | ||
| 287 | $this->assertEmpty($contents); |
|
| 288 | } |
|
| 289 | ||
| 290 | public function testItemToArray() |
|
| 291 | { |
|