Skip to content

Commit 289ed16

Browse files
AC-1214 Fixed static tests
1 parent 25c3840 commit 289ed16

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

app/code/Magento/Catalog/Model/ResourceModel/Collection/AbstractCollection.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -255,20 +255,15 @@ protected function _setItemAttributeValue($valueInfo)
255255
$this->getEntity()->getType(),
256256
$valueInfo['attribute_id']
257257
);
258-
$attributeCode = $attribute->getAttributeCode();
259258
if ((int)$attribute->getIsGlobal() === ScopedAttributeInterface::SCOPE_GLOBAL) {
260-
$entityLinkField = $this->getEntity()->getLinkField();
261-
$attributeTable = $attribute->getBackend()->getTable();
262-
$linkField = $attribute->getEntity()->getLinkField();
263-
264259
$select = $this->getConnection()->select()
265260
->from(
266261
['e' => $this->getEntity()->getEntityTable()],
267262
['entity_id']
268263
)
269264
->join(
270-
['t_d' => $attributeTable],
271-
"e.{$entityLinkField} = t_d.{$linkField}",
265+
['t_d' => $attribute->getBackend()->getTable()],
266+
"e.{$this->getEntity()->getLinkField()} = t_d.{$attribute->getEntity()->getLinkField()}",
272267
['t_d.value']
273268
)->where(
274269
" e.entity_id = ?",
@@ -290,7 +285,7 @@ protected function _setItemAttributeValue($valueInfo)
290285
}
291286

292287
foreach ($this->_itemsById[$entityId] as $object) {
293-
$object->setData($attributeCode, $valueInfo['value']);
288+
$object->setData($attribute->getAttributeCode(), $valueInfo['value']);
294289
}
295290

296291
return $this;

app/code/Magento/Eav/Model/ResourceModel/ReadHandler.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Magento\Framework\Exception\LocalizedException;
2020
use Magento\Framework\Model\Entity\ScopeInterface;
2121
use Magento\Framework\Model\Entity\ScopeResolver;
22+
use Magento\Store\Model\Store;
2223
use Psr\Log\LoggerInterface;
2324

2425
/**
@@ -180,12 +181,9 @@ public function execute($entityType, $entityData, $arguments = [])
180181
foreach ($attributes as $attributeValue) {
181182
if (isset($attributesMap[$attributeValue['attribute_id']])) {
182183
if (isset($attributeScopeGlobal[$attributeValue['attribute_id']]) &&
183-
$attributeScopeGlobal[$attributeValue['attribute_id']]
184+
(int)$attributeValue['store_id'] !== Store::DEFAULT_STORE_ID
184185
) {
185-
if ((int)$attributeValue['store_id'] !== \Magento\Store\Model\Store::DEFAULT_STORE_ID) {
186-
continue;
187-
}
188-
$entityData[$attributesMap[$attributeValue['attribute_id']]] = $attributeValue['value'];
186+
continue;
189187
}
190188
$entityData[$attributesMap[$attributeValue['attribute_id']]] = $attributeValue['value'];
191189
} else {

app/code/Magento/Eav/Test/Unit/Model/ResourceModel/ReadHandlerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Magento\Framework\DB\Select;
1616
use Magento\Framework\EntityManager\EntityMetadataInterface;
1717
use Magento\Framework\EntityManager\MetadataPool;
18+
use Magento\Framework\Model\Entity\ScopeInterface;
1819
use Magento\Framework\Model\Entity\ScopeResolver;
1920
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
2021
use PHPUnit\Framework\MockObject\MockObject;
@@ -66,7 +67,7 @@ protected function setUp(): void
6667
$this->configMock = $args['config'];
6768
$this->scopeResolverMock = $args['scopeResolver'];
6869

69-
$scopeMock = $this->getMockBuilder(\Magento\Framework\Model\Entity\ScopeInterface::class)
70+
$scopeMock = $this->getMockBuilder(ScopeInterface::class)
7071
->disableOriginalConstructor()
7172
->getMock();
7273
$fallback = clone $scopeMock;

0 commit comments

Comments
 (0)