Skip to content

Commit df7e802

Browse files
committed
ACP2E-2314: Product price is zero in "Products in Carts" report grid, if "Catalog Price Scope" is "Website"
- Fixed the CR comments.
1 parent d31e97c commit df7e802

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

app/code/Magento/Reports/Test/Unit/Model/ResourceModel/Report/Quote/CollectionTest.php

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public function testGetSelectCountSql()
6767

6868
public function testPrepareActiveCartItems()
6969
{
70+
static $i = 0;
7071
/** @var MockObject $collection */
7172
$constructArgs = $this->objectManager
7273
->getConstructArguments(QuoteItemCollection::class);
@@ -79,11 +80,25 @@ public function testPrepareActiveCartItems()
7980
$collection->expects($this->exactly(2))->method('getSelect')->willReturn($this->selectMock);
8081
$this->selectMock->expects($this->once())->method('reset')->willReturnSelf();
8182
$this->selectMock->expects($this->once())->method('from')->willReturnSelf();
82-
$this->selectMock->expects($this->exactly(3))->method('columns')
83-
->withConsecutive([
84-
['main_table.product_id', 'main_table.name', 'main_table.price']
85-
])
86-
->willReturnSelf();
83+
$this->selectMock->expects($this->atLeastOnce())->method('columns')
84+
->with(self::callback(function ($columns) use (&$i) {
85+
switch ($i) {
86+
case 0:
87+
$this->assertContains('main_table.product_id', $columns);
88+
$this->assertContains('main_table.name', $columns);
89+
$this->assertContains('main_table.price', $columns);
90+
$i++;
91+
break;
92+
case 1:
93+
$this->assertEquals(['carts' => new \Zend_Db_Expr('COUNT(main_table.item_id)')], $columns);
94+
$i++;
95+
break;
96+
case 2:
97+
$this->assertEquals('quote.base_to_global_rate', $columns);
98+
$i++;
99+
}
100+
return true;
101+
}))->willReturnSelf();
87102
$this->selectMock->expects($this->once())->method('joinInner')->willReturnSelf();
88103
$this->selectMock->expects($this->once())->method('where')->willReturnSelf();
89104
$this->selectMock->expects($this->once())->method('group')->willReturnSelf();

0 commit comments

Comments
 (0)