| @@ 150-170 (lines=21) @@ | ||
| 147 | $this->assertEquals($this->basket->weight(), $weight); |
|
| 148 | } |
|
| 149 | ||
| 150 | public function testWeightOption() |
|
| 151 | { |
|
| 152 | $weight = rand(200, 300); |
|
| 153 | $weight_option = rand(50, 800); |
|
| 154 | $quantity = rand(1, 10); |
|
| 155 | ||
| 156 | $this->basket->insert([ |
|
| 157 | 'id' => 'foo', |
|
| 158 | 'name' => 'bar', |
|
| 159 | 'price' => 100, |
|
| 160 | 'quantity' => $quantity , |
|
| 161 | 'weight' => $weight, |
|
| 162 | 'options' => [ |
|
| 163 | 'size' => 'L', |
|
| 164 | 'weight' => $weight_option, |
|
| 165 | ], |
|
| 166 | ]); |
|
| 167 | ||
| 168 | // Test that the total weight is being calculated successfully |
|
| 169 | $this->assertEquals($this->basket->weight(), ($weight + $weight_option) * $quantity ); |
|
| 170 | } |
|
| 171 | ||
| 172 | public function testPriceOption() |
|
| 173 | { |
|
| @@ 172-192 (lines=21) @@ | ||
| 169 | $this->assertEquals($this->basket->weight(), ($weight + $weight_option) * $quantity ); |
|
| 170 | } |
|
| 171 | ||
| 172 | public function testPriceOption() |
|
| 173 | { |
|
| 174 | $weight = rand(200, 300); |
|
| 175 | $weight_option = rand(50, 800); |
|
| 176 | $quantity = rand(1, 10); |
|
| 177 | ||
| 178 | $this->basket->insert([ |
|
| 179 | 'id' => 'foo', |
|
| 180 | 'name' => 'bar', |
|
| 181 | 'price' => 100, |
|
| 182 | 'quantity' => $quantity , |
|
| 183 | 'weight' => $weight, |
|
| 184 | 'options' => [ |
|
| 185 | 'size' => 'L', |
|
| 186 | 'weight' => $weight_option, |
|
| 187 | ], |
|
| 188 | ]); |
|
| 189 | ||
| 190 | // Test that the total weight is being calculated successfully |
|
| 191 | $this->assertEquals($this->basket->weight(), ($weight + $weight_option) * $quantity ); |
|
| 192 | } |
|
| 193 | ||
| 194 | public function testFind() |
|
| 195 | { |
|