Skip to content

Commit 3ae7c19

Browse files
author
Igor Melnikov
committed
MAGETWO-64218: Remove all usages/references of \Magento\Eav\Model\Entity\AttributeCache
- removing AttributeCache and references
1 parent d24f988 commit 3ae7c19

File tree

11 files changed

+5
-475
lines changed

11 files changed

+5
-475
lines changed

app/code/Magento/Catalog/Test/Unit/Model/Entity/AttributeTest.php

-239
This file was deleted.

app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Eav/AttributeTest.php

+1-22
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,6 @@ protected function setUp()
113113
->method('getConnection')
114114
->will($this->returnValue($dbAdapterMock));
115115

116-
$attributeCacheMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\AttributeCache::class)
117-
->disableOriginalConstructor()
118-
->getMock();
119-
120116
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
121117
$this->_model = $objectManager->getObject(
122118
\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class,
@@ -126,8 +122,7 @@ protected function setUp()
126122
'indexerEavProcessor' => $this->_eavProcessor,
127123
'resource' => $this->resourceMock,
128124
'data' => ['id' => 1],
129-
'eavConfig' => $this->eavConfigMock,
130-
'attributeCache' => $attributeCacheMock
125+
'eavConfig' => $this->eavConfigMock
131126
]
132127
);
133128
}
@@ -152,14 +147,6 @@ public function testIndexerAfterSaveScopeChangeAttribute()
152147
$this->_model->afterSave();
153148
}
154149

155-
public function testAfterSaveEavCache()
156-
{
157-
$this->eavConfigMock
158-
->expects($this->once())
159-
->method('clear');
160-
$this->_model->afterSave();
161-
}
162-
163150
public function testIndexerAfterDeleteAttribute()
164151
{
165152
$this->_processor->expects($this->once())->method('markIndexerAsInvalid');
@@ -168,14 +155,6 @@ public function testIndexerAfterDeleteAttribute()
168155
$this->_model->afterDeleteCommit();
169156
}
170157

171-
public function testAfterDeleteEavCache()
172-
{
173-
$this->eavConfigMock
174-
->expects($this->once())
175-
->method('clear');
176-
$this->_model->afterDelete();
177-
}
178-
179158
public function testGetScopeGlobal()
180159
{
181160
$objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);

app/code/Magento/Customer/Test/Unit/Model/AttributeTest.php

-9
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,6 @@ class AttributeTest extends \PHPUnit_Framework_TestCase
125125
*/
126126
private $dateTimeFormatter;
127127

128-
/**
129-
* @var \PHPUnit_Framework_MockObject_MockObject
130-
*/
131-
private $attributeCacheMock;
132-
133128
/**
134129
* @var \Magento\Customer\Model\Metadata\AttributeMetadataCache|\PHPUnit_Framework_MockObject_MockObject
135130
*/
@@ -208,9 +203,6 @@ protected function setUp()
208203
$this->indexerRegistryMock = $this->getMockBuilder(\Magento\Framework\Indexer\IndexerRegistry::class)
209204
->disableOriginalConstructor()
210205
->getMock();
211-
$this->attributeCacheMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\AttributeCache::class)
212-
->disableOriginalConstructor()
213-
->getMock();
214206
$this->attributeMetadataCacheMock = $this->getMockBuilder(AttributeMetadataCache::class)
215207
->disableOriginalConstructor()
216208
->getMock();
@@ -235,7 +227,6 @@ protected function setUp()
235227
'dateTimeFormatter' => $this->dateTimeFormatter,
236228
'indexerRegistry' => $this->indexerRegistryMock,
237229
'resource' => $this->resourceMock,
238-
'attributeCache' => $this->attributeCacheMock,
239230
'attributeMetadataCache' => $this->attributeMetadataCacheMock
240231
]
241232
);

app/code/Magento/Eav/Model/Entity/Attribute.php

-15
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,6 @@ public function beforeSave()
304304
public function afterSave()
305305
{
306306
$this->_getResource()->saveInSetIncluding($this);
307-
$this->getAttributeCache()->clear();
308307
return parent::afterSave();
309308
}
310309

@@ -313,23 +312,9 @@ public function afterSave()
313312
*/
314313
public function afterDelete()
315314
{
316-
$this->getAttributeCache()->clear();
317315
return parent::afterDelete();
318316
}
319317

320-
/**
321-
* Attribute cache
322-
*
323-
* @return AttributeCache
324-
*/
325-
private function getAttributeCache()
326-
{
327-
if (!$this->attributeCache) {
328-
$this->attributeCache = ObjectManager::getInstance()->get(AttributeCache::class);
329-
}
330-
return $this->attributeCache;
331-
}
332-
333318
/**
334319
* Detect backend storage type using frontend input type
335320
*

0 commit comments

Comments
 (0)