| @@ 275-294 (lines=20) @@ | ||
| 272 | $this->assertEquals($this->basket->totalItems(true), $adding); |
|
| 273 | } |
|
| 274 | ||
| 275 | public function testItemRemoval() |
|
| 276 | { |
|
| 277 | $this->basket->insert([ |
|
| 278 | 'id' => 'foo', |
|
| 279 | 'name' => 'bar', |
|
| 280 | 'price' => 100, |
|
| 281 | 'quantity' => 1, |
|
| 282 | 'weight' => 200, |
|
| 283 | ]); |
|
| 284 | ||
| 285 | $contents = &$this->basket->contents(); |
|
| 286 | ||
| 287 | $this->assertNotEmpty($contents); |
|
| 288 | ||
| 289 | foreach ($contents as $item) { |
|
| 290 | $item->remove(); |
|
| 291 | } |
|
| 292 | ||
| 293 | $this->assertEmpty($contents); |
|
| 294 | } |
|
| 295 | ||
| 296 | public function testAlternateItemRemoval() |
|
| 297 | { |
|
| @@ 296-315 (lines=20) @@ | ||
| 293 | $this->assertEmpty($contents); |
|
| 294 | } |
|
| 295 | ||
| 296 | public function testAlternateItemRemoval() |
|
| 297 | { |
|
| 298 | $this->basket->insert([ |
|
| 299 | 'id' => 'foo', |
|
| 300 | 'name' => 'bar', |
|
| 301 | 'price' => 100, |
|
| 302 | 'quantity' => 1, |
|
| 303 | 'weight' => 200, |
|
| 304 | ]); |
|
| 305 | ||
| 306 | $contents = &$this->basket->contents(); |
|
| 307 | ||
| 308 | $this->assertNotEmpty($contents); |
|
| 309 | ||
| 310 | foreach ($contents as $identifier => $item) { |
|
| 311 | $this->basket->remove($identifier); |
|
| 312 | } |
|
| 313 | ||
| 314 | $this->assertEmpty($contents); |
|
| 315 | } |
|
| 316 | ||
| 317 | public function testItemToArray() |
|
| 318 | { |
|