| @@ 110-133 (lines=24) @@ | ||
| 107 | $this->assertEquals(($weight + $weight_option) * $quantity, $this->item->weight()); |
|
| 108 | } |
|
| 109 | ||
| 110 | public function testHasOption() |
|
| 111 | { |
|
| 112 | $identifier = 1; |
|
| 113 | ||
| 114 | $item = [ |
|
| 115 | 'id' => 'foo', |
|
| 116 | 'name' => 'bar', |
|
| 117 | 'price' => 100, |
|
| 118 | 'quantity' => 1, |
|
| 119 | 'weight' => 200, |
|
| 120 | 'options' => [ |
|
| 121 | [ |
|
| 122 | 'name' => 'Size', |
|
| 123 | 'value' => 'L', |
|
| 124 | 'weight' => 50, |
|
| 125 | 'price' => 100, |
|
| 126 | ], |
|
| 127 | ], |
|
| 128 | ]; |
|
| 129 | ||
| 130 | $this->item = new Item($identifier, $item, new RuntimeStore()); |
|
| 131 | $this->assertTrue($this->item->hasOptions()); |
|
| 132 | } |
|
| 133 | ||
| 134 | public function testHasNotOption() |
|
| 135 | { |
|
| 136 | $identifier = 1; |
|
| @@ 134-156 (lines=23) @@ | ||
| 131 | $this->assertTrue($this->item->hasOptions()); |
|
| 132 | } |
|
| 133 | ||
| 134 | public function testHasNotOption() |
|
| 135 | { |
|
| 136 | $identifier = 1; |
|
| 137 | ||
| 138 | $item = [ |
|
| 139 | 'id' => 'foo', |
|
| 140 | 'name' => 'bar', |
|
| 141 | 'price' => 100, |
|
| 142 | 'quantity' => 1, |
|
| 143 | 'weight' => 200, |
|
| 144 | 'options' => [ |
|
| 145 | [ |
|
| 146 | 'name' => 'Size', |
|
| 147 | 'value' => 'L', |
|
| 148 | 'weight' => 50, |
|
| 149 | 'price' => 100, |
|
| 150 | ], |
|
| 151 | ], |
|
| 152 | ]; |
|
| 153 | ||
| 154 | $this->item = new Item($identifier, $item, new RuntimeStore()); |
|
| 155 | $this->assertEquals(250, $this->item->weight()); |
|
| 156 | } |
|
| 157 | } |
|
| 158 | ||