| @@ 79-92 (lines=14) @@ | ||
| 76 | $this->assertEquals(300, $this->basket->total()); |
|
| 77 | } |
|
| 78 | ||
| 79 | public function testUpdate() |
|
| 80 | { |
|
| 81 | $actualId = $this->basket->insert([ |
|
| 82 | 'id' => 'foo', |
|
| 83 | 'name' => 'bar', |
|
| 84 | 'price' => 100, |
|
| 85 | 'quantity' => 1, |
|
| 86 | 'weight' => 200, |
|
| 87 | ]); |
|
| 88 | ||
| 89 | $this->basket->update($actualId, 'name', 'baz'); |
|
| 90 | ||
| 91 | $this->assertEquals('baz', $this->basket->item($actualId)->name); |
|
| 92 | } |
|
| 93 | ||
| 94 | public function testMagicUpdate() |
|
| 95 | { |
|
| @@ 94-109 (lines=16) @@ | ||
| 91 | $this->assertEquals('baz', $this->basket->item($actualId)->name); |
|
| 92 | } |
|
| 93 | ||
| 94 | public function testMagicUpdate() |
|
| 95 | { |
|
| 96 | $actualId = $this->basket->insert([ |
|
| 97 | 'id' => 'foo', |
|
| 98 | 'name' => 'bar', |
|
| 99 | 'price' => 100, |
|
| 100 | 'quantity' => 1, |
|
| 101 | 'weight' => 200, |
|
| 102 | ]); |
|
| 103 | ||
| 104 | foreach ($this->basket->contents() as $item) { |
|
| 105 | $item->name = 'bim'; |
|
| 106 | } |
|
| 107 | ||
| 108 | $this->assertEquals('bim', $this->basket->item($actualId)->name); |
|
| 109 | } |
|
| 110 | ||
| 111 | public function testWeight() |
|
| 112 | { |
|