|
5 | 5 | */
|
6 | 6 | declare(strict_types=1);
|
7 | 7 |
|
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; |
9 | 13 |
|
10 | 14 | /**
|
11 | 15 | * Tests some functionality of the Product Review collection
|
12 | 16 | */
|
13 | 17 | class CollectionTest extends \PHPUnit\Framework\TestCase
|
14 | 18 | {
|
| 19 | + /** |
| 20 | + * @var Collection|MockObject |
| 21 | + */ |
| 22 | + protected Collection|MockObject $_model; |
| 23 | + |
15 | 24 | protected function setUp(): void
|
16 | 25 | {
|
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); |
20 | 27 | }
|
21 |
| - |
| 28 | + |
22 | 29 | /**
|
23 |
| - * @param mixed $storeId |
| 30 | + * @param array|int $storeId |
24 | 31 | * @dataProvider storeIdDataProvider
|
25 | 32 | */
|
26 |
| - public function testAddStoreFilter($storeId) { |
| 33 | + public function testAddStoreFilter(array|int $storeId) |
| 34 | + { |
27 | 35 | $expectedWhere = is_numeric($storeId) ? 'store_id = ?' : 'store_id IN (?)';
|
28 | 36 |
|
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(); |
39 | 42 |
|
40 | 43 | $this->assertEquals($this->_model, $this->_model->addStoreFilter($storeId));
|
41 | 44 | }
|
|
0 commit comments