Skip to content

Commit 9fc3111

Browse files
committed
Merge remote-tracking branch 'magento-l3/ACP2E-2314' into SEP292023_PR_pradeep
2 parents 3d16e4b + df7e802 commit 9fc3111

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

app/code/Magento/Reports/Model/ResourceModel/Quote/Item/Collection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function prepareActiveCartItems()
121121

122122
$quoteItemsSelect->reset()
123123
->from(['main_table' => $this->getTable('quote_item')], '')
124-
->columns(['main_table.product_id', 'main_table.name'])
124+
->columns(['main_table.product_id', 'main_table.name', 'main_table.price'])
125125
->columns(['carts' => new \Zend_Db_Expr('COUNT(main_table.item_id)')])
126126
->columns('quote.base_to_global_rate')
127127
->joinInner(

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

Lines changed: 20 additions & 1 deletion
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,7 +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->atLeastOnce())->method('columns')->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();
83102
$this->selectMock->expects($this->once())->method('joinInner')->willReturnSelf();
84103
$this->selectMock->expects($this->once())->method('where')->willReturnSelf();
85104
$this->selectMock->expects($this->once())->method('group')->willReturnSelf();

0 commit comments

Comments
 (0)