|
29 | 29 | class AdjustmentTest extends TestCase
|
30 | 30 | {
|
31 | 31 | /**
|
32 |
| - * Context mock |
33 |
| - * |
34 | 32 | * @var \Magento\Framework\View\Element\Template\Context
|
35 | 33 | */
|
36 | 34 | protected $contextMock;
|
@@ -358,23 +356,30 @@ public function testGetHtmlBoth()
|
358 | 356 |
|
359 | 357 | /**
|
360 | 358 | * test for method getDataPriceType
|
| 359 | + * @dataProvider dataPriceTypeDataProvider |
361 | 360 | */
|
362 |
| - public function testGetDataPriceType(): void |
| 361 | + public function testGetDataPriceType(?string $priceType, string $priceTypeValue): void |
363 | 362 | {
|
364 | 363 | $amountRender = $this->getMockBuilder(Amount::class)
|
365 | 364 | ->addMethods(['getPriceType'])
|
366 | 365 | ->disableOriginalConstructor()
|
367 | 366 | ->getMock();
|
368 | 367 | $amountRender->expects($this->atLeastOnce())
|
369 | 368 | ->method('getPriceType')
|
370 |
| - ->willReturn('finalPrice'); |
371 |
| - $this->model->render($amountRender, []); |
372 |
| - $this->assertEquals('basePrice', $this->model->getDataPriceType()); |
373 |
| - $amountRender->expects($this->atLeastOnce()) |
374 |
| - ->method('getPriceType') |
375 |
| - ->willReturn(null); |
| 369 | + ->willReturn($priceType); |
376 | 370 | $this->model->render($amountRender, []);
|
377 |
| - //no exception thrown |
| 371 | + //no exception is thrown |
| 372 | + $this->assertEquals($priceTypeValue, $this->model->getDataPriceType()); |
378 | 373 | $this->assertIsString($this->model->getDataPriceType());
|
379 | 374 | }
|
| 375 | + |
| 376 | + /** |
| 377 | + * data provider for testGetDataPriceType |
| 378 | + * |
| 379 | + * @return array |
| 380 | + */ |
| 381 | + public function dataPriceTypeDataProvider(): array |
| 382 | + { |
| 383 | + return [['finalPrice', 'basePrice'], [null, '']]; |
| 384 | + } |
380 | 385 | }
|
0 commit comments