Skip to content

Commit ee152fc

Browse files
Add automated test for update TierPrice
1 parent ffab78e commit ee152fc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/TierPrice/UpdateHandlerTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ public function testExecute(): void
128128
['entity_id', $originalProductId]
129129
]
130130
);
131+
$this->assertEquals($this->assertNotNull($newTierPrices[0]['price']),
132+
$this->tierPriceResource->expects($this->atLeastOnce())
133+
->method('updateValues')->with($newTierPrices, $originalTierPrices)->willReturn(true));
134+
$this->assertEquals($this->assertNull($newTierPrices[0]['price']),
135+
$this->tierPriceResource->expects($this->atLeastOnce())
136+
->method('updateValues')->with($newTierPrices, $originalTierPrices)->willReturn(false));
131137
$product->expects($this->atLeastOnce())->method('getStoreId')->willReturn(0);
132138
$product->expects($this->atLeastOnce())->method('setData')->with('tier_price_changed', 1);
133139
$store = $this->getMockBuilder(\Magento\Store\Api\Data\StoreInterface::class)
@@ -163,7 +169,6 @@ public function testExecute(): void
163169
$this->tierPriceResource->expects($this->exactly(2))->method('savePriceData')->willReturnSelf();
164170
$this->tierPriceResource->expects($this->once())->method('deletePriceData')
165171
->with($productId, null, $priceIdToDelete);
166-
167172
$this->assertEquals($product, $this->updateHandler->execute($product));
168173
}
169174

0 commit comments

Comments
 (0)