|
1 | 1 | <?php
|
2 | 2 | /**
|
3 |
| - * Copyright © Magento, Inc. All rights reserved. |
4 |
| - * See COPYING.txt for license details. |
| 3 | + * Copyright 2022 Adobe |
| 4 | + * All Rights Reserved. |
5 | 5 | */
|
6 | 6 | declare(strict_types=1);
|
7 | 7 |
|
@@ -189,7 +189,10 @@ public function testGetPriceList(): void
|
189 | 189 | $this->model->getPriceList($this->product, false, false);
|
190 | 190 | }
|
191 | 191 |
|
192 |
| - public function testGetPriceListForFixedPriceType(): void |
| 192 | + /** |
| 193 | + * @dataProvider dataProvider |
| 194 | + */ |
| 195 | + public function testGetPriceListForFixedPriceType($websiteId): void |
193 | 196 | {
|
194 | 197 | $optionId = 1;
|
195 | 198 |
|
@@ -218,13 +221,19 @@ public function testGetPriceListForFixedPriceType(): void
|
218 | 221 | ->willReturn($this->store);
|
219 | 222 | $this->store->expects($this->once())
|
220 | 223 | ->method('getWebsiteId')
|
221 |
| - ->willReturn(0); |
222 |
| - $this->websiteRepository->expects($this->once()) |
223 |
| - ->method('getDefault') |
224 |
| - ->willReturn($this->website); |
225 |
| - $this->website->expects($this->once()) |
226 |
| - ->method('getId') |
227 |
| - ->willReturn(1); |
| 224 | + ->willReturn($websiteId); |
| 225 | + |
| 226 | + if ($websiteId) { |
| 227 | + $this->websiteRepository->expects($this->never()) |
| 228 | + ->method('getDefault'); |
| 229 | + } else { |
| 230 | + $this->websiteRepository->expects($this->once()) |
| 231 | + ->method('getDefault') |
| 232 | + ->willReturn($this->website); |
| 233 | + $this->website->expects($this->once()) |
| 234 | + ->method('getId') |
| 235 | + ->willReturn(1); |
| 236 | + } |
228 | 237 | $this->selectionCollection->expects($this->once())
|
229 | 238 | ->method('getIterator')
|
230 | 239 | ->willReturn(new \ArrayIterator([]));
|
@@ -271,4 +280,12 @@ public function testGetPriceListWithSearchMin(): void
|
271 | 280 |
|
272 | 281 | $this->model->getPriceList($this->product, true, false);
|
273 | 282 | }
|
| 283 | + |
| 284 | + public static function dataProvider() |
| 285 | + { |
| 286 | + return [ |
| 287 | + 'website provided' => [1], |
| 288 | + 'website not provided' => [0] |
| 289 | + ]; |
| 290 | + } |
274 | 291 | }
|
0 commit comments