Skip to content

Commit 5532461

Browse files
committed
AC-2765::fixed static testcases failing in CollectionTest.php
1 parent ef813ac commit 5532461

File tree

2 files changed

+22
-20
lines changed
  • app/code/Magento/Review/Model/ResourceModel/Review/Summary
  • dev/tests/integration/testsuite/Magento/Review/Model/ResourceModel/Review/Summary

2 files changed

+22
-20
lines changed

app/code/Magento/Review/Model/ResourceModel/Review/Summary/Collection.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
1414
{
1515
/**
16-
* {@inheritdoc}
16+
* @inheritdoc
1717
*/
1818
protected function _construct()
1919
{
@@ -47,10 +47,9 @@ public function addStoreFilter(int|array $storeId)
4747
if (is_numeric($storeId)) {
4848
$this->_select->where('store_id = ?', $storeId);
4949
} else {
50-
$this->_select->where('store_id IN (?)', $storeId);
50+
$this->_select->where('store_id IN (?)', $storeId);
5151
}
5252

5353
return $this;
5454
}
55-
5655
}

dev/tests/integration/testsuite/Magento/Review/Model/ResourceModel/Review/Summary/CollectionTest.php

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,40 @@
55
*/
66
declare(strict_types=1);
77

8-
namespace Magento\Review\Model\ResourceModel\Summary;
8+
namespace Magento\Review\Model\ResourceModel\Review\Summary;
9+
10+
use Magento\Framework\DB\Select;
11+
use Magento\Review\Model\ResourceModel\Review\Summary\Collection;
12+
use PHPUnit\Framework\MockObject\MockObject;
913

1014
/**
1115
* Tests some functionality of the Product Review collection
1216
*/
1317
class CollectionTest extends \PHPUnit\Framework\TestCase
1418
{
19+
/**
20+
* @var Collection|MockObject
21+
*/
22+
protected Collection|MockObject $_model;
23+
1524
protected function setUp(): void
1625
{
17-
$this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
18-
\Magento\Review\Model\ResourceModel\Review\Summary\Collection::class
19-
);
26+
$this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(Collection::class);
2027
}
21-
28+
2229
/**
23-
* @param mixed $storeId
30+
* @param array|int $storeId
2431
* @dataProvider storeIdDataProvider
2532
*/
26-
public function testAddStoreFilter($storeId) {
33+
public function testAddStoreFilter(array|int $storeId)
34+
{
2735
$expectedWhere = is_numeric($storeId) ? 'store_id = ?' : 'store_id IN (?)';
2836

29-
$select = $this->createPartialMock(\Magento\Framework\DB\Select::class, ['where']);
30-
$select->expects(
31-
$this->any()
32-
)->method(
33-
'where'
34-
)->with(
35-
$this->equalTo($expectedWhere)
36-
)->willReturnSelf(
37-
38-
);
37+
$select = $this->createPartialMock(Select::class, ['where']);
38+
$select->expects( $this->any())
39+
->method('where')
40+
->with($this->equalTo($expectedWhere))
41+
->willReturnSelf();
3942

4043
$this->assertEquals($this->_model, $this->_model->addStoreFilter($storeId));
4144
}

0 commit comments

Comments
 (0)