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