Skip to content

Commit 286c0df

Browse files
committed
#28081 Add missing stub key that caused Unit Test failure
1 parent f952ca9 commit 286c0df

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/CategoryTest.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
*/
3232
class CategoryTest extends TestCase
3333
{
34+
private const STUB_PRIMARY_KEY = 'PK';
35+
3436
/**
3537
* @var Category
3638
*/
@@ -112,8 +114,7 @@ protected function setUp(): void
112114
$this->selectMock->expects($this->at(2))->method('where')->willReturnSelf();
113115
$this->selectMock->expects($this->once())->method('from')->willReturnSelf();
114116
$this->selectMock->expects($this->once())->method('joinLeft')->willReturnSelf();
115-
$this->connectionMock = $this->getMockBuilder(Adapter::class)
116-
->getMockForAbstractClass();
117+
$this->connectionMock = $this->getMockBuilder(Adapter::class)->getMockForAbstractClass();
117118
$this->connectionMock->expects($this->once())->method('select')->willReturn($this->selectMock);
118119
$this->resourceMock = $this->getMockBuilder(ResourceConnection::class)
119120
->disableOriginalConstructor()
@@ -190,6 +191,16 @@ function ($value) {
190191
}
191192
);
192193

194+
$this->connectionMock->method('getPrimaryKeyName')->willReturn(self::STUB_PRIMARY_KEY);
195+
$this->connectionMock->method('getIndexList')
196+
->willReturn(
197+
[
198+
self::STUB_PRIMARY_KEY => [
199+
'COLUMNS_LIST' => ['Column']
200+
]
201+
]
202+
);
203+
193204
$result = $this->category->findWhereAttributeIs($entityIdsFilter, $attribute, $expectedValue);
194205
$this->assertEquals(['result'], $result);
195206
}

app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/ActionTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
class ActionTest extends TestCase
3636
{
3737
private const ENTITY_IDS = [1, 2, 5, 10];
38+
private const STUB_PRIMARY_KEY = 'PK';
3839

3940
/**
4041
* @var Action
@@ -206,6 +207,16 @@ public function testUpdateProductHasWeightAttributes($hasWeight, $typeId, $items
206207
];
207208
$storeId = 0;
208209

210+
$this->connectionMock->method('getPrimaryKeyName')->willReturn(self::STUB_PRIMARY_KEY);
211+
$this->connectionMock->method('getIndexList')
212+
->willReturn(
213+
[
214+
self::STUB_PRIMARY_KEY => [
215+
'COLUMNS_LIST' => ['Column']
216+
]
217+
]
218+
);
219+
209220
$this->connectionMock->expects($this->once())
210221
->method('update')
211222
->with(

0 commit comments

Comments
 (0)