Skip to content

Commit d84ab16

Browse files
committed
Merge branch 'develop' of github.com:magento/magento2ce into MAGETWO-65293
2 parents 17f4c5c + f1dc91b commit d84ab16

File tree

201 files changed

+3289
-1141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

201 files changed

+3289
-1141
lines changed

app/code/Magento/CacheInvalidate/Model/PurgeCache.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public function sendPurgeRequest($tagsPattern)
5858
$headers = [self::HEADER_X_MAGENTO_TAGS_PATTERN => $tagsPattern];
5959
$socketAdapter->setOptions(['timeout' => 10]);
6060
foreach ($servers as $server) {
61+
$headers['Host'] = $server->getHost();
6162
try {
6263
$socketAdapter->connect($server->getHost(), $server->getPort());
6364
$socketAdapter->write(

app/code/Magento/CacheInvalidate/Test/Unit/Model/PurgeCacheTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function testSendPurgeRequest($hosts)
7070
->with($uri->getHost(), $uri->getPort());
7171
$this->socketAdapterMock->expects($this->at($i++))
7272
->method('write')
73-
->with('PURGE', $uri, '1.1', ['X-Magento-Tags-Pattern' => 'tags']);
73+
->with('PURGE', $uri, '1.1', ['X-Magento-Tags-Pattern' => 'tags', 'Host' => $uri->getHost()]);
7474
$i++;
7575
}
7676
$this->socketAdapterMock->expects($this->exactly(count($uris)))

app/code/Magento/Catalog/Block/Product/View/Attributes.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Magento\Catalog\Block\Product\View;
1313

1414
use Magento\Catalog\Model\Product;
15+
use Magento\Framework\Phrase;
1516
use Magento\Framework\Pricing\PriceCurrencyInterface;
1617

1718
class Attributes extends \Magento\Framework\View\Element\Template
@@ -85,8 +86,8 @@ public function getAdditionalData(array $excludeAttr = [])
8586
} elseif ($attribute->getFrontendInput() == 'price' && is_string($value)) {
8687
$value = $this->priceCurrency->convertAndFormat($value);
8788
}
88-
89-
if (is_string($value) && strlen($value)) {
89+
90+
if ($value instanceof Phrase || (is_string($value) && strlen($value))) {
9091
$data[$attribute->getAttributeCode()] = [
9192
'label' => __($attribute->getStoreLabel()),
9293
'value' => $value,

app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ public function build($storeId, $changedIds, $valueFieldSuffix)
7474
$attributes = $this->_productIndexerHelper->getAttributes();
7575
$eavAttributes = $this->_productIndexerHelper->getTablesStructure($attributes);
7676
$entityTableColumns = $eavAttributes[$entityTableName];
77+
$linkField = $this->getMetadataPool()
78+
->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class)
79+
->getLinkField();
7780

7881
$temporaryEavAttributes = $eavAttributes;
7982

@@ -101,11 +104,11 @@ public function build($storeId, $changedIds, $valueFieldSuffix)
101104
$temporaryTableName = $this->_getTemporaryTableName($tableName);
102105

103106
//Add primary key to temporary table for increase speed of joins in future
104-
$this->_addPrimaryKeyToTable($temporaryTableName);
107+
$this->_addPrimaryKeyToTable($temporaryTableName, $linkField);
105108

106109
//Create temporary table for composite attributes
107110
if (isset($valueTables[$temporaryTableName . $valueFieldSuffix])) {
108-
$this->_addPrimaryKeyToTable($temporaryTableName . $valueFieldSuffix);
111+
$this->_addPrimaryKeyToTable($temporaryTableName . $valueFieldSuffix, $linkField);
109112
}
110113

111114
//Fill temporary tables with attributes grouped by it type

app/code/Magento/Catalog/Setup/UpgradeData.php

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
use Magento\Catalog\Api\Data\ProductAttributeInterface;
99
use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface;
10-
use Magento\Eav\Model\Entity\AttributeCache;
1110
use Magento\Framework\Setup\UpgradeDataInterface;
1211
use Magento\Framework\Setup\ModuleContextInterface;
1312
use Magento\Framework\Setup\ModuleDataSetupInterface;
@@ -35,26 +34,16 @@ class UpgradeData implements UpgradeDataInterface
3534
*/
3635
private $eavSetupFactory;
3736

38-
/**
39-
* @var AttributeCache
40-
*/
41-
private $attributeCache;
42-
4337
/**
4438
* Init
4539
*
4640
* @param CategorySetupFactory $categorySetupFactory
4741
* @param EavSetupFactory $eavSetupFactory
48-
* @param AttributeCache $attributeCache
4942
*/
50-
public function __construct(
51-
CategorySetupFactory $categorySetupFactory,
52-
EavSetupFactory $eavSetupFactory,
53-
AttributeCache $attributeCache
54-
) {
43+
public function __construct(CategorySetupFactory $categorySetupFactory, EavSetupFactory $eavSetupFactory)
44+
{
5545
$this->categorySetupFactory = $categorySetupFactory;
5646
$this->eavSetupFactory = $eavSetupFactory;
57-
$this->attributeCache = $attributeCache;
5847
}
5948

6049
/**
@@ -146,24 +135,19 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
146135
}
147136

148137
if (version_compare($context->getVersion(), '2.0.4') < 0) {
149-
$mediaBackendType = 'static';
150-
$mediaBackendModel = null;
151138
/** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
152139
$categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
153140
$categorySetup->updateAttribute(
154141
'catalog_product',
155142
'media_gallery',
156143
'backend_type',
157-
$mediaBackendType
144+
'static'
158145
);
159146
$categorySetup->updateAttribute(
160147
'catalog_product',
161148
'media_gallery',
162-
'backend_model',
163-
$mediaBackendModel
149+
'backend_model'
164150
);
165-
166-
$this->changeMediaGalleryAttributeInCache($mediaBackendType, $mediaBackendModel);
167151
}
168152

169153
if (version_compare($context->getVersion(), '2.0.5', '<')) {
@@ -397,25 +381,4 @@ private function changePriceAttributeDefaultScope($categorySetup)
397381

398382
}
399383
}
400-
401-
/**
402-
* @param string $mediaBackendType
403-
* @param string $mediaBackendModel
404-
* @return void
405-
*/
406-
private function changeMediaGalleryAttributeInCache($mediaBackendType, $mediaBackendModel)
407-
{
408-
// need to do, because media_gallery has backend model in cache.
409-
$catalogProductAttributes = $this->attributeCache->getAttributes('catalog_product', '0-0');
410-
411-
if (is_array($catalogProductAttributes)) {
412-
/** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $catalogProductAttribute */
413-
foreach ($catalogProductAttributes as $catalogProductAttribute) {
414-
if ($catalogProductAttribute->getAttributeCode() == 'media_gallery') {
415-
$catalogProductAttribute->setBackendModel($mediaBackendModel);
416-
$catalogProductAttribute->setBackendType($mediaBackendType);
417-
}
418-
}
419-
}
420-
}
421384
}

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

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
// @codingStandardsIgnoreFile
8-
96
namespace Magento\Catalog\Test\Unit\Model\Entity;
107

118
use Magento\Catalog\Model\Entity\Attribute;
@@ -20,72 +17,72 @@ class AttributeTest extends \PHPUnit_Framework_TestCase
2017
/**
2118
* @var \Magento\Catalog\Model\Entity\Attribute
2219
*/
23-
protected $attribute;
20+
private $attribute;
2421

2522
/**
2623
* @var \Magento\Framework\Model\Context|\PHPUnit_Framework_MockObject_MockObject
2724
*/
28-
protected $contextMock;
25+
private $contextMock;
2926

3027
/**
3128
* @var \Magento\Framework\Registry|\PHPUnit_Framework_MockObject_MockObject
3229
*/
33-
protected $registryMock;
30+
private $registryMock;
3431

3532
/**
3633
* @var \Magento\Framework\Api\MetadataServiceInterface|\PHPUnit_Framework_MockObject_MockObject
3734
*/
38-
protected $metadataServiceMock;
35+
private $metadataServiceMock;
3936

4037
/**
4138
* @var \Magento\Framework\Api\AttributeValueFactory|\PHPUnit_Framework_MockObject_MockObject
4239
*/
43-
protected $attributeValueFactoryMock;
40+
private $attributeValueFactoryMock;
4441

4542
/**
4643
* @var \Magento\Eav\Model\Config|\PHPUnit_Framework_MockObject_MockObject
4744
*/
48-
protected $configMock;
45+
private $configMock;
4946

5047
/**
5148
* @var \Magento\Eav\Model\Entity\TypeFactory|\PHPUnit_Framework_MockObject_MockObject
5249
*/
53-
protected $typeFactoryMock;
50+
private $typeFactoryMock;
5451

5552
/**
5653
* @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject
5754
*/
58-
protected $storeManagerMock;
55+
private $storeManagerMock;
5956

6057
/**
6158
* @var \Magento\Eav\Model\ResourceModel\Helper|\PHPUnit_Framework_MockObject_MockObject
6259
*/
63-
protected $helperMock;
60+
private $helperMock;
6461

6562
/**
6663
* @var \Magento\Framework\Validator\UniversalFactory|\PHPUnit_Framework_MockObject_MockObject
6764
*/
68-
protected $universalFactoryMock;
65+
private $universalFactoryMock;
6966

7067
/**
7168
* @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface|\PHPUnit_Framework_MockObject_MockObject
7269
*/
73-
protected $timezoneMock;
70+
private $timezoneMock;
7471

7572
/**
7673
* @var \Magento\Catalog\Model\Product\ReservedAttributeList|\PHPUnit_Framework_MockObject_MockObject
7774
*/
78-
protected $reservedAttributeListMock;
75+
private $reservedAttributeListMock;
7976

8077
/**
8178
* @var \Magento\Framework\Locale\ResolverInterface|\PHPUnit_Framework_MockObject_MockObject
8279
*/
83-
protected $resolverMock;
80+
private $resolverMock;
8481

8582
/**
8683
* @var \Magento\Catalog\Model\Attribute\LockValidatorInterface|\PHPUnit_Framework_MockObject_MockObject
8784
*/
88-
protected $lockValidatorMock;
85+
private $lockValidatorMock;
8986

9087
/**
9188
* @var \Magento\Framework\Model\ResourceModel\AbstractResource|\PHPUnit_Framework_MockObject_MockObject
@@ -199,9 +196,6 @@ protected function setUp()
199196
->expects($this->any())
200197
->method('getEventDispatcher')
201198
->willReturn($this->eventDispatcher);
202-
$attributeCacheMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\AttributeCache::class)
203-
->disableOriginalConstructor()
204-
->getMock();
205199
$objectManagerHelper = new ObjectManagerHelper($this);
206200
$this->attribute = $objectManagerHelper->getObject(
207201
Attribute::class,
@@ -222,8 +216,7 @@ protected function setUp()
222216
'reservedAttributeList' => $this->reservedAttributeListMock,
223217
'resolver' => $this->resolverMock,
224218
'dateTimeFormatter' => $this->dateTimeFormatter,
225-
'resource' => $this->resourceMock,
226-
'attributeCache' => $attributeCacheMock
219+
'resource' => $this->resourceMock
227220
]
228221
);
229222
}

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

Lines changed: 1 addition & 6 deletions
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
}

app/code/Magento/CatalogInventory/Helper/Stock.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public function addIsInStockFilterToCollection($collection)
156156
$resource = $this->getStockStatusResource();
157157
$resource->addStockDataToCollection(
158158
$collection,
159-
!$isShowOutOfStock && $collection->getFlag('require_stock_items')
159+
!$isShowOutOfStock || $collection->getFlag('require_stock_items')
160160
);
161161
$collection->setFlag($stockFlag, true);
162162
}

0 commit comments

Comments
 (0)