Skip to content

Commit 24726c0

Browse files
committed
changes for automation tests
1 parent 5a0ede6 commit 24726c0

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

app/code/Magento/Wishlist/Pricing/ConfiguredPrice/ConfigurableProduct.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class ConfigurableProduct extends AbstractPrice
1717
/**
1818
* Price type final.
1919
*/
20-
const PRICE_CODE = 'final_price';
20+
public const PRICE_CODE = 'final_price';
2121

2222
/**
2323
* @var ItemInterface
@@ -57,8 +57,9 @@ public function getConfiguredRegularAmount(): \Magento\Framework\Pricing\Amount\
5757
*/
5858
public function getValue()
5959
{
60+
6061
$price = $this->getProduct()->getMinimalPrice();
61-
if(!$price) {
62+
if (!$price) {
6263
$price = $this->getProduct()->getPriceInfo()->getPrice(self::PRICE_CODE)->getValue();
6364
}
6465
return max(0, $price);

app/code/Magento/Wishlist/Test/Unit/Pricing/ConfiguredPrice/ConfigurableProductTest.php

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ protected function setUp(): void
5555
->setMethods([
5656
'getPriceInfo',
5757
'getCustomOption',
58+
'getMinimalPrice'
5859
])
5960
->getMockForAbstractClass();
6061

@@ -100,11 +101,11 @@ public function testGetValue()
100101
$wishlistItemOptionMock = $this->getMockBuilder(Option::class)
101102
->disableOriginalConstructor()
102103
->getMock();
103-
$wishlistItemOptionMock->expects($this->once())
104+
$wishlistItemOptionMock->expects($this->atLeastOnce())
104105
->method('getProduct')
105106
->willReturn($productMock);
106107

107-
$this->saleableItem->expects($this->once())
108+
$this->saleableItem->expects($this->atLeastOnce())
108109
->method('getCustomOption')
109110
->with('simple_product')
110111
->willReturn($wishlistItemOptionMock);
@@ -116,25 +117,14 @@ public function testGetValueWithNoCustomOption()
116117
{
117118
$priceValue = 100;
118119

119-
$priceMock = $this->getMockBuilder(PriceInterface::class)
120-
->getMockForAbstractClass();
121-
$priceMock->expects($this->once())
122-
->method('getValue')
123-
->willReturn($priceValue);
124-
125120
$this->saleableItem->expects($this->once())
126121
->method('getCustomOption')
127122
->with('simple_product')
128123
->willReturn(null);
129124

130125
$this->saleableItem->expects($this->once())
131-
->method('getPriceInfo')
132-
->willReturn($this->priceInfoMock);
133-
134-
$this->priceInfoMock->expects($this->once())
135-
->method('getPrice')
136-
->with(ConfigurableProduct::PRICE_CODE)
137-
->willReturn($priceMock);
126+
->method('getMinimalPrice')
127+
->willReturn(100);
138128

139129
$this->assertEquals(100, $this->model->getValue());
140130
}

0 commit comments

Comments
 (0)