Skip to content

Commit 70789e0

Browse files
committed
ACP2E-1388, reverted unit test from previous solution
1 parent 395bf2b commit 70789e0

File tree

1 file changed

+6
-30
lines changed

1 file changed

+6
-30
lines changed

app/code/Magento/CatalogInventory/Test/Unit/Model/Indexer/ProductPriceIndexFilterTest.php

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,13 @@ public function testModifyPrice(): void
7878
$entityIds = [1, 2, 3];
7979
$indexTableStructure = $this->createMock(IndexTableStructure::class);
8080
$connectionMock = $this->getMockForAbstractClass(AdapterInterface::class);
81-
$this->resourceConnection->expects($this->exactly(6))->method('getConnection')->willReturn($connectionMock);
81+
$this->resourceConnection->expects($this->once())->method('getConnection')->willReturn($connectionMock);
8282
$selectMock = $this->createMock(Select::class);
83-
$connectionMock->expects($this->exactly(6))->method('select')->willReturn($selectMock);
84-
83+
$connectionMock->expects($this->once())->method('select')->willReturn($selectMock);
84+
$selectMock
85+
->method('where')
86+
->withConsecutive([], [], ['stock_item.product_id IN (?)', $entityIds])
87+
->willReturnOnConsecutiveCalls(null, null, $selectMock);
8588
$this->generator->expects($this->once())
8689
->method('generate')
8790
->willReturnCallback(
@@ -96,33 +99,6 @@ public function testModifyPrice(): void
9699
$this->productPriceIndexFilter->modifyPrice($indexTableStructure, $entityIds);
97100
}
98101

99-
public function testModifyPriceDynamicPriceBundle(): void
100-
{
101-
$indexTableStructure = $this->createMock(IndexTableStructure::class);
102-
$indexTableStructure->expects($this->any())->method('getTableName')
103-
->willReturn('price_table');
104-
$this->stockConfiguration->expects($this->once())->method('isShowOutOfStock')->willReturn(false);
105-
$connectionMock = $this->getMockForAbstractClass(AdapterInterface::class);
106-
$this->resourceConnection->expects($this->exactly(2))->method('getConnection')->willReturn($connectionMock);
107-
108-
$selectMock = $this->createMock(Select::class);
109-
$connectionMock->expects($this->exactly(2))->method('select')->willReturn($selectMock);
110-
$this->generator->expects($this->once())
111-
->method('generate')
112-
->willReturnCallback(
113-
$this->getBatchIteratorCallback($selectMock, 1)
114-
);
115-
$fetchStmtMock = $this->createPartialMock(\Zend_Db_Statement_Pdo::class, ['fetchAll']);
116-
$fetchStmtMock->expects($this->any())
117-
->method('fetchAll')
118-
->willReturn([['product_id' => 1]]);
119-
$connectionMock->expects($this->any())->method('query')->willReturn($fetchStmtMock);
120-
$connectionMock->expects($this->once())->method('fetchOne')->willReturn(1);
121-
$connectionMock->expects($this->once())->method('delete')->with('price_table', [' IN (?)' => [1]]);
122-
123-
$this->productPriceIndexFilter->modifyPrice($indexTableStructure);
124-
}
125-
126102
/**
127103
* Returns batches.
128104
*

0 commit comments

Comments
 (0)