'Imported resource (image) does not exist in the local media storage',
ValidatorInterface::ERROR_MEDIA_URL_NOT_ACCESSIBLE => 'Imported resource (image) could not be downloaded from external resource due to timeout or access permissions',
ValidatorInterface::ERROR_INVALID_WEIGHT => 'Product weight is invalid',
+ ValidatorInterface::ERROR_DUPLICATE_URL_KEY => 'Specified url key is already exist',
];
/**
@@ -502,12 +508,24 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
*/
protected $categoryProcessor;
+ /** @var \Magento\Framework\App\Config\ScopeConfigInterface */
+ protected $scopeConfig;
+
+ /** @var \Magento\Catalog\Model\Product\Url */
+ protected $productUrl;
+
/** @var array */
protected $websitesCache = [];
/** @var array */
protected $categoriesCache = [];
+ /** @var array */
+ protected $productUrlSuffix = [];
+
+ /** @var array */
+ protected $productUrlKeys = [];
+
/**
* Instance of product tax class processor.
*
@@ -561,6 +579,12 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
*/
protected $cachedImages = null;
+ /** @var array */
+ protected $urlKeys = [];
+
+ /** @var array */
+ protected $rowNumbers = [];
+
/**
* @param \Magento\Framework\Json\Helper\Data $jsonHelper
* @param \Magento\ImportExport\Helper\Data $importExportData
@@ -596,6 +620,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
* @param ObjectRelationProcessor $objectRelationProcessor
* @param TransactionManagerInterface $transactionManager
* @param Product\TaxClassProcessor $taxClassProcessor
+ * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param array $data
* @throws \Magento\Framework\Exception\LocalizedException
*
@@ -636,6 +661,8 @@ public function __construct(
ObjectRelationProcessor $objectRelationProcessor,
TransactionManagerInterface $transactionManager,
Product\TaxClassProcessor $taxClassProcessor,
+ \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
+ \Magento\Catalog\Model\Product\Url $productUrl,
array $data = []
) {
$this->_eventManager = $eventManager;
@@ -663,6 +690,8 @@ public function __construct(
$this->objectRelationProcessor = $objectRelationProcessor;
$this->transactionManager = $transactionManager;
$this->taxClassProcessor = $taxClassProcessor;
+ $this->scopeConfig = $scopeConfig;
+ $this->productUrl = $productUrl;
parent::__construct(
$jsonHelper,
$importExportData,
@@ -1999,11 +2028,8 @@ protected function _saveStockItem()
*/
public function retrieveAttributeByCode($attrCode)
{
- if (!$this->_resource) {
- $this->_resource = $this->_resourceFactory->create();
- }
if (!isset($this->_attributeCache[$attrCode])) {
- $this->_attributeCache[$attrCode] = $this->_resource->getAttribute($attrCode);
+ $this->_attributeCache[$attrCode] = $this->getResource()->getAttribute($attrCode);
}
return $this->_attributeCache[$attrCode];
}
@@ -2214,7 +2240,25 @@ public function validateRow(array $rowData, $rowNum)
}
// validate custom options
$this->getOptionEntity()->validateRow($rowData, $rowNum);
-
+ if (!empty($rowData[self::URL_KEY]) || !empty($rowData[self::COL_NAME])) {
+ $urlKey = $this->getUrlKey($rowData);
+ $storeCodes = empty($rowData[self::COL_STORE_VIEW_CODE])
+ ? array_flip($this->storeResolver->getStoreCodeToId())
+ : explode($this->getMultipleValueSeparator(), $rowData[self::COL_STORE_VIEW_CODE]);
+ foreach ($storeCodes as $storeCode) {
+ $storeId = $this->storeResolver->getStoreCodeToId($storeCode);
+ $productUrlSuffix = $this->getProductUrlSuffix($storeId);
+ $urlPath = $urlKey . $productUrlSuffix;
+ if (empty($this->urlKeys[$storeId][$urlPath])
+ || ($this->urlKeys[$storeId][$urlPath] == $rowData[self::COL_SKU])
+ ) {
+ $this->urlKeys[$storeId][$urlPath] = $rowData[self::COL_SKU];
+ $this->rowNumbers[$storeId][$urlPath] = $rowNum;
+ } else {
+ $this->addRowError(ValidatorInterface::ERROR_DUPLICATE_URL_KEY, $rowNum);
+ }
+ }
+ }
return !$this->getErrorAggregator()->isRowInvalid($rowNum);
}
@@ -2319,7 +2363,79 @@ protected function _saveValidatedBunches()
$this->validateRow($rowData, $source->key());
$source->next();
}
+ $this->checkUrlKeyDuplicates();
$this->getOptionEntity()->validateAmbiguousData();
return parent::_saveValidatedBunches();
}
+
+ /**
+ * Check that url_keys are not assigned to other products in DB
+ *
+ * @return void
+ */
+ protected function checkUrlKeyDuplicates()
+ {
+ $resource = $this->getResource();
+ foreach ($this->urlKeys as $storeId => $urlKeys) {
+ $urlKeyDuplicates = $this->_connection->fetchAssoc(
+ $this->_connection->select()->from(
+ ['url_rewrite' => $resource->getTable('url_rewrite')],
+ ['request_path', 'store_id']
+ )->joinLeft(
+ ['cpe' => $resource->getTable('catalog_product_entity')],
+ "cpe.entity_id = url_rewrite.entity_id"
+ )->where('request_path IN (?)', array_keys($urlKeys))
+ ->where('store_id IN (?)', $storeId)
+ ->where('cpe.sku not in (?)', array_values($urlKeys))
+ );
+ foreach ($urlKeyDuplicates as $entityData) {
+ $rowNum = $this->rowNumbers[$entityData['store_id']][$entityData['request_path']];
+ $this->addRowError(ValidatorInterface::ERROR_DUPLICATE_URL_KEY, $rowNum);
+ }
+ }
+ }
+
+ /**
+ * Retrieve product rewrite suffix for store
+ *
+ * @param int $storeId
+ * @return string
+ */
+ protected function getProductUrlSuffix($storeId = null)
+ {
+ if (!isset($this->productUrlSuffix[$storeId])) {
+ $this->productUrlSuffix[$storeId] = $this->scopeConfig->getValue(
+ \Magento\CatalogUrlRewrite\Model\ProductUrlPathGenerator::XML_PATH_PRODUCT_URL_SUFFIX,
+ \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
+ $storeId
+ );
+ }
+ return $this->productUrlSuffix[$storeId];
+ }
+
+ /**
+ * @param array $rowData
+ * @return string
+ */
+ protected function getUrlKey($rowData)
+ {
+ if (!empty($rowData[self::URL_KEY])) {
+ $this->productUrlKeys[$rowData[self::COL_SKU]] = $rowData[self::URL_KEY];
+ }
+ $urlKey = !empty($this->productUrlKeys[$rowData[self::COL_SKU]])
+ ? $this->productUrlKeys[$rowData[self::COL_SKU]]
+ : $this->productUrl->formatUrlKey($rowData[self::COL_NAME]);
+ return $urlKey;
+ }
+
+ /**
+ * @return Proxy\Product\ResourceModel
+ */
+ protected function getResource()
+ {
+ if (!$this->_resource) {
+ $this->_resource = $this->_resourceFactory->create();
+ }
+ return $this->_resource;
+ }
}
diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product/RowValidatorInterface.php b/app/code/Magento/CatalogImportExport/Model/Import/Product/RowValidatorInterface.php
index 916775c4152c7..61a4f535fea4b 100644
--- a/app/code/Magento/CatalogImportExport/Model/Import/Product/RowValidatorInterface.php
+++ b/app/code/Magento/CatalogImportExport/Model/Import/Product/RowValidatorInterface.php
@@ -75,6 +75,8 @@ interface RowValidatorInterface extends \Magento\Framework\Validator\ValidatorIn
const ERROR_MEDIA_PATH_NOT_ACCESSIBLE = 'mediaPathNotAvailable';
+ const ERROR_DUPLICATE_URL_KEY = 'duplicatedUrlKey';
+
/**
* Value that means all entities (e.g. websites, groups etc.)
*/
diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php
index 4c70d9140e013..7cddc36322026 100644
--- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php
+++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php
@@ -154,6 +154,12 @@ class ProductTest extends \Magento\ImportExport\Test\Unit\Model\Import\AbstractI
*/
protected $errorAggregator;
+ /** @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject*/
+ protected $scopeConfig;
+
+ /** @var \Magento\Catalog\Model\Product\Url|\PHPUnit_Framework_MockObject_MockObject*/
+ protected $productUrl;
+
/**
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
@@ -315,6 +321,14 @@ protected function setUp()
->disableOriginalConstructor()
->getMock();
+ $this->scopeConfig = $this->getMockBuilder('\Magento\Framework\App\Config\ScopeConfigInterface')
+ ->disableOriginalConstructor()
+ ->getMockForAbstractClass();
+
+ $this->productUrl = $this->getMockBuilder('\Magento\Catalog\Model\Product\Url')
+ ->disableOriginalConstructor()
+ ->getMock();
+
$this->errorAggregator = $this->getErrorAggregatorObject();
$this->data = [];
@@ -360,6 +374,8 @@ protected function setUp()
$this->objectRelationProcessor,
$this->transactionManager,
$this->taxClassProcessor,
+ $this->scopeConfig,
+ $this->productUrl,
$this->data
);
}
diff --git a/app/code/Magento/CatalogImportExport/composer.json b/app/code/Magento/CatalogImportExport/composer.json
index f5a15c9bad15f..1d8c6328fa583 100644
--- a/app/code/Magento/CatalogImportExport/composer.json
+++ b/app/code/Magento/CatalogImportExport/composer.json
@@ -4,6 +4,7 @@
"require": {
"php": "~5.5.0|~5.6.0|~7.0.0",
"magento/module-catalog": "100.0.*",
+ "magento/module-catalog-url-rewrite": "100.0.*",
"magento/module-eav": "100.0.*",
"magento/module-import-export": "100.0.*",
"magento/module-store": "100.0.*",
@@ -15,7 +16,7 @@
"ext-ctype": "*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/CatalogInventory/composer.json b/app/code/Magento/CatalogInventory/composer.json
index 04ed15b9fb90d..afb736ab545b5 100644
--- a/app/code/Magento/CatalogInventory/composer.json
+++ b/app/code/Magento/CatalogInventory/composer.json
@@ -13,7 +13,7 @@
"magento/module-ui": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/CatalogRule/Plugin/Indexer/Product/Save/ApplyRulesAfterReindex.php b/app/code/Magento/CatalogRule/Plugin/Indexer/Product/Save/ApplyRulesAfterReindex.php
new file mode 100644
index 0000000000000..793880154c8b7
--- /dev/null
+++ b/app/code/Magento/CatalogRule/Plugin/Indexer/Product/Save/ApplyRulesAfterReindex.php
@@ -0,0 +1,40 @@
+productRuleProcessor = $productRuleProcessor;
+ }
+
+ /**
+ * Apply catalog rules after product resource model save
+ *
+ * @param \Magento\Catalog\Model\Product $subject
+ * @param callable $proceed
+ * @return \Magento\Catalog\Model\Product
+ */
+ public function aroundReindex(
+ \Magento\Catalog\Model\Product $subject,
+ callable $proceed
+ ) {
+ $proceed();
+ $this->productRuleProcessor->reindexRow($subject->getId());
+ return;
+ }
+}
diff --git a/app/code/Magento/CatalogRule/composer.json b/app/code/Magento/CatalogRule/composer.json
index c8f8dd69cc7ed..daa0a8de9b688 100644
--- a/app/code/Magento/CatalogRule/composer.json
+++ b/app/code/Magento/CatalogRule/composer.json
@@ -16,7 +16,7 @@
"magento/module-catalog-rule-sample-data": "Sample Data version:100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/CatalogRule/etc/webapi_rest/di.xml b/app/code/Magento/CatalogRule/etc/webapi_rest/di.xml
new file mode 100644
index 0000000000000..34c28a6e6929a
--- /dev/null
+++ b/app/code/Magento/CatalogRule/etc/webapi_rest/di.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
diff --git a/app/code/Magento/CatalogRuleConfigurable/composer.json b/app/code/Magento/CatalogRuleConfigurable/composer.json
index 9e5ec8e6ca8bb..23e241f6c28df 100644
--- a/app/code/Magento/CatalogRuleConfigurable/composer.json
+++ b/app/code/Magento/CatalogRuleConfigurable/composer.json
@@ -11,7 +11,7 @@
"magento/module-catalog-rule": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Filter/Preprocessor.php b/app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Filter/Preprocessor.php
index e692ea59d2d6e..4c08c948e4f58 100644
--- a/app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Filter/Preprocessor.php
+++ b/app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Filter/Preprocessor.php
@@ -107,7 +107,7 @@ private function processQueryWithField(FilterInterface $filter, $isNegation, $qu
$query
);
} elseif ($filter->getField() === 'category_ids') {
- return 'category_ids_index.category_id = ' . $filter->getValue();
+ return 'category_ids_index.category_id = ' . (int) $filter->getValue();
} elseif ($attribute->isStatic()) {
$alias = $this->tableMapper->getMappingAlias($filter);
$resultQuery = str_replace(
@@ -194,10 +194,10 @@ private function processTermSelect(FilterInterface $filter, $isNegation)
$value = sprintf(
'%s IN (%s)',
($isNegation ? 'NOT' : ''),
- implode(',', $filter->getValue())
+ implode(',', array_map([$this->connection, 'quote'], $filter->getValue()))
);
} else {
- $value = ($isNegation ? '!' : '') . '= ' . $filter->getValue();
+ $value = ($isNegation ? '!' : '') . '= ' . $this->connection->quote($filter->getValue());
}
$resultQuery = sprintf(
'%1$s.value %2$s',
diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php
index c59954933ce39..c6c8cad564234 100644
--- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php
+++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php
@@ -89,10 +89,7 @@ public function execute($ids)
foreach ($storeIds as $storeId) {
$dimension = $this->dimensionFactory->create(['name' => 'scope', 'value' => $storeId]);
$saveHandler->deleteIndex([$dimension], new \ArrayObject($ids));
- $saveHandler->saveIndex(
- [$dimension],
- $this->fullAction->rebuildStoreIndex($storeId, $ids)
- );
+ $saveHandler->saveIndex([$dimension], $this->fullAction->rebuildStoreIndex($storeId, $ids));
}
}
@@ -111,10 +108,8 @@ public function executeFull()
foreach ($storeIds as $storeId) {
$dimension = $this->dimensionFactory->create(['name' => 'scope', 'value' => $storeId]);
$saveHandler->cleanIndex([$dimension]);
- $saveHandler->saveIndex(
- [$dimension],
- $this->fullAction->rebuildStoreIndex($storeId)
- );
+ $saveHandler->saveIndex([$dimension], $this->fullAction->rebuildStoreIndex($storeId));
+
}
$this->fulltextResource->resetSearchResults();
$this->searchRequestConfig->reset();
diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProvider.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProvider.php
new file mode 100644
index 0000000000000..385fd7be3b4ba
--- /dev/null
+++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProvider.php
@@ -0,0 +1,479 @@
+resource = $resource;
+ $this->connection = $resource->getConnection();
+ $this->catalogProductType = $catalogProductType;
+ $this->eavConfig = $eavConfig;
+ $this->productAttributeCollectionFactory = $prodAttributeCollectionFactory;
+ $this->eventManager = $eventManager;
+ $this->storeManager = $storeManager;
+ $this->engine = $engineProvider->get();
+ }
+
+ /**
+ * Return validated table name
+ *
+ * @param string|string[] $table
+ * @return string
+ */
+ private function getTable($table)
+ {
+ return $this->resource->getTableName($table);
+ }
+
+ /**
+ * Retrieve searchable products per store
+ *
+ * @param int $storeId
+ * @param array $staticFields
+ * @param array|int $productIds
+ * @param int $lastProductId
+ * @param int $limit
+ * @return array
+ */
+ public function getSearchableProducts(
+ $storeId,
+ array $staticFields,
+ $productIds = null,
+ $lastProductId = 0,
+ $limit = 100
+ ) {
+ $websiteId = $this->storeManager->getStore($storeId)->getWebsiteId();
+ $select = $this->connection->select()
+ ->useStraightJoin(true)
+ ->from(
+ ['e' => $this->getTable('catalog_product_entity')],
+ array_merge(['entity_id', 'type_id'], $staticFields)
+ )
+ ->join(
+ ['website' => $this->getTable('catalog_product_website')],
+ $this->connection->quoteInto('website.product_id = e.entity_id AND website.website_id = ?', $websiteId),
+ []
+ );
+
+ if ($productIds !== null) {
+ $select->where('e.entity_id IN (?)', $productIds);
+ }
+
+ $select->where('e.entity_id > ?', $lastProductId)->limit($limit)->order('e.entity_id');
+
+ $result = $this->connection->fetchAll($select);
+
+ return $result;
+ }
+
+ /**
+ * Retrieve EAV Config Singleton
+ *
+ * @return \Magento\Eav\Model\Config
+ */
+ private function getEavConfig()
+ {
+ return $this->eavConfig;
+ }
+
+ /**
+ * Retrieve searchable attributes
+ *
+ * @param string $backendType
+ * @return \Magento\Eav\Model\Entity\Attribute[]
+ */
+ private function getSearchableAttributes($backendType = null)
+ {
+ if (null === $this->searchableAttributes) {
+ $this->searchableAttributes = [];
+
+ /** @var \Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection $productAttributes */
+ $productAttributes = $this->productAttributeCollectionFactory->create();
+ $productAttributes->addToIndexFilter(true);
+
+ /** @var \Magento\Eav\Model\Entity\Attribute[] $attributes */
+ $attributes = $productAttributes->getItems();
+
+ $this->eventManager->dispatch(
+ 'catelogsearch_searchable_attributes_load_after',
+ ['engine' => $this->engine, 'attributes' => $attributes]
+ );
+
+ $entity = $this->getEavConfig()->getEntityType(\Magento\Catalog\Model\Product::ENTITY)->getEntity();
+
+ foreach ($attributes as $attribute) {
+ $attribute->setEntity($entity);
+ }
+
+ $this->searchableAttributes = $attributes;
+ }
+
+ if ($backendType !== null) {
+ $attributes = [];
+ foreach ($this->searchableAttributes as $attributeId => $attribute) {
+ if ($attribute->getBackendType() == $backendType) {
+ $attributes[$attributeId] = $attribute;
+ }
+ }
+
+ return $attributes;
+ }
+
+ return $this->searchableAttributes;
+ }
+
+ /**
+ * Retrieve searchable attribute by Id or code
+ *
+ * @param int|string $attribute
+ * @return \Magento\Eav\Model\Entity\Attribute
+ */
+ private function getSearchableAttribute($attribute)
+ {
+ $attributes = $this->getSearchableAttributes();
+ if (is_numeric($attribute)) {
+ if (isset($attributes[$attribute])) {
+ return $attributes[$attribute];
+ }
+ } elseif (is_string($attribute)) {
+ foreach ($attributes as $attributeModel) {
+ if ($attributeModel->getAttributeCode() == $attribute) {
+ return $attributeModel;
+ }
+ }
+ }
+
+ return $this->getEavConfig()->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $attribute);
+ }
+
+ /**
+ * Returns expression for field unification
+ *
+ * @param string $field
+ * @param string $backendType
+ * @return \Zend_Db_Expr
+ */
+ private function unifyField($field, $backendType = 'varchar')
+ {
+ if ($backendType == 'datetime') {
+ $expr = $this->connection->getDateFormatSql($field, '%Y-%m-%d %H:%i:%s');
+ } else {
+ $expr = $field;
+ }
+ return $expr;
+ }
+
+ /**
+ * Load product(s) attributes
+ *
+ * @param int $storeId
+ * @param array $productIds
+ * @param array $attributeTypes
+ * @return array
+ */
+ public function getProductAttributes($storeId, array $productIds, array $attributeTypes)
+ {
+ $result = [];
+ $selects = [];
+ $ifStoreValue = $this->connection->getCheckSql('t_store.value_id > 0', 't_store.value', 't_default.value');
+ foreach ($attributeTypes as $backendType => $attributeIds) {
+ if ($attributeIds) {
+ $tableName = $this->getTable('catalog_product_entity_' . $backendType);
+ $selects[] = $this->connection->select()->from(
+ ['t_default' => $tableName],
+ ['entity_id', 'attribute_id']
+ )->joinLeft(
+ ['t_store' => $tableName],
+ $this->connection->quoteInto(
+ 't_default.entity_id=t_store.entity_id' .
+ ' AND t_default.attribute_id=t_store.attribute_id' .
+ ' AND t_store.store_id = ?',
+ $storeId
+ ),
+ ['value' => $this->unifyField($ifStoreValue, $backendType)]
+ )->where(
+ 't_default.store_id = ?',
+ 0
+ )->where(
+ 't_default.attribute_id IN (?)',
+ $attributeIds
+ )->where(
+ 't_default.entity_id IN (?)',
+ $productIds
+ );
+ }
+ }
+
+ if ($selects) {
+ $select = $this->connection->select()->union($selects, \Magento\Framework\DB\Select::SQL_UNION_ALL);
+ $query = $this->connection->query($select);
+ while ($row = $query->fetch()) {
+ $result[$row['entity_id']][$row['attribute_id']] = $row['value'];
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Retrieve Product Type Instance
+ *
+ * @param string $typeId
+ * @return \Magento\Catalog\Model\Product\Type\AbstractType
+ */
+ private function getProductTypeInstance($typeId)
+ {
+ if (!isset($this->productTypes[$typeId])) {
+ $productEmulator = $this->getProductEmulator($typeId);
+
+ $this->productTypes[$typeId] = $this->catalogProductType->factory($productEmulator);
+ }
+ return $this->productTypes[$typeId];
+ }
+
+ /**
+ * Return all product children ids
+ *
+ * @param int $productId Product Entity Id
+ * @param string $typeId Super Product Link Type
+ * @return array|null
+ */
+ public function getProductChildIds($productId, $typeId)
+ {
+ $typeInstance = $this->getProductTypeInstance($typeId);
+ $relation = $typeInstance->isComposite(
+ $this->getProductEmulator($typeId)
+ ) ? $typeInstance->getRelationInfo() : false;
+
+ if ($relation && $relation->getTable() && $relation->getParentFieldName() && $relation->getChildFieldName()) {
+ $select = $this->connection->select()->from(
+ ['main' => $this->getTable($relation->getTable())],
+ [$relation->getChildFieldName()]
+ )->where(
+ $relation->getParentFieldName() . ' = ?',
+ $productId
+ );
+ if ($relation->getWhere() !== null) {
+ $select->where($relation->getWhere());
+ }
+ return $this->connection->fetchCol($select);
+ }
+
+ return null;
+ }
+
+ /**
+ * Retrieve Product Emulator (Magento Object)
+ *
+ * @param string $typeId
+ * @return \Magento\Framework\DataObject
+ */
+ private function getProductEmulator($typeId)
+ {
+ if (!isset($this->productEmulators[$typeId])) {
+ $productEmulator = new \Magento\Framework\DataObject();
+ $productEmulator->setTypeId($typeId);
+ $this->productEmulators[$typeId] = $productEmulator;
+ }
+ return $this->productEmulators[$typeId];
+ }
+
+ /**
+ * Prepare Fulltext index value for product
+ *
+ * @param array $indexData
+ * @param array $productData
+ * @param int $storeId
+ * @return string
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
+ */
+ public function prepareProductIndex($indexData, $productData, $storeId)
+ {
+ $index = [];
+
+ foreach ($this->getSearchableAttributes('static') as $attribute) {
+ $attributeCode = $attribute->getAttributeCode();
+
+ if (isset($productData[$attributeCode])) {
+
+ if ('store_id' === $attributeCode) {
+ continue;
+ }
+
+ $value = $this->getAttributeValue($attribute->getId(), $productData[$attributeCode], $storeId);
+ if ($value) {
+ if (isset($index[$attribute->getId()])) {
+ if (!is_array($index[$attribute->getId()])) {
+ $index[$attribute->getId()] = [$index[$attribute->getId()]];
+ }
+ $index[$attribute->getId()][] = $value;
+ } else {
+ $index[$attribute->getId()] = $value;
+ }
+ }
+ }
+ }
+
+ foreach ($indexData as $entityId => $attributeData) {
+ foreach ($attributeData as $attributeId => $attributeValue) {
+ $value = $this->getAttributeValue($attributeId, $attributeValue, $storeId);
+ if (!empty($value)) {
+ if (isset($index[$attributeId])) {
+ $index[$attributeId][$entityId] = $value;
+ } else {
+ $index[$attributeId] = [$entityId => $value];
+ }
+ }
+ }
+ }
+
+ $product = $this->getProductEmulator(
+ $productData['type_id']
+ )->setId(
+ $productData['entity_id']
+ )->setStoreId(
+ $storeId
+ );
+ $typeInstance = $this->getProductTypeInstance($productData['type_id']);
+ $data = $typeInstance->getSearchableData($product);
+ if ($data) {
+ $index['options'] = $data;
+ }
+
+ return $this->engine->prepareEntityIndex($index, $this->separator);
+ }
+
+ /**
+ * Retrieve attribute source value for search
+ *
+ * @param int $attributeId
+ * @param mixed $valueId
+ * @param int $storeId
+ * @return string
+ */
+ private function getAttributeValue($attributeId, $valueId, $storeId)
+ {
+ $attribute = $this->getSearchableAttribute($attributeId);
+ $value = $this->engine->processAttributeValue($attribute, $valueId);
+
+ if (false !== $value
+ && $attribute->getIsSearchable()
+ && $attribute->usesSource()
+ && $this->engine->allowAdvancedIndex()
+ ) {
+ $attribute->setStoreId($storeId);
+
+ $valueText = (array) $attribute->getSource()->getIndexOptionText($valueId);
+
+ $pieces = array_filter(array_merge([$value], $valueText));
+
+ $value = implode($this->separator, $pieces);
+ }
+
+ $value = preg_replace('/\\s+/siu', ' ', trim(strip_tags($value)));
+
+ return $value;
+ }
+}
diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/Full.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/Full.php
index 4c0f94351f51d..e6f4c2f452766 100644
--- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/Full.php
+++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/Full.php
@@ -151,6 +151,11 @@ class Full
*/
protected $connection;
+ /**
+ * @var \Magento\CatalogSearch\Model\Indexer\Fulltext\Action\IndexIteratorFactory
+ */
+ private $iteratorFactory;
+
/**
* @param ResourceConnection $resource
* @param \Magento\Catalog\Model\Product\Type $catalogProductType
@@ -169,6 +174,7 @@ class Full
* @param \Magento\CatalogSearch\Model\ResourceModel\Fulltext $fulltextResource
* @param \Magento\Framework\Search\Request\DimensionFactory $dimensionFactory
* @param \Magento\Framework\Indexer\ConfigInterface $indexerConfig
+ * @param \Magento\CatalogSearch\Model\Indexer\Fulltext\Action\IndexIteratorFactory $indexIteratorFactory
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
@@ -188,7 +194,8 @@ public function __construct(
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate,
\Magento\CatalogSearch\Model\ResourceModel\Fulltext $fulltextResource,
\Magento\Framework\Search\Request\DimensionFactory $dimensionFactory,
- \Magento\Framework\Indexer\ConfigInterface $indexerConfig
+ \Magento\Framework\Indexer\ConfigInterface $indexerConfig,
+ \Magento\CatalogSearch\Model\Indexer\Fulltext\Action\IndexIteratorFactory $indexIteratorFactory
) {
$this->resource = $resource;
$this->connection = $resource->getConnection();
@@ -208,6 +215,7 @@ public function __construct(
$this->localeDate = $localeDate;
$this->fulltextResource = $fulltextResource;
$this->dimensionFactory = $dimensionFactory;
+ $this->iteratorFactory = $indexIteratorFactory;
}
/**
@@ -236,27 +244,6 @@ protected function getTable($table)
return $this->resource->getTableName($table);
}
- /**
- * Regenerate search index for all stores
- *
- * @param int|array|null $productIds
- * @return void
- */
- protected function rebuildIndex($productIds = null)
- {
- $storeIds = array_keys($this->storeManager->getStores());
- foreach ($storeIds as $storeId) {
- $dimension = $this->dimensionFactory->create(['name' => self::SCOPE_FIELD_NAME, 'value' => $storeId]);
- $this->indexHandler->deleteIndex([$dimension], $this->getIterator($productIds));
- $this->indexHandler->saveIndex(
- [$dimension],
- $this->rebuildStoreIndex($storeId, $productIds)
- );
- }
- $this->fulltextResource->resetSearchResults();
- $this->searchRequestConfig->reset();
- }
-
/**
* Get parents IDs of product IDs to be re-indexed
*
@@ -309,114 +296,16 @@ public function rebuildStoreIndex($storeId, $productIds = null)
$statusIds = $this->catalogProductStatus->getVisibleStatusIds();
$allowedVisibility = $this->engine->getAllowedVisibility();
- $lastProductId = 0;
- while (true) {
- $products = $this->getSearchableProducts($storeId, $staticFields, $productIds, $lastProductId);
- if (!$products) {
- break;
- }
-
- $productAttributes = [];
- $productRelations = [];
- foreach ($products as $productData) {
- $lastProductId = $productData['entity_id'];
- $productAttributes[$productData['entity_id']] = $productData['entity_id'];
- $productChildren = $this->getProductChildIds($productData['entity_id'], $productData['type_id']);
- $productRelations[$productData['entity_id']] = $productChildren;
- if ($productChildren) {
- foreach ($productChildren as $productChildId) {
- $productAttributes[$productChildId] = $productChildId;
- }
- }
- }
-
- $productAttributes = $this->getProductAttributes($storeId, $productAttributes, $dynamicFields);
- foreach ($products as $productData) {
- if (!isset($productAttributes[$productData['entity_id']])) {
- continue;
- }
-
- $productAttr = $productAttributes[$productData['entity_id']];
- if (!isset($productAttr[$visibility->getId()])
- || !in_array($productAttr[$visibility->getId()], $allowedVisibility)
- ) {
- continue;
- }
- if (!isset($productAttr[$status->getId()])
- || !in_array($productAttr[$status->getId()], $statusIds)
- ) {
- continue;
- }
-
- $productIndex = [$productData['entity_id'] => $productAttr];
-
- $hasChildren = false;
- $productChildren = $productRelations[$productData['entity_id']];
- if ($productChildren) {
- foreach ($productChildren as $productChildId) {
- if (isset($productAttributes[$productChildId])) {
- $productChildAttr = $productAttributes[$productChildId];
- if (!isset($productChildAttr[$status->getId()])
- || !in_array($productChildAttr[$status->getId()], $statusIds)
- ) {
- continue;
- }
-
- $hasChildren = true;
- $productIndex[$productChildId] = $productChildAttr;
- }
- }
- }
- if ($productChildren !== null && !$hasChildren) {
- continue;
- }
-
- $index = $this->prepareProductIndex($productIndex, $productData, $storeId);
-
- yield $productData['entity_id'] => $index;
- }
- }
- }
-
- /**
- * Retrieve searchable products per store
- *
- * @param int $storeId
- * @param array $staticFields
- * @param array|int $productIds
- * @param int $lastProductId
- * @param int $limit
- * @return array
- */
- protected function getSearchableProducts(
- $storeId,
- array $staticFields,
- $productIds = null,
- $lastProductId = 0,
- $limit = 100
- ) {
- $websiteId = $this->storeManager->getStore($storeId)->getWebsiteId();
- $select = $this->connection->select()
- ->useStraightJoin(true)
- ->from(
- ['e' => $this->getTable('catalog_product_entity')],
- array_merge(['entity_id', 'type_id'], $staticFields)
- )
- ->join(
- ['website' => $this->getTable('catalog_product_website')],
- $this->connection->quoteInto('website.product_id = e.entity_id AND website.website_id = ?', $websiteId),
- []
- );
-
- if ($productIds !== null) {
- $select->where('e.entity_id IN (?)', $productIds);
- }
-
- $select->where('e.entity_id > ?', $lastProductId)->limit($limit)->order('e.entity_id');
-
- $result = $this->connection->fetchAll($select);
-
- return $result;
+ return $this->iteratorFactory->create([
+ 'storeId' => $storeId,
+ 'productIds' => $productIds,
+ 'staticFields' => $staticFields,
+ 'dynamicFields' => $dynamicFields,
+ 'visibility' => $visibility,
+ 'allowedVisibility' => $allowedVisibility,
+ 'status' => $status,
+ 'statusIds' => $statusIds
+ ]);
}
/**
@@ -431,19 +320,6 @@ protected function cleanIndex($storeId)
$this->indexHandler->cleanIndex([$dimension]);
}
- /**
- * Delete search index data for store
- *
- * @param int $storeId Store View Id
- * @param array $productIds Product Entity Id
- * @return void
- */
- protected function deleteIndex($storeId = null, $productIds = null)
- {
- $dimension = $this->dimensionFactory->create(['name' => self::SCOPE_FIELD_NAME, 'value' => $storeId]);
- $this->indexHandler->deleteIndex([$dimension], $this->getIterator($productIds));
- }
-
/**
* Retrieve EAV Config Singleton
*
@@ -540,58 +416,6 @@ protected function unifyField($field, $backendType = 'varchar')
return $expr;
}
- /**
- * Load product(s) attributes
- *
- * @param int $storeId
- * @param array $productIds
- * @param array $attributeTypes
- * @return array
- */
- protected function getProductAttributes($storeId, array $productIds, array $attributeTypes)
- {
- $result = [];
- $selects = [];
- $ifStoreValue = $this->connection->getCheckSql('t_store.value_id > 0', 't_store.value', 't_default.value');
- foreach ($attributeTypes as $backendType => $attributeIds) {
- if ($attributeIds) {
- $tableName = $this->getTable('catalog_product_entity_' . $backendType);
- $selects[] = $this->connection->select()->from(
- ['t_default' => $tableName],
- ['entity_id', 'attribute_id']
- )->joinLeft(
- ['t_store' => $tableName],
- $this->connection->quoteInto(
- 't_default.entity_id=t_store.entity_id' .
- ' AND t_default.attribute_id=t_store.attribute_id' .
- ' AND t_store.store_id = ?',
- $storeId
- ),
- ['value' => $this->unifyField($ifStoreValue, $backendType)]
- )->where(
- 't_default.store_id = ?',
- 0
- )->where(
- 't_default.attribute_id IN (?)',
- $attributeIds
- )->where(
- 't_default.entity_id IN (?)',
- $productIds
- );
- }
- }
-
- if ($selects) {
- $select = $this->connection->select()->union($selects, \Magento\Framework\DB\Select::SQL_UNION_ALL);
- $query = $this->connection->query($select);
- while ($row = $query->fetch()) {
- $result[$row['entity_id']][$row['attribute_id']] = $row['value'];
- }
- }
-
- return $result;
- }
-
/**
* Retrieve Product Type Instance
*
@@ -608,37 +432,6 @@ protected function getProductTypeInstance($typeId)
return $this->productTypes[$typeId];
}
- /**
- * Return all product children ids
- *
- * @param int $productId Product Entity Id
- * @param string $typeId Super Product Link Type
- * @return array|null
- */
- protected function getProductChildIds($productId, $typeId)
- {
- $typeInstance = $this->getProductTypeInstance($typeId);
- $relation = $typeInstance->isComposite(
- $this->getProductEmulator($typeId)
- ) ? $typeInstance->getRelationInfo() : false;
-
- if ($relation && $relation->getTable() && $relation->getParentFieldName() && $relation->getChildFieldName()) {
- $select = $this->connection->select()->from(
- ['main' => $this->getTable($relation->getTable())],
- [$relation->getChildFieldName()]
- )->where(
- $relation->getParentFieldName() . ' = ?',
- $productId
- );
- if ($relation->getWhere() !== null) {
- $select->where($relation->getWhere());
- }
- return $this->connection->fetchCol($select);
- }
-
- return null;
- }
-
/**
* Retrieve Product Emulator (Magento Object)
*
@@ -654,149 +447,4 @@ protected function getProductEmulator($typeId)
}
return $this->productEmulators[$typeId];
}
-
- /**
- * Prepare Fulltext index value for product
- *
- * @param array $indexData
- * @param array $productData
- * @param int $storeId
- * @return string
- * @SuppressWarnings(PHPMD.CyclomaticComplexity)
- * @SuppressWarnings(PHPMD.NPathComplexity)
- */
- protected function prepareProductIndex($indexData, $productData, $storeId)
- {
- $index = [];
-
- foreach ($this->getSearchableAttributes('static') as $attribute) {
- $attributeCode = $attribute->getAttributeCode();
-
- if (isset($productData[$attributeCode])) {
-
- if ('store_id' === $attributeCode) {
- continue;
- }
-
- $value = $this->getAttributeValue($attribute->getId(), $productData[$attributeCode], $storeId);
- if ($value) {
- if (isset($index[$attribute->getId()])) {
- if (!is_array($index[$attribute->getId()])) {
- $index[$attribute->getId()] = [$index[$attribute->getId()]];
- }
- $index[$attribute->getId()][] = $value;
- } else {
- $index[$attribute->getId()] = $value;
- }
- }
- }
- }
-
- foreach ($indexData as $entityId => $attributeData) {
- foreach ($attributeData as $attributeId => $attributeValue) {
- $value = $this->getAttributeValue($attributeId, $attributeValue, $storeId);
- if (!empty($value)) {
- if (isset($index[$attributeId])) {
- $index[$attributeId][$entityId] = $value;
- } else {
- $index[$attributeId] = [$entityId => $value];
- }
- }
- }
- }
-
- $product = $this->getProductEmulator(
- $productData['type_id']
- )->setId(
- $productData['entity_id']
- )->setStoreId(
- $storeId
- );
- $typeInstance = $this->getProductTypeInstance($productData['type_id']);
- $data = $typeInstance->getSearchableData($product);
- if ($data) {
- $index['options'] = $data;
- }
-
- return $this->engine->prepareEntityIndex($index, $this->separator);
- }
-
- /**
- * Retrieve attribute source value for search
- *
- * @param int $attributeId
- * @param mixed $valueId
- * @param int $storeId
- * @return mixed
- */
- protected function getAttributeValue($attributeId, $valueId, $storeId)
- {
- $attribute = $this->getSearchableAttribute($attributeId);
- $value = $this->engine->processAttributeValue($attribute, $valueId);
-
- if (false !== $value
- && $attribute->getIsSearchable()
- && $attribute->usesSource()
- && $this->engine->allowAdvancedIndex()
- ) {
- $attribute->setStoreId($storeId);
-
- $valueText = (array) $attribute->getSource()->getIndexOptionText($valueId);
-
- $pieces = array_filter(array_merge([$value], $valueText));
-
- $value = implode($this->separator, $pieces);
- }
-
- $value = preg_replace('/\\s+/siu', ' ', trim(strip_tags($value)));
-
- return $value;
- }
-
- /**
- * Retrieve Date value for store
- *
- * @param int $storeId
- * @param string $date
- * @return string|null
- */
- protected function getStoreDate($storeId, $date = null)
- {
- if (!isset($this->dates[$storeId])) {
- $timezone = $this->scopeConfig->getValue(
- $this->localeDate->getDefaultTimezonePath(),
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $storeId
- );
-
- $this->localeResolver->emulate($storeId);
-
- $dateObj = new \DateTime();
- $dateObj->setTimezone(new \DateTimeZone($timezone));
- $this->dates[$storeId] = $dateObj;
-
- $this->localeResolver->revert();
- }
-
- if (!$this->dateTime->isEmptyDate($date)) {
- /** @var \DateTime $dateObj */
- $dateObj = $this->dates[$storeId];
- return $this->localeDate->formatDateTime($dateObj, \IntlDateFormatter::MEDIUM, \IntlDateFormatter::NONE);
- }
-
- return null;
- }
-
- /**
- * Get iterator
- *
- * @param array $data
- * @return \Generator
- */
- protected function getIterator(array $data)
- {
- foreach ($data as $key => $value) {
- yield $key => $value;
- }
- }
}
diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/IndexIterator.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/IndexIterator.php
new file mode 100644
index 0000000000000..9476ab14132d1
--- /dev/null
+++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/IndexIterator.php
@@ -0,0 +1,266 @@
+dataProvider = $dataProvider;
+ $this->storeId = $storeId;
+ $this->staticFields = $staticFields;
+ $this->productIds = $productIds;
+ $this->dynamicFields = $dynamicFields;
+ $this->visibility = $visibility;
+ $this->allowedVisibility = $allowedVisibility;
+ $this->status = $status;
+ $this->statusIds = $statusIds;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public function current()
+ {
+ return $this->current;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function next()
+ {
+ \next($this->products);
+ if (\key($this->products) === null) {
+ // check if storage has more items to process
+ $this->products = $this->dataProvider->getSearchableProducts(
+ $this->storeId,
+ $this->staticFields,
+ $this->productIds,
+ $this->lastProductId
+ );
+
+ if (!count($this->products)) {
+ $this->isValid = false;
+ return;
+ }
+
+ $productAttributes = [];
+ $this->productRelations = [];
+ foreach ($this->products as $productData) {
+ $this->lastProductId = $productData['entity_id'];
+ $productAttributes[$productData['entity_id']] = $productData['entity_id'];
+ $productChildren = $this->dataProvider->getProductChildIds(
+ $productData['entity_id'],
+ $productData['type_id']
+ );
+ $this->productRelations[$productData['entity_id']] = $productChildren;
+ if ($productChildren) {
+ foreach ($productChildren as $productChildId) {
+ $productAttributes[$productChildId] = $productChildId;
+ }
+ }
+ }
+ \reset($this->products);
+
+ $this->productAttributes = $this->dataProvider->getProductAttributes(
+ $this->storeId,
+ $productAttributes,
+ $this->dynamicFields
+ );
+ }
+
+ $productData = \current($this->products);
+
+ if (!isset($this->productAttributes[$productData['entity_id']])) {
+ $this->next();
+ return;
+ }
+
+ $productAttr = $this->productAttributes[$productData['entity_id']];
+ if (!isset($productAttr[$this->visibility->getId()])
+ || !in_array($productAttr[$this->visibility->getId()], $this->allowedVisibility)
+ ) {
+ $this->next();
+ return;
+ }
+ if (!isset($productAttr[$this->status->getId()])
+ || !in_array($productAttr[$this->status->getId()], $this->statusIds)
+ ) {
+ $this->next();
+ return;
+ }
+
+ $productIndex = [$productData['entity_id'] => $productAttr];
+
+ $hasChildren = false;
+ $productChildren = $this->productRelations[$productData['entity_id']];
+ if ($productChildren) {
+ foreach ($productChildren as $productChildId) {
+ if (isset($this->productAttributes[$productChildId])) {
+ $productChildAttr = $this->productAttributes[$productChildId];
+ if (!isset($productChildAttr[$this->status->getId()])
+ || !in_array($productChildAttr[$this->status->getId()], $this->statusIds)
+ ) {
+ continue;
+ }
+
+ $hasChildren = true;
+ $productIndex[$productChildId] = $productChildAttr;
+ }
+ }
+ }
+ if ($productChildren !== null && !$hasChildren) {
+ $this->next();
+ return;
+ }
+
+ $index = $this->dataProvider->prepareProductIndex($productIndex, $productData, $this->storeId);
+
+ $this->current = $index;
+ $this->key = $productData['entity_id'];
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function key()
+ {
+ return $this->key;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function valid()
+ {
+ return $this->isValid;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function rewind()
+ {
+ $this->lastProductId = 0;
+ $this->key = null;
+ $this->current = null;
+ unset($this->products);
+ $this->products = [];
+ $this->next();
+ }
+}
diff --git a/app/code/Magento/CatalogSearch/Test/Unit/Model/Adapter/Mysql/Filter/PreprocessorTest.php b/app/code/Magento/CatalogSearch/Test/Unit/Model/Adapter/Mysql/Filter/PreprocessorTest.php
index ccc83be62eb11..368fdb039fdf4 100644
--- a/app/code/Magento/CatalogSearch/Test/Unit/Model/Adapter/Mysql/Filter/PreprocessorTest.php
+++ b/app/code/Magento/CatalogSearch/Test/Unit/Model/Adapter/Mysql/Filter/PreprocessorTest.php
@@ -104,7 +104,7 @@ protected function setUp()
->getMock();
$this->connection = $this->getMockBuilder('\Magento\Framework\DB\Adapter\AdapterInterface')
->disableOriginalConstructor()
- ->setMethods(['select', 'getIfNullSql'])
+ ->setMethods(['select', 'getIfNullSql', 'quote'])
->getMockForAbstractClass();
$this->select = $this->getMockBuilder('\Magento\Framework\DB\Select')
->disableOriginalConstructor()
@@ -170,9 +170,25 @@ public function testProcessPrice()
$this->assertSame($expectedResult, $this->removeWhitespaces($actualResult));
}
- public function testProcessCategoryIds()
+ /**
+ * @return array
+ */
+ public function processCategoryIdsDataProvider()
+ {
+ return [
+ ['5', 'category_ids_index.category_id = 5'],
+ [3, 'category_ids_index.category_id = 3'],
+ ["' and 1 = 0", 'category_ids_index.category_id = 0'],
+ ];
+ }
+
+ /**
+ * @param string|int $categoryId
+ * @param string $expectedResult
+ * @dataProvider processCategoryIdsDataProvider
+ */
+ public function testProcessCategoryIds($categoryId, $expectedResult)
{
- $expectedResult = 'category_ids_index.category_id = FilterValue';
$isNegation = false;
$query = 'SELECT category_ids FROM catalog_product_entity';
@@ -182,7 +198,7 @@ public function testProcessCategoryIds()
$this->filter->expects($this->once())
->method('getValue')
- ->will($this->returnValue('FilterValue'));
+ ->will($this->returnValue($categoryId));
$this->config->expects($this->exactly(1))
->method('getAttribute')
@@ -249,6 +265,7 @@ public function testProcessTermFilter($frontendInput, $fieldValue, $isNegation,
->method('getValue')
->willReturn($fieldValue);
+ $this->connection->expects($this->atLeastOnce())->method('quote')->willReturnArgument(0);
$actualResult = $this->target->process($this->filter, $isNegation, 'This filter is not depends on used query');
$this->assertSame($expected, $this->removeWhitespaces($actualResult));
}
diff --git a/app/code/Magento/CatalogSearch/Test/Unit/Model/Indexer/FulltextTest.php b/app/code/Magento/CatalogSearch/Test/Unit/Model/Indexer/FulltextTest.php
index 1118c81f3fa87..962bc1f6d7c61 100644
--- a/app/code/Magento/CatalogSearch/Test/Unit/Model/Indexer/FulltextTest.php
+++ b/app/code/Magento/CatalogSearch/Test/Unit/Model/Indexer/FulltextTest.php
@@ -120,8 +120,10 @@ public function testExecute()
$indexData = new \ArrayObject([]);
$this->storeManager->expects($this->once())->method('getStores')->willReturn($stores);
$this->saveHandler->expects($this->exactly(count($stores)))->method('deleteIndex');
- $this->saveHandler->expects($this->exactly(count($stores)))->method('saveIndex');
- $this->fullAction->expects($this->exactly(count($stores)))->method('rebuildStoreIndex')->willReturn($indexData);
+ $this->saveHandler->expects($this->exactly(2))->method('saveIndex');
+ $this->fullAction->expects($this->exactly(2))
+ ->method('rebuildStoreIndex')
+ ->willReturn(new \ArrayObject([$indexData, $indexData]));
$this->model->execute($ids);
}
@@ -132,8 +134,10 @@ public function testExecuteFull()
$indexData = new \ArrayObject([]);
$this->storeManager->expects($this->once())->method('getStores')->willReturn($stores);
$this->saveHandler->expects($this->exactly(count($stores)))->method('cleanIndex');
- $this->saveHandler->expects($this->exactly(count($stores)))->method('saveIndex');
- $this->fullAction->expects($this->exactly(count($stores)))->method('rebuildStoreIndex')->willReturn($indexData);
+ $this->saveHandler->expects($this->exactly(2))->method('saveIndex');
+ $this->fullAction->expects($this->exactly(2))
+ ->method('rebuildStoreIndex')
+ ->willReturn(new \ArrayObject([$indexData, $indexData]));
$this->fulltextResource->expects($this->once())->method('resetSearchResults');
$this->searchRequestConfig->expects($this->once())->method('reset');
@@ -147,8 +151,10 @@ public function testExecuteList()
$indexData = new \ArrayObject([]);
$this->storeManager->expects($this->once())->method('getStores')->willReturn($stores);
$this->saveHandler->expects($this->exactly(count($stores)))->method('deleteIndex');
- $this->saveHandler->expects($this->exactly(count($stores)))->method('saveIndex');
- $this->fullAction->expects($this->exactly(count($stores)))->method('rebuildStoreIndex')->willReturn($indexData);
+ $this->saveHandler->expects($this->exactly(2))->method('saveIndex');
+ $this->fullAction->expects($this->exactly(2))
+ ->method('rebuildStoreIndex')
+ ->willReturn(new \ArrayObject([$indexData, $indexData]));
$this->model->executeList($ids);
}
@@ -160,8 +166,10 @@ public function testExecuteRow()
$indexData = new \ArrayObject([]);
$this->storeManager->expects($this->once())->method('getStores')->willReturn($stores);
$this->saveHandler->expects($this->exactly(count($stores)))->method('deleteIndex');
- $this->saveHandler->expects($this->exactly(count($stores)))->method('saveIndex');
- $this->fullAction->expects($this->exactly(count($stores)))->method('rebuildStoreIndex')->willReturn($indexData);
+ $this->saveHandler->expects($this->exactly(2))->method('saveIndex');
+ $this->fullAction->expects($this->exactly(2))
+ ->method('rebuildStoreIndex')
+ ->willReturn(new \ArrayObject([$indexData, $indexData]));
$this->model->executeRow($id);
}
diff --git a/app/code/Magento/CatalogSearch/composer.json b/app/code/Magento/CatalogSearch/composer.json
index c28e68838c7a9..dfe1c74a45a46 100644
--- a/app/code/Magento/CatalogSearch/composer.json
+++ b/app/code/Magento/CatalogSearch/composer.json
@@ -14,7 +14,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/CatalogUrlRewrite/Observer/AfterImportDataObserver.php b/app/code/Magento/CatalogUrlRewrite/Observer/AfterImportDataObserver.php
index c27de6088f416..bcabe87fc0dfd 100644
--- a/app/code/Magento/CatalogUrlRewrite/Observer/AfterImportDataObserver.php
+++ b/app/code/Magento/CatalogUrlRewrite/Observer/AfterImportDataObserver.php
@@ -66,9 +66,6 @@ class AfterImportDataObserver implements ObserverInterface
/** @var \Magento\Catalog\Model\ProductFactory $catalogProductFactory */
protected $catalogProductFactory;
- /** @var int */
- protected $urlKeyAttribute;
-
/** @var array */
protected $acceptableCategories;
@@ -78,9 +75,6 @@ class AfterImportDataObserver implements ObserverInterface
/** @var array */
protected $websitesToStoreIds;
- /** @var array */
- protected $entityStoresToCheckOverridden = [];
-
/** @var array */
protected $storesCache = [];
@@ -100,10 +94,8 @@ class AfterImportDataObserver implements ObserverInterface
/**
* @param \Magento\Catalog\Model\ProductFactory $catalogProductFactory
- * @param \Magento\Eav\Model\Config $eavConfig
* @param \Magento\CatalogUrlRewrite\Model\ObjectRegistryFactory $objectRegistryFactory
* @param \Magento\CatalogUrlRewrite\Model\ProductUrlPathGenerator $productUrlPathGenerator
- * @param \Magento\Framework\App\ResourceConnection $resource
* @param \Magento\CatalogUrlRewrite\Service\V1\StoreViewService $storeViewService
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param UrlPersistInterface $urlPersist
@@ -114,10 +106,8 @@ class AfterImportDataObserver implements ObserverInterface
*/
public function __construct(
\Magento\Catalog\Model\ProductFactory $catalogProductFactory,
- \Magento\Eav\Model\Config $eavConfig,
\Magento\CatalogUrlRewrite\Model\ObjectRegistryFactory $objectRegistryFactory,
\Magento\CatalogUrlRewrite\Model\ProductUrlPathGenerator $productUrlPathGenerator,
- \Magento\Framework\App\ResourceConnection $resource,
\Magento\CatalogUrlRewrite\Service\V1\StoreViewService $storeViewService,
\Magento\Store\Model\StoreManagerInterface $storeManager,
UrlPersistInterface $urlPersist,
@@ -131,16 +121,6 @@ public function __construct(
$this->storeViewService = $storeViewService;
$this->storeManager = $storeManager;
$this->urlRewriteFactory = $urlRewriteFactory;
- $attribute = $eavConfig->getAttribute(Product::ENTITY, self::URL_KEY_ATTRIBUTE_CODE);
- if (!$attribute) {
- throw new \InvalidArgumentException(sprintf(
- 'Cannot retrieve attribute for entity type "%s"',
- Product::ENTITY
- ));
- }
- $this->connection = $resource->getConnection();
- $this->urlKeyAttributeId = $attribute->getId();
- $this->urlKeyAttributeBackendTable = $attribute->getBackendTable();
$this->urlFinder = $urlFinder;
}
@@ -180,6 +160,10 @@ protected function _populateForUrlGeneration($rowData)
if (empty($newSku) || !isset($newSku['entity_id'])) {
return null;
}
+ if ($this->import->getRowScope($rowData) == ImportProduct::SCOPE_STORE
+ && empty($rowData[self::URL_KEY_ATTRIBUTE_CODE])) {
+ return null;
+ }
$rowData['entity_id'] = $newSku['entity_id'];
$product = $this->catalogProductFactory->create();
@@ -254,8 +238,6 @@ protected function populateGlobalProduct($product)
$this->storesCache[$storeId] = true;
if (!$this->isGlobalScope($storeId)) {
$this->addProductToImport($product, $storeId);
- $this->entityStoresToCheckOverridden[] = $this->connection->quoteInto('(store_id = ?', $storeId)
- . $this->connection->quoteInto(' AND entity_id = ?)', $product->getId());
}
}
}
@@ -269,8 +251,6 @@ protected function populateGlobalProduct($product)
*/
protected function generateUrls()
{
- $this->cleanOverriddenUrlKey();
-
/**
* @var $urls \Magento\UrlRewrite\Service\V1\Data\UrlRewrite[]
*/
@@ -291,25 +271,6 @@ protected function generateUrls()
return $result;
}
- /**
- * @return $this
- */
- protected function cleanOverriddenUrlKey()
- {
- if (empty($this->entityStoresToCheckOverridden)) {
- return $this;
- }
- $select = $this->connection->select()
- ->from($this->urlKeyAttributeBackendTable, ['store_id', 'entity_id'])
- ->where('attribute_id = ?', $this->urlKeyAttributeId)
- ->where(implode(' OR ', $this->entityStoresToCheckOverridden));
- $entityStoresToClean = $this->connection->fetchAll($select);
- foreach ($entityStoresToClean as $entityStore) {
- unset($this->products[$entityStore['entity_id']][$entityStore['store_id']]);
- }
- return $this;
- }
-
/**
* Check is global scope
*
diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Observer/AfterImportDataObserverTest.php b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Observer/AfterImportDataObserverTest.php
index fc6636a16bd3f..1a38a0683cb45 100644
--- a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Observer/AfterImportDataObserverTest.php
+++ b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Observer/AfterImportDataObserverTest.php
@@ -70,11 +70,6 @@ class AfterImportDataObserverTest extends \PHPUnit_Framework_TestCase
*/
protected $storeManager;
- /**
- * @var \Magento\Framework\DB\Adapter\AdapterInterface|\PHPUnit_Framework_MockObject_MockObject
- */
- protected $connection;
-
/**
* @var \Magento\CatalogUrlRewrite\Model\ObjectRegistryFactory|\PHPUnit_Framework_MockObject_MockObject
*/
@@ -90,21 +85,6 @@ class AfterImportDataObserverTest extends \PHPUnit_Framework_TestCase
*/
protected $storeViewService;
- /**
- * @var \Magento\Eav\Model\Config|\PHPUnit_Framework_MockObject_MockObject
- */
- protected $eavConfig;
-
- /**
- * @var \Magento\Framework\App\ResourceConnection|\PHPUnit_Framework_MockObject_MockObject
- */
- protected $resource;
-
- /**
- * @var \Magento\Framework\DB\Select|\PHPUnit_Framework_MockObject_MockObject
- */
- protected $select;
-
/**
* @var \Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory|\PHPUnit_Framework_MockObject_MockObject
*/
@@ -214,66 +194,6 @@ public function setUp()
->disableOriginalConstructor()
->getMock();
- $this->eavConfig = $this->getMock(
- '\Magento\Eav\Model\Config',
- [
- 'getAttribute',
- ],
- [],
- '',
- false
- );
- $attribute = $this->getMockBuilder('\Magento\Eav\Model\Entity\Attribute\AbstractAttribute')
- ->setMethods([
- 'getBackendTable',
- ])
- ->disableOriginalConstructor()
- ->getMockForAbstractClass();
- $beTable = 'backend table';
- $attribute->expects($this->any())
- ->method('getBackendTable')
- ->willReturn($beTable);
- $this->eavConfig->expects($this->any())
- ->method('getAttribute')
- ->with(
- \Magento\Catalog\Model\Product::ENTITY,
- \Magento\CatalogUrlRewrite\Observer\AfterImportDataObserver::URL_KEY_ATTRIBUTE_CODE
- )
- ->willReturn($attribute);
-
- $this->resource = $this->getMock(
- '\Magento\Framework\App\ResourceConnection',
- [],
- [],
- '',
- false
- );
- $this->connection = $this->getMockBuilder('\Magento\Framework\DB\Adapter\AdapterInterface')
- ->disableOriginalConstructor()
- ->setMethods([
- 'quoteInto',
- 'select',
- 'fetchAll',
- ])
- ->getMockForAbstractClass();
- $this->resource
- ->expects($this->any())
- ->method('getConnection')
- ->willReturn($this->connection);
- $this->select = $this->getMock(
- '\Magento\Framework\DB\Select',
- [
- 'from',
- 'where',
- ],
- [],
- '',
- false
- );
- $this->connection
- ->expects($this->any())
- ->method('select')
- ->willReturn($this->select);
$this->objectRegistryFactory = $this->getMock(
'\Magento\CatalogUrlRewrite\Model\ObjectRegistryFactory',
[],
@@ -364,10 +284,8 @@ public function setUp()
'\Magento\CatalogUrlRewrite\Observer\AfterImportDataObserver',
[
'catalogProductFactory' => $this->catalogProductFactory,
- 'eavConfig' => $this->eavConfig,
'objectRegistryFactory' => $this->objectRegistryFactory,
'productUrlPathGenerator' => $this->productUrlPathGenerator,
- 'resource' => $this->resource,
'storeViewService' => $this->storeViewService,
'storeManager'=> $this->storeManager,
'urlPersist' => $this->urlPersist,
@@ -471,7 +389,6 @@ public function testAfterImportData()
$newSku[0]['entity_id'],
$newSku[0]['entity_id'],
$newSku[0]['entity_id'],
- $newSku[0]['entity_id'],
$newSku[1]['entity_id'],
$newSku[1]['entity_id'],
$newSku[1]['entity_id']
@@ -501,33 +418,6 @@ public function testAfterImportData()
->expects($this->exactly($productsCount))
->method('create')
->willReturn($product);
- $this->connection
- ->expects($this->exactly(4))
- ->method('quoteInto')
- ->withConsecutive(
- [
- '(store_id = ?',
- $storeIds[0],
- ],
- [
- ' AND entity_id = ?)',
- $newSku[0]['entity_id'],
- ],
- [
- '(store_id = ?',
- $storeIds[0],
- ],
- [
- ' AND entity_id = ?)',
- $newSku[1]['entity_id'],
- ]
- );
- $this->connection
- ->expects($this->once())
- ->method('fetchAll')
- ->willReturn([]);
- $this->select->expects($this->any())->method('from')->willReturnSelf();
- $this->select->expects($this->any())->method('where')->willReturnSelf();
$this->urlFinder->expects($this->any())->method('findAllByData')->willReturn([]);
@@ -562,78 +452,6 @@ public function testAfterImportData()
$this->import->execute($this->observer);
}
- /**
- * Cover cleanOverriddenUrlKey().
- */
- public function testCleanOverriddenUrlKey()
- {
- $urlKeyAttributeBackendTable = 'table value';
- $urlKeyAttributeId = 'id value';
- $entityStoresToCheckOverridden = [1,2,3];
- $this->import->urlKeyAttributeBackendTable = $urlKeyAttributeBackendTable;
- $this->import->urlKeyAttributeId = $urlKeyAttributeId;
- $this->setPropertyValue($this->import, 'entityStoresToCheckOverridden', $entityStoresToCheckOverridden);
- $this->select
- ->expects($this->once())
- ->method('from')
- ->with(
- $urlKeyAttributeBackendTable,
- ['store_id', 'entity_id']
- )
- ->will($this->returnSelf());
- $this->select
- ->expects($this->exactly(2))
- ->method('where')
- ->withConsecutive(
- [
- 'attribute_id = ?',
- $urlKeyAttributeId,
- ],
- [
- implode(' OR ', $entityStoresToCheckOverridden)
- ]
- )
- ->will($this->returnSelf());
-
- $entityIdVal = 'entity id value';
- $storeIdVal = 'store id value';
- $entityStore = [
- 'entity_id' => $entityIdVal,
- 'store_id' => $storeIdVal,
- ];
- $entityStoresToClean = [$entityStore];
- $products = [
- $entityIdVal => [
- $storeIdVal => 'value',
- ]
- ];
- $this->setPropertyValue($this->import, 'products', $products);
- $this->connection
- ->expects($this->once())
- ->method('fetchAll')
- ->willReturn($entityStoresToClean);
-
- $actualResult = $this->invokeMethod($this->import, 'cleanOverriddenUrlKey');
- $this->assertEquals($this->import, $actualResult);
- }
-
- /**
- * Cover cleanOverriddenUrlKey() method with empty entityStoresToCheckOverridden property.
- */
- public function testCleanOverriddenUrlKeyEmptyEntityStoresToCheckOverridden()
- {
- $this->setPropertyValue($this->import, 'entityStoresToCheckOverridden', null);
- $this->select
- ->expects($this->never())
- ->method('from');
- $this->select
- ->expects($this->never())
- ->method('where');
-
- $actualResult = $this->invokeMethod($this->import, 'cleanOverriddenUrlKey');
- $this->assertEquals($this->import, $actualResult);
- }
-
/**
* Cover canonicalUrlRewriteGenerate().
*/
@@ -848,30 +666,6 @@ protected function invokeMethod($object, $methodName, array $parameters = [])
return $method->invokeArgs($object, $parameters);
}
- /**
- * Get mock of Import class instance with defined methods and called constructor.
- */
- protected function getImportMock($methods = [])
- {
- return $this->getMock(
- '\Magento\CatalogUrlRewrite\Observer\AfterImportDataObserver',
- $methods,
- [
- $this->catalogProductFactory,
- $this->eavConfig,
- $this->objectRegistryFactory,
- $this->productUrlPathGenerator,
- $this->resource,
- $this->storeViewService,
- $this->storeManager,
- $this->urlPersist,
- $this->urlRewriteFactory,
- $this->urlFinder,
- ],
- ''
- );
- }
-
/**
* @param mixed $storeId
* @param mixed $productId
diff --git a/app/code/Magento/CatalogUrlRewrite/composer.json b/app/code/Magento/CatalogUrlRewrite/composer.json
index be02437212b99..338b9dc20ac21 100644
--- a/app/code/Magento/CatalogUrlRewrite/composer.json
+++ b/app/code/Magento/CatalogUrlRewrite/composer.json
@@ -13,7 +13,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/di.xml b/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/di.xml
index bfe126bbae028..ddc0ec22cd390 100644
--- a/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/di.xml
+++ b/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/di.xml
@@ -16,9 +16,6 @@
-
-
-
diff --git a/app/code/Magento/CatalogUrlRewrite/etc/di.xml b/app/code/Magento/CatalogUrlRewrite/etc/di.xml
index eab00485dd403..8a8da1c5fb24d 100644
--- a/app/code/Magento/CatalogUrlRewrite/etc/di.xml
+++ b/app/code/Magento/CatalogUrlRewrite/etc/di.xml
@@ -20,4 +20,7 @@
+
+
+
diff --git a/app/code/Magento/CatalogWidget/composer.json b/app/code/Magento/CatalogWidget/composer.json
index 70ac4a7591a73..cab32888df99f 100644
--- a/app/code/Magento/CatalogWidget/composer.json
+++ b/app/code/Magento/CatalogWidget/composer.json
@@ -14,7 +14,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Checkout/Controller/Cart/Delete.php b/app/code/Magento/Checkout/Controller/Cart/Delete.php
index 3d73a5f0c205a..fae9903a845e1 100644
--- a/app/code/Magento/Checkout/Controller/Cart/Delete.php
+++ b/app/code/Magento/Checkout/Controller/Cart/Delete.php
@@ -15,6 +15,10 @@ class Delete extends \Magento\Checkout\Controller\Cart
*/
public function execute()
{
+ if (!$this->_formKeyValidator->validate($this->getRequest())) {
+ return $this->resultRedirectFactory->create()->setPath('*/*/');
+ }
+
$id = (int)$this->getRequest()->getParam('id');
if ($id) {
try {
diff --git a/app/code/Magento/Checkout/composer.json b/app/code/Magento/Checkout/composer.json
index eee7683d44b25..b3dae990fbe0e 100644
--- a/app/code/Magento/Checkout/composer.json
+++ b/app/code/Magento/Checkout/composer.json
@@ -27,7 +27,7 @@
"magento/module-cookie": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping-address/address-renderer/default.js b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping-address/address-renderer/default.js
index 0b932a29e52d9..3d7191fdfea30 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping-address/address-renderer/default.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping-address/address-renderer/default.js
@@ -15,6 +15,7 @@ define([
], function($, ko, Component, selectShippingAddressAction, quote, formPopUpState, checkoutData, customerData) {
'use strict';
var countryData = customerData.get('directory-data');
+
return Component.extend({
defaults: {
template: 'Magento_Checkout/shipping-address/address-renderer/default'
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping-information/address-renderer/default.js b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping-information/address-renderer/default.js
index 59c4911fc992c..f36192388370a 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping-information/address-renderer/default.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping-information/address-renderer/default.js
@@ -9,6 +9,7 @@ define([
], function(Component, customerData) {
'use strict';
var countryData = customerData.get('directory-data');
+
return Component.extend({
defaults: {
template: 'Magento_Checkout/shipping-information/address-renderer/default'
diff --git a/app/code/Magento/Checkout/view/frontend/web/template/billing-address.html b/app/code/Magento/Checkout/view/frontend/web/template/billing-address.html
index 3c87e88b6ad65..9efc76a8ee05a 100644
--- a/app/code/Magento/Checkout/view/frontend/web/template/billing-address.html
+++ b/app/code/Magento/Checkout/view/frontend/web/template/billing-address.html
@@ -6,7 +6,7 @@
-->
-
+
diff --git a/app/code/Magento/CheckoutAgreements/composer.json b/app/code/Magento/CheckoutAgreements/composer.json
index 7eb11ecd779c6..8b0bc9b4ccda8 100644
--- a/app/code/Magento/CheckoutAgreements/composer.json
+++ b/app/code/Magento/CheckoutAgreements/composer.json
@@ -10,7 +10,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Cms/composer.json b/app/code/Magento/Cms/composer.json
index 950a88034bedf..c6c9e9ebc9ced 100644
--- a/app/code/Magento/Cms/composer.json
+++ b/app/code/Magento/Cms/composer.json
@@ -18,7 +18,7 @@
"magento/module-cms-sample-data": "Sample Data version:100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/CmsUrlRewrite/composer.json b/app/code/Magento/CmsUrlRewrite/composer.json
index 13e72d6a08da0..c2600d7e90bcf 100644
--- a/app/code/Magento/CmsUrlRewrite/composer.json
+++ b/app/code/Magento/CmsUrlRewrite/composer.json
@@ -9,7 +9,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Config/Model/Config/Backend/Image/Adapter.php b/app/code/Magento/Config/Model/Config/Backend/Image/Adapter.php
index 23e65a6e1d11c..be7c4739b53f2 100644
--- a/app/code/Magento/Config/Model/Config/Backend/Image/Adapter.php
+++ b/app/code/Magento/Config/Model/Config/Backend/Image/Adapter.php
@@ -53,7 +53,7 @@ public function beforeSave()
try {
$this->_imageFactory->create($this->getValue());
} catch (\Exception $e) {
- $message = __('The specified image adapter cannot be used because of: ' . $e->getMessage());
+ $message = __('The specified image adapter cannot be used because of: %1', $e->getMessage());
throw new \Magento\Framework\Exception\LocalizedException($message);
}
diff --git a/app/code/Magento/Config/Model/Config/Compiler/IncludeElement.php b/app/code/Magento/Config/Model/Config/Compiler/IncludeElement.php
index 941cdc8529a1b..977cd035a1c04 100644
--- a/app/code/Magento/Config/Model/Config/Compiler/IncludeElement.php
+++ b/app/code/Magento/Config/Model/Config/Compiler/IncludeElement.php
@@ -112,6 +112,6 @@ protected function getContent($includePath)
return $directoryRead->readFile($path);
}
- throw new LocalizedException(__('The file "' . $path . '" does not exist'));
+ throw new LocalizedException(__('The file "%1" does not exist', $path));
}
}
diff --git a/app/code/Magento/Config/Model/Config/Structure/Element/Group/Proxy.php b/app/code/Magento/Config/Model/Config/Structure/Element/Group/Proxy.php
index 1b3aeca06effc..7365fade4caa3 100644
--- a/app/code/Magento/Config/Model/Config/Structure/Element/Group/Proxy.php
+++ b/app/code/Magento/Config/Model/Config/Structure/Element/Group/Proxy.php
@@ -5,7 +5,8 @@
*/
namespace Magento\Config\Model\Config\Structure\Element\Group;
-class Proxy extends \Magento\Config\Model\Config\Structure\Element\Group
+class Proxy extends \Magento\Config\Model\Config\Structure\Element\Group implements
+ \Magento\Framework\ObjectManager\NoninterceptableInterface
{
/**
* Object manager
diff --git a/app/code/Magento/Config/Model/Config/Structure/Search/Proxy.php b/app/code/Magento/Config/Model/Config/Structure/Search/Proxy.php
index eb01cd8615d20..9907fbec18576 100644
--- a/app/code/Magento/Config/Model/Config/Structure/Search/Proxy.php
+++ b/app/code/Magento/Config/Model/Config/Structure/Search/Proxy.php
@@ -5,7 +5,9 @@
*/
namespace Magento\Config\Model\Config\Structure\Search;
-class Proxy implements \Magento\Config\Model\Config\Structure\SearchInterface
+class Proxy implements
+ \Magento\Config\Model\Config\Structure\SearchInterface,
+ \Magento\Framework\ObjectManager\NoninterceptableInterface
{
/**
* Object manager
diff --git a/app/code/Magento/Config/composer.json b/app/code/Magento/Config/composer.json
index 569d71071ac79..f5eed95e6a05b 100644
--- a/app/code/Magento/Config/composer.json
+++ b/app/code/Magento/Config/composer.json
@@ -12,7 +12,7 @@
"magento/module-media-storage": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/ConfigurableImportExport/composer.json b/app/code/Magento/ConfigurableImportExport/composer.json
index 74d4cb573d0d8..e3fe912c98be6 100644
--- a/app/code/Magento/ConfigurableImportExport/composer.json
+++ b/app/code/Magento/ConfigurableImportExport/composer.json
@@ -11,7 +11,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Price.php b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Price.php
index 4fd0c2c81acf7..2d272f27e25e6 100644
--- a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Price.php
+++ b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Price.php
@@ -22,16 +22,16 @@ public function getFinalPrice($qty, $product)
return $product->getCalculatedFinalPrice();
}
if ($product->getCustomOption('simple_product') && $product->getCustomOption('simple_product')->getProduct()) {
- return parent::getFinalPrice($qty, $product->getCustomOption('simple_product')->getProduct());
+ $finalPrice = parent::getFinalPrice($qty, $product->getCustomOption('simple_product')->getProduct());
} else {
$priceInfo = $product->getPriceInfo();
$finalPrice = $priceInfo->getPrice('final_price')->getAmount()->getValue();
- $finalPrice = $this->_applyOptionsPrice($product, $qty, $finalPrice);
- $finalPrice = max(0, $finalPrice);
- $product->setFinalPrice($finalPrice);
-
- return $finalPrice;
}
+ $finalPrice = $this->_applyOptionsPrice($product, $qty, $finalPrice);
+ $finalPrice = max(0, $finalPrice);
+ $product->setFinalPrice($finalPrice);
+
+ return $finalPrice;
}
/**
diff --git a/app/code/Magento/ConfigurableProduct/Pricing/Price/FinalPriceResolver.php b/app/code/Magento/ConfigurableProduct/Pricing/Price/FinalPriceResolver.php
index cc3f33a5f302c..e837fac0f1cf9 100644
--- a/app/code/Magento/ConfigurableProduct/Pricing/Price/FinalPriceResolver.php
+++ b/app/code/Magento/ConfigurableProduct/Pricing/Price/FinalPriceResolver.php
@@ -16,7 +16,6 @@ class FinalPriceResolver implements PriceResolverInterface
*/
public function resolvePrice(\Magento\Framework\Pricing\SaleableInterface $product)
{
- return $product->getPriceInfo()->getPrice(CatalogFinalPrice::PRICE_CODE)
- ->getAmount()->getBaseAmount();
+ return $product->getPriceInfo()->getPrice(CatalogFinalPrice::PRICE_CODE)->getValue();
}
}
diff --git a/app/code/Magento/ConfigurableProduct/composer.json b/app/code/Magento/ConfigurableProduct/composer.json
index cdd088fe64638..a9975ed092897 100644
--- a/app/code/Magento/ConfigurableProduct/composer.json
+++ b/app/code/Magento/ConfigurableProduct/composer.json
@@ -23,7 +23,7 @@
"magento/module-product-links-sample-data": "Sample Data version:100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Contact/composer.json b/app/code/Magento/Contact/composer.json
index c80a8845f3765..f0f4227aeaf67 100644
--- a/app/code/Magento/Contact/composer.json
+++ b/app/code/Magento/Contact/composer.json
@@ -11,7 +11,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Cookie/Model/Config/Backend/Domain.php b/app/code/Magento/Cookie/Model/Config/Backend/Domain.php
index 2f84b6d2fd067..1aeefdf6f7310 100644
--- a/app/code/Magento/Cookie/Model/Config/Backend/Domain.php
+++ b/app/code/Magento/Cookie/Model/Config/Backend/Domain.php
@@ -50,7 +50,7 @@ public function beforeSave()
// Empty value is treated valid and will be handled when read the value out
if (!empty($value) && !$this->configValidator->isValid($value)) {
- $msg = __('Invalid domain name: ' . join('; ', $this->configValidator->getMessages()));
+ $msg = __('Invalid domain name: %1', join('; ', $this->configValidator->getMessages()));
throw new \Magento\Framework\Exception\LocalizedException($msg);
}
}
diff --git a/app/code/Magento/Cookie/Model/Config/Backend/Lifetime.php b/app/code/Magento/Cookie/Model/Config/Backend/Lifetime.php
index 9d650159e4501..c7f418f92152e 100644
--- a/app/code/Magento/Cookie/Model/Config/Backend/Lifetime.php
+++ b/app/code/Magento/Cookie/Model/Config/Backend/Lifetime.php
@@ -49,7 +49,7 @@ public function beforeSave()
$value = $this->getValue();
if (!empty($value) && !$this->configValidator->isValid($value)) {
- $msg = __('Invalid cookie lifetime: ' . join('; ', $this->configValidator->getMessages()));
+ $msg = __('Invalid cookie lifetime: %1', join('; ', $this->configValidator->getMessages()));
throw new \Magento\Framework\Exception\LocalizedException($msg);
}
return parent::beforeSave();
diff --git a/app/code/Magento/Cookie/composer.json b/app/code/Magento/Cookie/composer.json
index 74110926a5f7c..c4f8c34be17c0 100644
--- a/app/code/Magento/Cookie/composer.json
+++ b/app/code/Magento/Cookie/composer.json
@@ -10,7 +10,7 @@
"magento/module-backend": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Cron/composer.json b/app/code/Magento/Cron/composer.json
index 61b341a1ac8b2..39cceeffc6f87 100644
--- a/app/code/Magento/Cron/composer.json
+++ b/app/code/Magento/Cron/composer.json
@@ -10,7 +10,7 @@
"magento/module-config": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Cron/etc/di.xml b/app/code/Magento/Cron/etc/di.xml
index ae600be3c5c8a..0b78824ef4807 100644
--- a/app/code/Magento/Cron/etc/di.xml
+++ b/app/code/Magento/Cron/etc/di.xml
@@ -36,4 +36,11 @@
+
+
+
+
+
+
+
diff --git a/app/code/Magento/CurrencySymbol/composer.json b/app/code/Magento/CurrencySymbol/composer.json
index de5dcde6c97ce..e0b2d495607e2 100644
--- a/app/code/Magento/CurrencySymbol/composer.json
+++ b/app/code/Magento/CurrencySymbol/composer.json
@@ -11,7 +11,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Customer/Setup/UpgradeData.php b/app/code/Magento/Customer/Setup/UpgradeData.php
index 1f4da520fd0b2..d19765b99a43b 100644
--- a/app/code/Magento/Customer/Setup/UpgradeData.php
+++ b/app/code/Magento/Customer/Setup/UpgradeData.php
@@ -60,6 +60,52 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
/** @var CustomerSetup $customerSetup */
$customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
+ if (version_compare($context->getVersion(), '2.0.6', '<')) {
+ $customerSetup->updateEntityType(
+ \Magento\Customer\Model\Customer::ENTITY,
+ 'entity_model',
+ 'Magento\Customer\Model\ResourceModel\Customer'
+ );
+ $customerSetup->updateEntityType(
+ \Magento\Customer\Model\Customer::ENTITY,
+ 'increment_model',
+ 'Magento\Eav\Model\Entity\Increment\NumericValue'
+ );
+ $customerSetup->updateEntityType(
+ \Magento\Customer\Model\Customer::ENTITY,
+ 'entity_attribute_collection',
+ 'Magento\Customer\Model\ResourceModel\Attribute\Collection'
+ );
+ $customerSetup->updateEntityType(
+ 'customer_address',
+ 'entity_model',
+ 'Magento\Customer\Model\ResourceModel\Address'
+ );
+ $customerSetup->updateEntityType(
+ 'customer_address',
+ 'entity_attribute_collection',
+ 'Magento\Customer\Model\ResourceModel\Address\Attribute\Collection'
+ );
+ $customerSetup->updateAttribute(
+ 'customer_address',
+ 'country_id',
+ 'source_model',
+ 'Magento\Customer\Model\ResourceModel\Address\Attribute\Source\Country'
+ );
+ $customerSetup->updateAttribute(
+ 'customer_address',
+ 'region',
+ 'backend_model',
+ 'Magento\Customer\Model\ResourceModel\Address\Attribute\Backend\Region'
+ );
+ $customerSetup->updateAttribute(
+ 'customer_address',
+ 'region_id',
+ 'source_model',
+ 'Magento\Customer\Model\ResourceModel\Address\Attribute\Source\Region'
+ );
+ }
+
if (version_compare($context->getVersion(), '2.0.1', '<')) {
$entityAttributes = [
'customer' => [
@@ -240,51 +286,6 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
];
$this->upgradeAttributes($entityAttributes, $customerSetup);
}
- if (version_compare($context->getVersion(), '2.0.6', '<')) {
- $customerSetup->updateEntityType(
- \Magento\Customer\Model\Customer::ENTITY,
- 'entity_model',
- 'Magento\Customer\Model\ResourceModel\Customer'
- );
- $customerSetup->updateEntityType(
- \Magento\Customer\Model\Customer::ENTITY,
- 'increment_model',
- 'Magento\Eav\Model\Entity\Increment\NumericValue'
- );
- $customerSetup->updateEntityType(
- \Magento\Customer\Model\Customer::ENTITY,
- 'entity_attribute_collection',
- 'Magento\Customer\Model\ResourceModel\Attribute\Collection'
- );
- $customerSetup->updateEntityType(
- 'customer_address',
- 'entity_model',
- 'Magento\Customer\Model\ResourceModel\Address'
- );
- $customerSetup->updateEntityType(
- 'customer_address',
- 'entity_attribute_collection',
- 'Magento\Customer\Model\ResourceModel\Address\Attribute\Collection'
- );
- $customerSetup->updateAttribute(
- 'customer_address',
- 'country_id',
- 'source_model',
- 'Magento\Customer\Model\ResourceModel\Address\Attribute\Source\Country'
- );
- $customerSetup->updateAttribute(
- 'customer_address',
- 'region',
- 'backend_model',
- 'Magento\Customer\Model\ResourceModel\Address\Attribute\Backend\Region'
- );
- $customerSetup->updateAttribute(
- 'customer_address',
- 'region_id',
- 'source_model',
- 'Magento\Customer\Model\ResourceModel\Address\Attribute\Source\Region'
- );
- }
if (version_compare($context->getVersion(), '2.0.6', '<')) {
$setup->getConnection()->delete(
@@ -332,6 +333,9 @@ private function upgradeHash($setup)
$customers = $setup->getConnection()->fetchAll($select);
foreach ($customers as $customer) {
+ if ($customer['password_hash'] === null) {
+ continue;
+ }
list($hash, $salt) = explode(Encryptor::DELIMITER, $customer['password_hash']);
$newHash = $customer['password_hash'];
diff --git a/app/code/Magento/Customer/composer.json b/app/code/Magento/Customer/composer.json
index adbb13a450b7f..c82f3f43d4f0c 100644
--- a/app/code/Magento/Customer/composer.json
+++ b/app/code/Magento/Customer/composer.json
@@ -29,7 +29,7 @@
"magento/module-customer-sample-data": "Sample Data version:100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Customer/view/frontend/web/js/customer-data.js b/app/code/Magento/Customer/view/frontend/web/js/customer-data.js
index bfec0bf920246..cf6788e82d9a5 100644
--- a/app/code/Magento/Customer/view/frontend/web/js/customer-data.js
+++ b/app/code/Magento/Customer/view/frontend/web/js/customer-data.js
@@ -104,8 +104,13 @@ define([
var customerData = {
init: function() {
+ var countryData,
+ privateContent = $.cookieStorage.get('private_content_version');
+
if (_.isEmpty(storage.keys())) {
- this.reload([], false);
+ if (!_.isEmpty(privateContent)) {
+ this.reload([], false);
+ }
} else if (this.needReload()) {
_.each(dataProvider.getFromStorage(storage.keys()), function (sectionData, sectionName) {
buffer.notify(sectionName, sectionData);
@@ -119,6 +124,13 @@ define([
this.reload(storageInvalidation.keys(), false);
}
}
+
+ if (!_.isEmpty(privateContent)) {
+ countryData = this.get('directory-data');
+ if (_.isEmpty(countryData())) {
+ countryData(customerData.reload(['directory-data'], false));
+ }
+ }
},
needReload: function () {
var cookieSections = $.cookieStorage.get('section_data_ids');
diff --git a/app/code/Magento/CustomerImportExport/composer.json b/app/code/Magento/CustomerImportExport/composer.json
index 88c1f9acc7cb8..3ee6753324e8e 100644
--- a/app/code/Magento/CustomerImportExport/composer.json
+++ b/app/code/Magento/CustomerImportExport/composer.json
@@ -12,7 +12,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Deploy/composer.json b/app/code/Magento/Deploy/composer.json
index 656bcd4af13aa..a9914128365c4 100644
--- a/app/code/Magento/Deploy/composer.json
+++ b/app/code/Magento/Deploy/composer.json
@@ -9,7 +9,7 @@
"magento/module-require-js": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Developer/composer.json b/app/code/Magento/Developer/composer.json
index dfa876a1b0928..00b266743c51a 100644
--- a/app/code/Magento/Developer/composer.json
+++ b/app/code/Magento/Developer/composer.json
@@ -7,7 +7,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Dhl/composer.json b/app/code/Magento/Dhl/composer.json
index 21eaffacfd19c..8bde6ce681a60 100644
--- a/app/code/Magento/Dhl/composer.json
+++ b/app/code/Magento/Dhl/composer.json
@@ -19,7 +19,7 @@
"magento/module-checkout": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Directory/composer.json b/app/code/Magento/Directory/composer.json
index cdbae91d3da9f..037cceee655fd 100644
--- a/app/code/Magento/Directory/composer.json
+++ b/app/code/Magento/Directory/composer.json
@@ -10,7 +10,7 @@
"lib-libxml": "*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Downloadable/composer.json b/app/code/Magento/Downloadable/composer.json
index 14fbef9f036c4..d7a4b8ebbd3cd 100644
--- a/app/code/Magento/Downloadable/composer.json
+++ b/app/code/Magento/Downloadable/composer.json
@@ -24,7 +24,7 @@
"magento/module-downloadable-sample-data": "Sample Data version:100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/DownloadableImportExport/composer.json b/app/code/Magento/DownloadableImportExport/composer.json
index 31f1bcac13e66..b666ba3b1af15 100644
--- a/app/code/Magento/DownloadableImportExport/composer.json
+++ b/app/code/Magento/DownloadableImportExport/composer.json
@@ -12,7 +12,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php
index b77183b6c05f3..d09156a107ebb 100644
--- a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php
+++ b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php
@@ -497,7 +497,7 @@ public function getBackend()
}
$backend = $this->_universalFactory->create($this->getBackendModel());
if (!$backend) {
- throw new LocalizedException(__('Invalid backend model specified: ' . $this->getBackendModel()));
+ throw new LocalizedException(__('Invalid backend model specified: %1', $this->getBackendModel()));
}
$this->_backend = $backend->setAttribute($this);
}
diff --git a/app/code/Magento/Eav/composer.json b/app/code/Magento/Eav/composer.json
index 17a2f9dd74b3d..4283d529e8a32 100644
--- a/app/code/Magento/Eav/composer.json
+++ b/app/code/Magento/Eav/composer.json
@@ -11,7 +11,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Eav/i18n/en_US.csv b/app/code/Magento/Eav/i18n/en_US.csv
index 37bc177bd3572..df3f5cced4c3a 100644
--- a/app/code/Magento/Eav/i18n/en_US.csv
+++ b/app/code/Magento/Eav/i18n/en_US.csv
@@ -71,7 +71,7 @@ Letters,Letters
"Invalid default decimal value","Invalid default decimal value"
"Invalid default date","Invalid default date"
"Invalid entity supplied","Invalid entity supplied"
-"Invalid backend model specified: ","Invalid backend model specified: "
+"Invalid backend model specified: %1","Invalid backend model specified: %1"
"Source model ""%1"" not found for attribute ""%2""","Source model ""%1"" not found for attribute ""%2"""
"The value of attribute ""%1"" must be unique","The value of attribute ""%1"" must be unique"
"Invalid date","Invalid date"
diff --git a/app/code/Magento/Email/Model/Template/Filter.php b/app/code/Magento/Email/Model/Template/Filter.php
index 645c2d7aff607..7d285c36ee96d 100644
--- a/app/code/Magento/Email/Model/Template/Filter.php
+++ b/app/code/Magento/Email/Model/Template/Filter.php
@@ -920,7 +920,7 @@ public function applyInlineCss($html)
!== false
) {
throw new \Magento\Framework\Exception\MailException(
- __('
' . PHP_EOL . $cssToInline . PHP_EOL . '
')
+ __('
%1
', PHP_EOL . $cssToInline . PHP_EOL)
);
}
diff --git a/app/code/Magento/Email/composer.json b/app/code/Magento/Email/composer.json
index e3b8c137134fd..d9466ebde66b9 100644
--- a/app/code/Magento/Email/composer.json
+++ b/app/code/Magento/Email/composer.json
@@ -11,7 +11,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/EncryptionKey/composer.json b/app/code/Magento/EncryptionKey/composer.json
index 3ce192fc450d0..569d3163393ee 100644
--- a/app/code/Magento/EncryptionKey/composer.json
+++ b/app/code/Magento/EncryptionKey/composer.json
@@ -8,7 +8,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"proprietary"
],
diff --git a/app/code/Magento/Fedex/composer.json b/app/code/Magento/Fedex/composer.json
index 2cbb0b9b3fe8d..ee8989f006093 100644
--- a/app/code/Magento/Fedex/composer.json
+++ b/app/code/Magento/Fedex/composer.json
@@ -15,7 +15,7 @@
"lib-libxml": "*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/GiftMessage/composer.json b/app/code/Magento/GiftMessage/composer.json
index e5aba3efa8e0a..f67b630b470a2 100644
--- a/app/code/Magento/GiftMessage/composer.json
+++ b/app/code/Magento/GiftMessage/composer.json
@@ -17,7 +17,7 @@
"magento/module-multishipping": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/GoogleAdwords/composer.json b/app/code/Magento/GoogleAdwords/composer.json
index 620026648c051..084047dc55cbf 100644
--- a/app/code/Magento/GoogleAdwords/composer.json
+++ b/app/code/Magento/GoogleAdwords/composer.json
@@ -8,7 +8,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/GoogleAnalytics/composer.json b/app/code/Magento/GoogleAnalytics/composer.json
index 6cecb9a6a7bfb..5d22c9b261eb8 100644
--- a/app/code/Magento/GoogleAnalytics/composer.json
+++ b/app/code/Magento/GoogleAnalytics/composer.json
@@ -9,7 +9,7 @@
"magento/module-cookie": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/GoogleOptimizer/Observer/Block/Category/AddGoogleExperimentFieldsObserver.php b/app/code/Magento/GoogleOptimizer/Observer/Block/Category/AddGoogleExperimentFieldsObserver.php
new file mode 100644
index 0000000000000..fe6fc525e044f
--- /dev/null
+++ b/app/code/Magento/GoogleOptimizer/Observer/Block/Category/AddGoogleExperimentFieldsObserver.php
@@ -0,0 +1,72 @@
+dataHelper = $dataHelper;
+ }
+
+ /**
+ * Adds Google Experiment fields to category creation form on product edit page
+ *
+ * @param EventObserver $observer
+ * @return void
+ */
+ public function execute(EventObserver $observer)
+ {
+ if ($this->dataHelper->isGoogleExperimentActive()) {
+ $block = $observer->getEvent()->getBlock();
+ if ($block->getForm() && $block->getForm()->getId() == 'new_category_form') {
+ $fieldset = $block->getForm()->getElement('new_category_form_fieldset');
+ $fieldset->addField(
+ 'experiment_script',
+ 'textarea',
+ [
+ 'name' => 'google_experiment[experiment_script]',
+ 'label' => __('Experiment Code'),
+ 'value' => '',
+ 'class' => 'textarea googleoptimizer',
+ 'required' => false,
+ 'note' => __('Experiment code should be added to the original page only.')
+ ]
+ );
+
+ $fieldset->addField(
+ 'code_id',
+ 'hidden',
+ [
+ 'name' => 'google_experiment[code_id]',
+ 'value' => '',
+ 'required' => false
+ ]
+ );
+ }
+ }
+ }
+}
diff --git a/app/code/Magento/GoogleOptimizer/composer.json b/app/code/Magento/GoogleOptimizer/composer.json
index e618d31a7db60..93fc961c0075e 100644
--- a/app/code/Magento/GoogleOptimizer/composer.json
+++ b/app/code/Magento/GoogleOptimizer/composer.json
@@ -11,7 +11,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/GoogleOptimizer/etc/events.xml b/app/code/Magento/GoogleOptimizer/etc/events.xml
index bb71f28673684..3595289a987aa 100644
--- a/app/code/Magento/GoogleOptimizer/etc/events.xml
+++ b/app/code/Magento/GoogleOptimizer/etc/events.xml
@@ -27,4 +27,7 @@
+
+
+
diff --git a/app/code/Magento/GroupedImportExport/composer.json b/app/code/Magento/GroupedImportExport/composer.json
index 470b349103a48..819422fabc901 100644
--- a/app/code/Magento/GroupedImportExport/composer.json
+++ b/app/code/Magento/GroupedImportExport/composer.json
@@ -11,7 +11,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/GroupedProduct/composer.json b/app/code/Magento/GroupedProduct/composer.json
index cb2f16ad86a7f..982b6476f0f6a 100644
--- a/app/code/Magento/GroupedProduct/composer.json
+++ b/app/code/Magento/GroupedProduct/composer.json
@@ -20,7 +20,7 @@
"magento/module-grouped-product-sample-data": "Sample Data version:100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/ImportExport/composer.json b/app/code/Magento/ImportExport/composer.json
index fb0d947e9f23f..3dbd0196303d7 100644
--- a/app/code/Magento/ImportExport/composer.json
+++ b/app/code/Magento/ImportExport/composer.json
@@ -11,7 +11,7 @@
"ext-ctype": "*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Indexer/composer.json b/app/code/Magento/Indexer/composer.json
index b7608b763d680..df88dea37e108 100644
--- a/app/code/Magento/Indexer/composer.json
+++ b/app/code/Magento/Indexer/composer.json
@@ -8,7 +8,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Integration/composer.json b/app/code/Magento/Integration/composer.json
index 20e4ea6ed29ed..342eff6b1439c 100644
--- a/app/code/Magento/Integration/composer.json
+++ b/app/code/Magento/Integration/composer.json
@@ -11,7 +11,7 @@
"magento/module-authorization": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/LayeredNavigation/composer.json b/app/code/Magento/LayeredNavigation/composer.json
index 566aa4a918928..d27b51542db11 100644
--- a/app/code/Magento/LayeredNavigation/composer.json
+++ b/app/code/Magento/LayeredNavigation/composer.json
@@ -8,7 +8,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Marketplace/composer.json b/app/code/Magento/Marketplace/composer.json
index e3cd89ddea4bd..c02e84336f050 100644
--- a/app/code/Magento/Marketplace/composer.json
+++ b/app/code/Magento/Marketplace/composer.json
@@ -7,7 +7,7 @@
"magento/module-backend": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/MediaStorage/composer.json b/app/code/Magento/MediaStorage/composer.json
index 80a54404f9be9..4a3397c1458d7 100644
--- a/app/code/Magento/MediaStorage/composer.json
+++ b/app/code/Magento/MediaStorage/composer.json
@@ -9,7 +9,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Msrp/composer.json b/app/code/Magento/Msrp/composer.json
index 0db1b8728bb13..bc5205bfd8f9c 100644
--- a/app/code/Magento/Msrp/composer.json
+++ b/app/code/Magento/Msrp/composer.json
@@ -16,7 +16,7 @@
"magento/module-msrp-sample-data": "Sample Data version:100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Multishipping/composer.json b/app/code/Magento/Multishipping/composer.json
index c08b3b435284e..6a325c87074d4 100644
--- a/app/code/Magento/Multishipping/composer.json
+++ b/app/code/Magento/Multishipping/composer.json
@@ -14,7 +14,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/NewRelicReporting/composer.json b/app/code/Magento/NewRelicReporting/composer.json
index 9bebe98b4eff2..373e9705b2225 100644
--- a/app/code/Magento/NewRelicReporting/composer.json
+++ b/app/code/Magento/NewRelicReporting/composer.json
@@ -13,7 +13,7 @@
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Newsletter/Test/Unit/Model/Queue/TransportBuilderTest.php b/app/code/Magento/Newsletter/Test/Unit/Model/Queue/TransportBuilderTest.php
index d9e904b7000cf..a498d464eaf94 100644
--- a/app/code/Magento/Newsletter/Test/Unit/Model/Queue/TransportBuilderTest.php
+++ b/app/code/Magento/Newsletter/Test/Unit/Model/Queue/TransportBuilderTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\App\TemplateTypesInterface;
use Magento\Framework\Mail\MessageInterface;
-class TransportBuilderTest extends \Magento\Framework\Mail\Test\Unit\Template\TransportBuilderTest
+class TransportBuilderTest extends \PHPUnit_Framework_TestCase
{
/**
* @var string
@@ -20,6 +20,57 @@ class TransportBuilderTest extends \Magento\Framework\Mail\Test\Unit\Template\Tr
*/
protected $builder;
+ /**
+ * @var \Magento\Framework\Mail\Template\FactoryInterface | \PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $templateFactoryMock;
+
+ /**
+ * @var \Magento\Framework\Mail\Message | \PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $messageMock;
+
+ /**
+ * @var \Magento\Framework\ObjectManagerInterface | \PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $objectManagerMock;
+
+ /**
+ * @var \Magento\Framework\Mail\Template\SenderResolverInterface | \PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $senderResolverMock;
+
+ /**
+ * @var \PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $mailTransportFactoryMock;
+
+ /**
+ * @return void
+ */
+ public function setUp()
+ {
+ $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
+ $this->templateFactoryMock = $this->getMock('Magento\Framework\Mail\Template\FactoryInterface');
+ $this->messageMock = $this->getMock('Magento\Framework\Mail\Message');
+ $this->objectManagerMock = $this->getMock('Magento\Framework\ObjectManagerInterface');
+ $this->senderResolverMock = $this->getMock('Magento\Framework\Mail\Template\SenderResolverInterface');
+ $this->mailTransportFactoryMock = $this->getMockBuilder('Magento\Framework\Mail\TransportInterfaceFactory')
+ ->disableOriginalConstructor()
+ ->setMethods(['create'])
+ ->getMock();
+ $this->builder = $objectManagerHelper->getObject(
+ $this->builderClassName,
+ [
+ 'templateFactory' => $this->templateFactoryMock,
+ 'message' => $this->messageMock,
+ 'objectManager' => $this->objectManagerMock,
+ 'senderResolver' => $this->senderResolverMock,
+ 'mailTransportFactory' => $this->mailTransportFactoryMock
+ ]
+ );
+ }
+
/**
* @param int $templateType
* @param string $messageType
diff --git a/app/code/Magento/Newsletter/composer.json b/app/code/Magento/Newsletter/composer.json
index 140a1c71c3f42..36b9b143a8f07 100644
--- a/app/code/Magento/Newsletter/composer.json
+++ b/app/code/Magento/Newsletter/composer.json
@@ -15,7 +15,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/OfflinePayments/composer.json b/app/code/Magento/OfflinePayments/composer.json
index 7844150fbdd63..9d15107f0eaf0 100644
--- a/app/code/Magento/OfflinePayments/composer.json
+++ b/app/code/Magento/OfflinePayments/composer.json
@@ -8,7 +8,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/OfflineShipping/composer.json b/app/code/Magento/OfflineShipping/composer.json
index 6e2fd9d9b13b9..a0b384ca78c83 100644
--- a/app/code/Magento/OfflineShipping/composer.json
+++ b/app/code/Magento/OfflineShipping/composer.json
@@ -19,7 +19,7 @@
"magento/module-offline-shipping-sample-data": "Sample Data version:100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/PageCache/Model/App/FrontController/MessageBox.php b/app/code/Magento/PageCache/Model/App/FrontController/MessageBox.php
deleted file mode 100644
index 38d2e63c6e2fb..0000000000000
--- a/app/code/Magento/PageCache/Model/App/FrontController/MessageBox.php
+++ /dev/null
@@ -1,100 +0,0 @@
-cookieManager = $cookieManager;
- $this->cookieMetadataFactory = $cookieMetadataFactory;
- $this->request = $request;
- $this->config = $config;
- $this->messageManager = $messageManager;
- }
-
- /**
- * Set Cookie for msg box when it displays first
- *
- * @param FrontController $subject
- * @param \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface $result
- *
- * @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface
- * @SuppressWarnings(PHPMD.UnusedFormalParameter)
- */
- public function afterDispatch(FrontController $subject, $result)
- {
- if ($this->request->isPost() && $this->messageManager->hasMessages()) {
- $publicCookieMetadata = $this->cookieMetadataFactory->createPublicCookieMetadata()
- ->setDuration(self::COOKIE_PERIOD)
- ->setPath('/')
- ->setHttpOnly(false);
- $this->cookieManager->setPublicCookie(self::COOKIE_NAME, 1, $publicCookieMetadata);
- }
- return $result;
- }
-}
diff --git a/app/code/Magento/PageCache/Test/Unit/Model/App/FrontController/MessageBoxTest.php b/app/code/Magento/PageCache/Test/Unit/Model/App/FrontController/MessageBoxTest.php
deleted file mode 100644
index cec6b6f530382..0000000000000
--- a/app/code/Magento/PageCache/Test/Unit/Model/App/FrontController/MessageBoxTest.php
+++ /dev/null
@@ -1,148 +0,0 @@
-cookieManagerMock = $this->getMock('Magento\Framework\Stdlib\CookieManagerInterface');
- $this->cookieMetadataFactoryMock = $this->getMockBuilder(
- 'Magento\Framework\Stdlib\Cookie\CookieMetadataFactory'
- )->disableOriginalConstructor()
- ->getMock();
- $this->publicCookieMetadataMock = $this->getMockBuilder(
- 'Magento\Framework\Stdlib\Cookie\PublicCookieMetadata'
- )->disableOriginalConstructor()
- ->getMock();
- $this->requestMock = $this->getMockBuilder('Magento\Framework\App\Request\Http')
- ->disableOriginalConstructor()
- ->getMock();
- $this->messageManagerMock = $this->getMockBuilder('Magento\Framework\Message\Manager')
- ->disableOriginalConstructor()
- ->getMock();
-
- $this->msgBox = (new ObjectManager($this))->getObject(
- 'Magento\PageCache\Model\App\FrontController\MessageBox',
- [
- 'cookieManager' => $this->cookieManagerMock,
- 'cookieMetadataFactory' => $this->cookieMetadataFactoryMock,
- 'request' => $this->requestMock,
- 'messageManager' => $this->messageManagerMock,
- ]
- );
-
- $this->objectMock = $this->getMock('Magento\Framework\App\FrontController', [], [], '', false);
- $this->responseMock = $this->getMock('Magento\Framework\App\ResponseInterface', [], [], '', false);
- }
-
- /**
- * @param bool $isPost
- * @param int $numOfCalls
- * @dataProvider afterDispatchTestDataProvider
- */
- public function testAfterDispatch($isPost, $numOfCalls)
- {
- $this->messageManagerMock->expects($this->exactly($numOfCalls))
- ->method('hasMessages')
- ->will($this->returnValue(true));
- $this->requestMock->expects($this->once())
- ->method('isPost')
- ->will($this->returnValue($isPost));
- $this->cookieMetadataFactoryMock->expects($this->exactly($numOfCalls))
- ->method('createPublicCookieMetadata')
- ->will($this->returnValue($this->publicCookieMetadataMock));
- $this->publicCookieMetadataMock->expects(($this->exactly($numOfCalls)))
- ->method('setDuration')
- ->with(MessageBox::COOKIE_PERIOD)
- ->will($this->returnValue($this->publicCookieMetadataMock));
- $this->publicCookieMetadataMock->expects(($this->exactly($numOfCalls)))
- ->method('setPath')
- ->with('/')
- ->will($this->returnValue($this->publicCookieMetadataMock));
- $this->publicCookieMetadataMock->expects(($this->exactly($numOfCalls)))
- ->method('setHttpOnly')
- ->with(false)
- ->will($this->returnValue($this->publicCookieMetadataMock));
- $this->cookieManagerMock->expects($this->exactly($numOfCalls))
- ->method('setPublicCookie')
- ->with(
- MessageBox::COOKIE_NAME,
- 1,
- $this->publicCookieMetadataMock
- );
- $this->assertSame($this->responseMock, $this->msgBox->afterDispatch($this->objectMock, $this->responseMock));
- }
-
- /**
- * Data provider
- *
- * @return array
- */
- public function afterDispatchTestDataProvider()
- {
- return [
- [true, 1],
- [false, 0],
- ];
- }
-}
diff --git a/app/code/Magento/PageCache/composer.json b/app/code/Magento/PageCache/composer.json
index 3e879c4e03f64..816cab5dd238e 100644
--- a/app/code/Magento/PageCache/composer.json
+++ b/app/code/Magento/PageCache/composer.json
@@ -9,7 +9,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/PageCache/etc/adminhtml/system.xml b/app/code/Magento/PageCache/etc/adminhtml/system.xml
index b6c79ee8c853f..fe6b8c6f85b14 100644
--- a/app/code/Magento/PageCache/etc/adminhtml/system.xml
+++ b/app/code/Magento/PageCache/etc/adminhtml/system.xml
@@ -18,7 +18,7 @@
- IPs access list separated with ',' that can purge Varnish configuration for config file generation.
+ IPs access list separated with \',\' that can purge Varnish configuration for config file generation.
If field is empty default value localhost will be saved.
Magento\PageCache\Model\System\Config\Backend\Varnish
diff --git a/app/code/Magento/PageCache/etc/frontend/di.xml b/app/code/Magento/PageCache/etc/frontend/di.xml
index 658dce3f72ed6..1d57d767e9904 100644
--- a/app/code/Magento/PageCache/etc/frontend/di.xml
+++ b/app/code/Magento/PageCache/etc/frontend/di.xml
@@ -9,7 +9,6 @@
-
diff --git a/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js b/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
index 162a8412aeda8..26f394b98dd07 100644
--- a/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
+++ b/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
@@ -51,28 +51,6 @@ define([
return elements;
};
- /**
- * MsgBox Widget checks if message box is displayed and sets cookie
- */
- $.widget('mage.msgBox', {
- options: {
- msgBoxCookieName: 'message_box_display',
- msgBoxSelector: '.main div.messages'
- },
-
- /**
- * Creates widget 'mage.msgBox'
- * @private
- */
- _create: function () {
- if ($.mage.cookies.get(this.options.msgBoxCookieName)) {
- $.mage.cookies.clear(this.options.msgBoxCookieName);
- } else {
- $(this.options.msgBoxSelector).hide();
- }
- }
- });
-
/**
* FormKey Widget - this widget is generating from key, saves it to cookie and
*/
@@ -272,14 +250,12 @@ define([
domReady(function () {
$('body')
- .msgBox()
.formKey();
});
return {
'pageCache': $.mage.pageCache,
- 'formKey': $.mage.formKey,
- 'msgBox': $.mage.msgBox
+ 'formKey': $.mage.formKey
};
/**
diff --git a/app/code/Magento/Payment/composer.json b/app/code/Magento/Payment/composer.json
index 41128bf9de0be..847ad533d1cf0 100644
--- a/app/code/Magento/Payment/composer.json
+++ b/app/code/Magento/Payment/composer.json
@@ -12,7 +12,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Paypal/Block/Iframe.php b/app/code/Magento/Paypal/Block/Iframe.php
index 8cbc45586c369..e8438c9cc3fea 100644
--- a/app/code/Magento/Paypal/Block/Iframe.php
+++ b/app/code/Magento/Paypal/Block/Iframe.php
@@ -89,10 +89,10 @@ public function __construct(
$this->_hssHelper = $hssHelper;
$this->_orderFactory = $orderFactory;
$this->_checkoutSession = $checkoutSession;
- parent::__construct($context, $data);
$this->_isScopePrivate = true;
$this->readFactory = $readFactory;
$this->reader = $reader;
+ parent::__construct($context, $data);
}
/**
diff --git a/app/code/Magento/Paypal/Controller/Payflow.php b/app/code/Magento/Paypal/Controller/Payflow.php
index d4a6be5f4f18d..d475c59cc0092 100644
--- a/app/code/Magento/Paypal/Controller/Payflow.php
+++ b/app/code/Magento/Paypal/Controller/Payflow.php
@@ -73,6 +73,8 @@ public function __construct(
*/
protected function _cancelPayment($errorMsg = '')
{
+ $errorMsg = trim(strip_tags($errorMsg));
+
$gotoSection = false;
$this->_checkoutHelper->cancelCurrentOrder($errorMsg);
if ($this->_checkoutSession->restoreQuote()) {
diff --git a/app/code/Magento/Paypal/Controller/Payflow/ReturnUrl.php b/app/code/Magento/Paypal/Controller/Payflow/ReturnUrl.php
index 1907a07045f39..4318b6b2ed785 100644
--- a/app/code/Magento/Paypal/Controller/Payflow/ReturnUrl.php
+++ b/app/code/Magento/Paypal/Controller/Payflow/ReturnUrl.php
@@ -7,6 +7,7 @@
namespace Magento\Paypal\Controller\Payflow;
use Magento\Paypal\Controller\Payflow;
+use Magento\Paypal\Model\Config;
use Magento\Sales\Model\Order;
class ReturnUrl extends Payflow
@@ -19,6 +20,15 @@ class ReturnUrl extends Payflow
Order::STATE_COMPLETE,
];
+ /**
+ * Payment method code
+ * @var string
+ */
+ protected $allowedPaymentMethodCodes = [
+ Config::METHOD_PAYFLOWPRO,
+ Config::METHOD_PAYFLOWLINK
+ ];
+
/**
* When a customer return to website from payflow gateway.
*
@@ -35,16 +45,44 @@ public function execute()
$order = $this->_orderFactory->create()->loadByIncrementId($this->_checkoutSession->getLastRealOrderId());
if ($order->getIncrementId()) {
- if (in_array($order->getState(), $this->allowedOrderStates)) {
+ if ($this->checkOrderState($order)) {
$redirectBlock->setData('goto_success_page', true);
} else {
- $gotoSection = $this->_cancelPayment(strval($this->getRequest()->getParam('RESPMSG')));
- $redirectBlock->setData('goto_section', $gotoSection);
- $redirectBlock->setData('error_msg', __('Your payment has been declined. Please try again.'));
+ if ($this->checkPaymentMethod($order)) {
+ $gotoSection = $this->_cancelPayment(strval($this->getRequest()->getParam('RESPMSG')));
+ $redirectBlock->setData('goto_section', $gotoSection);
+ $redirectBlock->setData('error_msg', __('Your payment has been declined. Please try again.'));
+ } else {
+ $redirectBlock->setData('goto_section', false);
+ $redirectBlock->setData('error_msg', __('Requested payment method does not match with order.'));
+ }
}
}
}
$this->_view->renderLayout();
}
+
+ /**
+ * Check order state
+ *
+ * @param Order $order
+ * @return bool
+ */
+ protected function checkOrderState(Order $order)
+ {
+ return in_array($order->getState(), $this->allowedOrderStates);
+ }
+
+ /**
+ * Check requested payment method
+ *
+ * @param Order $order
+ * @return bool
+ */
+ protected function checkPaymentMethod(Order $order)
+ {
+ $payment = $order->getPayment();
+ return in_array($payment->getMethod(), $this->allowedPaymentMethodCodes);
+ }
}
diff --git a/app/code/Magento/Paypal/Controller/Payflowadvanced/ReturnUrl.php b/app/code/Magento/Paypal/Controller/Payflowadvanced/ReturnUrl.php
index f65daf805eee4..3f2c4ead5be61 100644
--- a/app/code/Magento/Paypal/Controller/Payflowadvanced/ReturnUrl.php
+++ b/app/code/Magento/Paypal/Controller/Payflowadvanced/ReturnUrl.php
@@ -6,6 +6,8 @@
*/
namespace Magento\Paypal\Controller\Payflowadvanced;
+use Magento\Paypal\Model\Config;
+
class ReturnUrl extends \Magento\Paypal\Controller\Payflow\ReturnUrl
{
/**
@@ -13,4 +15,12 @@ class ReturnUrl extends \Magento\Paypal\Controller\Payflow\ReturnUrl
* @var string
*/
protected $_redirectBlockName = 'payflow.advanced.iframe';
+
+ /**
+ * Payment method code
+ * @var string
+ */
+ protected $allowedPaymentMethodCodes = [
+ Config::METHOD_PAYFLOWADVANCED
+ ];
}
diff --git a/app/code/Magento/Paypal/Test/Unit/Controller/Payflow/ReturnUrlTest.php b/app/code/Magento/Paypal/Test/Unit/Controller/Payflow/ReturnUrlTest.php
index 96a45ab4cfb23..19f3623d4fa19 100644
--- a/app/code/Magento/Paypal/Test/Unit/Controller/Payflow/ReturnUrlTest.php
+++ b/app/code/Magento/Paypal/Test/Unit/Controller/Payflow/ReturnUrlTest.php
@@ -10,11 +10,18 @@
use Magento\Checkout\Model\Session;
use Magento\Framework\App\Http;
use Magento\Framework\App\View;
+use Magento\Framework\App\ViewInterface;
use Magento\Framework\View\LayoutInterface;
use Magento\Paypal\Controller\Payflow\ReturnUrl;
+use Magento\Paypal\Controller\Payflowadvanced\ReturnUrl as PayflowadvancedReturnUrl;
use Magento\Paypal\Helper\Checkout;
use Magento\Sales\Model\Order;
+use Magento\Sales\Model\Order\Payment;
use Psr\Log\LoggerInterface;
+use Magento\Paypal\Model\Config;
+use Magento\Framework\App\Action\Context;
+use Magento\Sales\Model\OrderFactory;
+use Magento\Paypal\Model\PayflowlinkFactory;
/**
* Class ReturnUrlTest
@@ -29,7 +36,7 @@ class ReturnUrlTest extends \PHPUnit_Framework_TestCase
protected $returnUrl;
/**
- * @var \Magento\Framework\App\Action\Context|\PHPUnit_Framework_MockObject_MockObject
+ * @var Context|\PHPUnit_Framework_MockObject_MockObject
*/
protected $contextMock;
@@ -49,12 +56,12 @@ class ReturnUrlTest extends \PHPUnit_Framework_TestCase
protected $checkoutSessionMock;
/**
- * @var \Magento\Sales\Model\OrderFactory|\PHPUnit_Framework_MockObject_MockObject
+ * @var OrderFactory|\PHPUnit_Framework_MockObject_MockObject
*/
protected $orderFactoryMock;
/**
- * @var \Magento\Paypal\Model\PayflowlinkFactory|\PHPUnit_Framework_MockObject_MockObject
+ * @var PayflowlinkFactory|\PHPUnit_Framework_MockObject_MockObject
*/
protected $payflowlinkFactoryMock;
@@ -83,31 +90,44 @@ class ReturnUrlTest extends \PHPUnit_Framework_TestCase
*/
protected $orderMock;
+ /**
+ * @var Payment|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $paymentMock;
+
+ const LAST_REAL_ORDER_ID = '000000001';
+
protected function setUp()
{
- $this->contextMock = $this->getMock('Magento\Framework\App\Action\Context', [], [], '', false);
- $this->viewMock = $this->getMock('Magento\Framework\App\ViewInterface');
- $this->requestMock = $this->getMock('Magento\Framework\App\Request\Http', [], [], '', false);
- $this->layoutMock = $this->getMock('Magento\Framework\View\LayoutInterface');
+ $this->contextMock = $this->getMock(Context::class, [], [], '', false);
+ $this->viewMock = $this->getMock(ViewInterface::class);
+ $this->requestMock = $this->getMock(Http::class, ['getParam'], [], '', false);
+ $this->layoutMock = $this->getMock(LayoutInterface::class);
$this->blockMock = $this
- ->getMockBuilder('\Magento\Checkout\Block\Onepage\Success')
+ ->getMockBuilder(Success::class)
->disableOriginalConstructor()
->getMock();
- $this->orderFactoryMock = $this->getMock('\Magento\Sales\Model\OrderFactory', ['create'], [], '', false);
- $this->payflowlinkFactoryMock = $this->getMock('\Magento\Paypal\Model\PayflowlinkFactory', [], [], '', false);
- $this->helperCheckoutMock = $this->getMock('\Magento\Paypal\Helper\Checkout', [], [], '', false);
- $this->loggerMock = $this->getMockForAbstractClass('\Psr\Log\LoggerInterface');
+ $this->orderFactoryMock = $this->getMock(OrderFactory::class, ['create'], [], '', false);
+ $this->payflowlinkFactoryMock = $this->getMock(PayflowlinkFactory::class, [], [], '', false);
+ $this->helperCheckoutMock = $this->getMock(Checkout::class, ['cancelCurrentOrder'], [], '', false);
+ $this->loggerMock = $this->getMockForAbstractClass(LoggerInterface::class);
$this->orderMock = $this
- ->getMockBuilder('\Magento\Sales\Model\Order')
+ ->getMockBuilder(Order::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->paymentMock = $this
+ ->getMockBuilder(Payment::class)
->disableOriginalConstructor()
->getMock();
+ $this->orderMock->expects($this->any())->method('getPayment')->will($this->returnValue($this->paymentMock));
+
$this->checkoutSessionMock = $this
- ->getMockBuilder('\Magento\Checkout\Model\Session')
+ ->getMockBuilder(Session::class)
->setMethods(['getLastRealOrderId', 'getLastRealOrder', 'restoreQuote'])
->disableOriginalConstructor()
->getMock();
- $this->contextMock->expects($this->once())->method('getView')->will($this->returnValue($this->viewMock));
+ $this->contextMock->expects($this->any())->method('getView')->will($this->returnValue($this->viewMock));
$this->contextMock->expects($this->any())->method('getRequest')->will($this->returnValue($this->requestMock));
$this->returnUrl = new ReturnUrl(
@@ -123,7 +143,7 @@ protected function setUp()
/**
* @return array
*/
- public function testAllowedOrderStateDataProvider()
+ public function allowedOrderStateDataProvider()
{
return [
[Order::STATE_PROCESSING],
@@ -134,7 +154,7 @@ public function testAllowedOrderStateDataProvider()
/**
* @return array
*/
- public function testNotAllowedOrderStateDataProvider()
+ public function notAllowedOrderStateDataProvider()
{
return [
[Order::STATE_NEW, false, ''],
@@ -154,47 +174,21 @@ public function testNotAllowedOrderStateDataProvider()
/**
* @param $state
- * @dataProvider testAllowedOrderStateDataProvider
+ * @dataProvider allowedOrderStateDataProvider
*/
public function testExecuteAllowedOrderState($state)
{
- $lastRealOrderId = '000000001';
+ $this->initLayoutMock();
+ $this->initOrderMock(self::LAST_REAL_ORDER_ID, $state);
- $this->viewMock
- ->expects($this->once())
- ->method('getLayout')
- ->will($this->returnValue($this->layoutMock));
-
- $this->layoutMock
- ->expects($this->once())
- ->method('getBlock')
- ->will($this->returnValue($this->blockMock));
+ $this->requestMock
+ ->expects($this->never())
+ ->method('getParam');
$this->checkoutSessionMock
->expects($this->exactly(2))
->method('getLastRealOrderId')
- ->will($this->returnValue($lastRealOrderId));
-
- $this->orderFactoryMock
- ->expects($this->once())
- ->method('create')
- ->will($this->returnValue($this->orderMock));
-
- $this->orderMock
- ->expects($this->once())
- ->method('loadByIncrementId')
- ->with($lastRealOrderId)
- ->will($this->returnSelf());
-
- $this->orderMock
- ->expects($this->once())
- ->method('getIncrementId')
- ->will($this->returnValue($lastRealOrderId));
-
- $this->orderMock
- ->expects($this->once())
- ->method('getState')
- ->will($this->returnValue($state));
+ ->will($this->returnValue(self::LAST_REAL_ORDER_ID));
$this->blockMock
->expects($this->once())
@@ -202,6 +196,10 @@ public function testExecuteAllowedOrderState($state)
->with('goto_success_page', true)
->will($this->returnSelf());
+ $this->paymentMock
+ ->expects($this->never())
+ ->method('getMethod');
+
$this->returnUrl->execute();
}
@@ -209,36 +207,172 @@ public function testExecuteAllowedOrderState($state)
* @param $state
* @param $restoreQuote
* @param $expectedGotoSection
- * @dataProvider testNotAllowedOrderStateDataProvider
+ * @dataProvider notAllowedOrderStateDataProvider
*/
public function testExecuteNotAllowedOrderState($state, $restoreQuote, $expectedGotoSection)
{
- $lastRealOrderId = '000000001';
- $this->viewMock
+ $this->initLayoutMock();
+ $this->initOrderMock(self::LAST_REAL_ORDER_ID, $state);
+ $this->initCheckoutSessionMock(self::LAST_REAL_ORDER_ID, $restoreQuote);
+
+ $this->requestMock
->expects($this->once())
- ->method('getLayout')
- ->will($this->returnValue($this->layoutMock));
+ ->method('getParam')
+ ->with('RESPMSG')
+ ->will($this->returnValue('message'));
- $this->layoutMock
+ $this->blockMock
+ ->expects($this->at(0))
+ ->method('setData')
+ ->with('goto_section', $expectedGotoSection)
+ ->will($this->returnSelf());
+
+ $this->blockMock
+ ->expects($this->at(1))
+ ->method('setData')
+ ->with('error_msg', __('Your payment has been declined. Please try again.'))
+ ->will($this->returnSelf());
+
+ $this->paymentMock
->expects($this->once())
- ->method('getBlock')
- ->will($this->returnValue($this->blockMock));
+ ->method('getMethod')
+ ->will($this->returnValue(Config::METHOD_PAYFLOWLINK));
+
+ $this->returnUrl->execute();
+ }
+
+ public function testCheckRejectByPaymentMethod()
+ {
+ $this->initLayoutMock();
+ $this->initOrderMock(self::LAST_REAL_ORDER_ID, Order::STATE_NEW);
+
+ $this->requestMock
+ ->expects($this->never())
+ ->method('getParam');
$this->checkoutSessionMock
->expects($this->any())
->method('getLastRealOrderId')
- ->will($this->returnValue($lastRealOrderId));
+ ->will($this->returnValue(self::LAST_REAL_ORDER_ID));
- $this->checkoutSessionMock
- ->expects($this->any())
- ->method('getLastRealOrder')
- ->will($this->returnValue($this->orderMock));
+ $this->blockMock
+ ->expects($this->at(0))
+ ->method('setData')
+ ->with('goto_section', false)
+ ->will($this->returnSelf());
- $this->checkoutSessionMock
- ->expects($this->any())
- ->method('restoreQuote')
- ->will($this->returnValue($restoreQuote));
+ $this->blockMock
+ ->expects($this->at(1))
+ ->method('setData')
+ ->with('error_msg', __('Requested payment method does not match with order.'))
+ ->will($this->returnSelf());
+
+ $this->paymentMock
+ ->expects($this->once())
+ ->method('getMethod')
+ ->will($this->returnValue('something_else'));
+
+ $this->returnUrl->execute();
+ }
+
+ /**
+ * @return array
+ */
+ public function checkXSSEscapedDataProvider()
+ {
+ return [
+ ['simple', 'simple'],
+ ['', 'alert(1)'],
+ ['', '']
+ ];
+ }
+
+ /**
+ * @param $errorMsg
+ * @param $errorMsgEscaped
+ * @dataProvider checkXSSEscapedDataProvider
+ */
+ public function testCheckXSSEscaped($errorMsg, $errorMsgEscaped)
+ {
+ $this->initLayoutMock();
+ $this->initOrderMock(self::LAST_REAL_ORDER_ID, Order::STATE_NEW);
+ $this->initCheckoutSessionMock(self::LAST_REAL_ORDER_ID, true);
+
+ $this->requestMock
+ ->expects($this->once())
+ ->method('getParam')
+ ->with('RESPMSG')
+ ->will($this->returnValue($errorMsg));
+
+ $this->helperCheckoutMock
+ ->expects($this->once())
+ ->method('cancelCurrentOrder')
+ ->with($errorMsgEscaped)
+ ->will($this->returnValue(self::LAST_REAL_ORDER_ID));
+
+ $this->blockMock
+ ->expects($this->at(0))
+ ->method('setData')
+ ->with('goto_section', 'paymentMethod')
+ ->will($this->returnSelf());
+
+ $this->blockMock
+ ->expects($this->at(1))
+ ->method('setData')
+ ->with('error_msg', __('Your payment has been declined. Please try again.'))
+ ->will($this->returnSelf());
+
+ $this->paymentMock
+ ->expects($this->once())
+ ->method('getMethod')
+ ->will($this->returnValue(Config::METHOD_PAYFLOWLINK));
+
+ $this->returnUrl->execute();
+ }
+
+ public function testCheckAdvancedAcceptingByPaymentMethod()
+ {
+ $this->initLayoutMock();
+ $this->initOrderMock(self::LAST_REAL_ORDER_ID, Order::STATE_NEW);
+ $this->initCheckoutSessionMock(self::LAST_REAL_ORDER_ID, true);
+
+ $this->requestMock
+ ->expects($this->once())
+ ->method('getParam')
+ ->with('RESPMSG')
+ ->will($this->returnValue('message'));
+
+ $this->blockMock
+ ->expects($this->at(0))
+ ->method('setData')
+ ->with('goto_section', 'paymentMethod')
+ ->will($this->returnSelf());
+
+ $this->blockMock
+ ->expects($this->at(1))
+ ->method('setData')
+ ->with('error_msg', __('Your payment has been declined. Please try again.'))
+ ->will($this->returnSelf());
+
+ $this->paymentMock
+ ->expects($this->once())
+ ->method('getMethod')
+ ->will($this->returnValue(Config::METHOD_PAYFLOWADVANCED));
+
+ $payflowadvancedReturnUrl = new PayflowadvancedReturnUrl(
+ $this->contextMock,
+ $this->checkoutSessionMock,
+ $this->orderFactoryMock,
+ $this->payflowlinkFactoryMock,
+ $this->helperCheckoutMock,
+ $this->loggerMock
+ );
+
+ $payflowadvancedReturnUrl->execute();
+ }
+ private function initOrderMock($orderId, $state)
+ {
$this->orderFactoryMock
->expects($this->any())
->method('create')
@@ -247,31 +381,58 @@ public function testExecuteNotAllowedOrderState($state, $restoreQuote, $expected
$this->orderMock
->expects($this->once())
->method('loadByIncrementId')
- ->with($lastRealOrderId)
+ ->with($orderId)
->will($this->returnSelf());
$this->orderMock
->expects($this->once())
->method('getIncrementId')
- ->will($this->returnValue($lastRealOrderId));
+ ->will($this->returnValue($orderId));
$this->orderMock
->expects($this->once())
->method('getState')
->will($this->returnValue($state));
+ }
- $this->blockMock
- ->expects($this->at(0))
- ->method('setData')
- ->with('goto_section', $expectedGotoSection)
- ->will($this->returnSelf());
+ private function initLayoutMock()
+ {
+ $this->viewMock
+ ->expects($this->once())
+ ->method('getLayout')
+ ->will($this->returnValue($this->layoutMock));
- $this->blockMock
- ->expects($this->at(1))
- ->method('setData')
- ->with('error_msg', __('Your payment has been declined. Please try again.'))
- ->will($this->returnSelf());
+ $this->viewMock
+ ->expects($this->once())
+ ->method('loadLayout')
+ ->willReturnSelf();
- $this->returnUrl->execute();
+ $this->viewMock
+ ->expects($this->once())
+ ->method('renderLayout')
+ ->willReturnSelf();
+
+ $this->layoutMock
+ ->expects($this->once())
+ ->method('getBlock')
+ ->will($this->returnValue($this->blockMock));
+ }
+
+ private function initCheckoutSessionMock($orderId, $restoreQuote)
+ {
+ $this->checkoutSessionMock
+ ->expects($this->any())
+ ->method('getLastRealOrderId')
+ ->will($this->returnValue($orderId));
+
+ $this->checkoutSessionMock
+ ->expects($this->any())
+ ->method('getLastRealOrder')
+ ->will($this->returnValue($this->orderMock));
+
+ $this->checkoutSessionMock
+ ->expects($this->any())
+ ->method('restoreQuote')
+ ->will($this->returnValue($restoreQuote));
}
}
diff --git a/app/code/Magento/Paypal/composer.json b/app/code/Magento/Paypal/composer.json
index ae291a7c9885e..7dfd7d9e78221 100644
--- a/app/code/Magento/Paypal/composer.json
+++ b/app/code/Magento/Paypal/composer.json
@@ -24,7 +24,7 @@
"magento/module-checkout-agreements": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"proprietary"
],
diff --git a/app/code/Magento/Paypal/etc/adminhtml/system.xml b/app/code/Magento/Paypal/etc/adminhtml/system.xml
index d716794f5ca8e..cd643689b48e8 100644
--- a/app/code/Magento/Paypal/etc/adminhtml/system.xml
+++ b/app/code/Magento/Paypal/etc/adminhtml/system.xml
@@ -50,6 +50,7 @@
+ https://www.paypal.com/us/webapps/mpp/paypal-payments-pro?partner_id=NB9WWHYEMVUMS
payment/paypal_payment_pro/active
diff --git a/app/code/Magento/Paypal/etc/frontend/sections.xml b/app/code/Magento/Paypal/etc/frontend/sections.xml
index 1a298d44576f9..2f4e672303e2d 100644
--- a/app/code/Magento/Paypal/etc/frontend/sections.xml
+++ b/app/code/Magento/Paypal/etc/frontend/sections.xml
@@ -11,4 +11,8 @@
+
+
+
+
diff --git a/app/code/Magento/Paypal/i18n/en_US.csv b/app/code/Magento/Paypal/i18n/en_US.csv
index c13c7ac0ce277..a999a5624158c 100644
--- a/app/code/Magento/Paypal/i18n/en_US.csv
+++ b/app/code/Magento/Paypal/i18n/en_US.csv
@@ -693,3 +693,4 @@ unverified,unverified
Eligible,Eligible
Ineligible,Inligible
"PayPal Express Checkout","PayPal Express Checkout"
+"Requested payment method does not match with order.","Requested payment method does not match with order."
diff --git a/app/code/Magento/Persistent/composer.json b/app/code/Magento/Persistent/composer.json
index 2f0fd95679fae..bba4ce7d91d9a 100644
--- a/app/code/Magento/Persistent/composer.json
+++ b/app/code/Magento/Persistent/composer.json
@@ -12,7 +12,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/ProductAlert/composer.json b/app/code/Magento/ProductAlert/composer.json
index fb1d0a28c5d3c..e69f3c6b233e6 100644
--- a/app/code/Magento/ProductAlert/composer.json
+++ b/app/code/Magento/ProductAlert/composer.json
@@ -10,7 +10,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/ProductVideo/composer.json b/app/code/Magento/ProductVideo/composer.json
index 572beee8787e5..4453a41c3bd3a 100644
--- a/app/code/Magento/ProductVideo/composer.json
+++ b/app/code/Magento/ProductVideo/composer.json
@@ -13,7 +13,7 @@
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"proprietary"
],
diff --git a/app/code/Magento/Quote/composer.json b/app/code/Magento/Quote/composer.json
index 8970f5a3981c6..c16634696ead3 100644
--- a/app/code/Magento/Quote/composer.json
+++ b/app/code/Magento/Quote/composer.json
@@ -20,7 +20,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Reports/composer.json b/app/code/Magento/Reports/composer.json
index 33252ef117d22..94c45fce78563 100644
--- a/app/code/Magento/Reports/composer.json
+++ b/app/code/Magento/Reports/composer.json
@@ -22,7 +22,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/RequireJs/Block/Html/Head/Config.php b/app/code/Magento/RequireJs/Block/Html/Head/Config.php
index 8eec827a91fdb..07e91e0877228 100644
--- a/app/code/Magento/RequireJs/Block/Html/Head/Config.php
+++ b/app/code/Magento/RequireJs/Block/Html/Head/Config.php
@@ -119,16 +119,4 @@ protected function _prepareLayout()
return parent::_prepareLayout();
}
-
- /**
- * Include base RequireJs configuration necessary for working with Magento application
- *
- * @return string|void
- */
- protected function _toHtml()
- {
- return "\n";
- }
}
diff --git a/app/code/Magento/RequireJs/Test/Unit/Block/Html/Head/ConfigTest.php b/app/code/Magento/RequireJs/Test/Unit/Block/Html/Head/ConfigTest.php
index e976f7563a845..32adea00ffbdc 100644
--- a/app/code/Magento/RequireJs/Test/Unit/Block/Html/Head/ConfigTest.php
+++ b/app/code/Magento/RequireJs/Test/Unit/Block/Html/Head/ConfigTest.php
@@ -131,35 +131,4 @@ public function testSetLayout()
);
$object->setLayout($layout);
}
-
- public function testToHtml()
- {
- $this->context->expects($this->once())
- ->method('getEventManager')
- ->will($this->returnValue($this->getMockForAbstractClass('\Magento\Framework\Event\ManagerInterface')));
- $this->context->expects($this->once())
- ->method('getScopeConfig')
- ->will($this->returnValue(
- $this->getMockForAbstractClass('\Magento\Framework\App\Config\ScopeConfigInterface')
- ));
- $this->config->expects($this->once())->method('getBaseConfig')->will($this->returnValue('the config data'));
- $this->minificationMock = $this->getMockBuilder('Magento\Framework\View\Asset\Minification')
- ->disableOriginalConstructor()
- ->getMock();
-
- $object = new Config(
- $this->context,
- $this->config,
- $this->fileManager,
- $this->pageConfig,
- $this->bundleConfig,
- $this->minificationMock
- );
- $html = $object->toHtml();
- $expectedFormat = <<
-the config data
-expected;
- $this->assertStringMatchesFormat($expectedFormat, $html);
- }
}
diff --git a/app/code/Magento/RequireJs/composer.json b/app/code/Magento/RequireJs/composer.json
index 279e00af053fa..ad96684588278 100644
--- a/app/code/Magento/RequireJs/composer.json
+++ b/app/code/Magento/RequireJs/composer.json
@@ -6,7 +6,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Review/Controller/Product/Post.php b/app/code/Magento/Review/Controller/Product/Post.php
index a68f0d18c3bc5..e20872b41dcd6 100644
--- a/app/code/Magento/Review/Controller/Product/Post.php
+++ b/app/code/Magento/Review/Controller/Product/Post.php
@@ -37,10 +37,10 @@ public function execute()
$data = $this->getRequest()->getPostValue();
$rating = $this->getRequest()->getParam('ratings', []);
}
-
if (($product = $this->initProduct()) && !empty($data)) {
/** @var \Magento\Review\Model\Review $review */
$review = $this->reviewFactory->create()->setData($data);
+ $review->unsetData('review_id');
$validate = $review->validate();
if ($validate === true) {
diff --git a/app/code/Magento/Review/Test/Unit/Controller/Product/PostTest.php b/app/code/Magento/Review/Test/Unit/Controller/Product/PostTest.php
index 9cedb87e15afe..38f1a27a4d430 100644
--- a/app/code/Magento/Review/Test/Unit/Controller/Product/PostTest.php
+++ b/app/code/Magento/Review/Test/Unit/Controller/Product/PostTest.php
@@ -127,7 +127,7 @@ public function setUp()
'\Magento\Review\Model\Review',
[
'setData', 'validate', 'setEntityId', 'getEntityIdByCode', 'setEntityPkValue', 'setStatusId',
- 'setCustomerId', 'setStoreId', 'setStores', 'save', 'getId', 'aggregate'
+ 'setCustomerId', 'setStoreId', 'setStores', 'save', 'getId', 'aggregate', 'unsetData'
],
[],
'',
@@ -219,7 +219,10 @@ public function setUp()
*/
public function testExecute()
{
- $ratingsData = ['ratings' => [1 => 1]];
+ $reviewData = [
+ 'ratings' => [1 => 1],
+ 'review_id' => 2
+ ];
$productId = 1;
$customerId = 1;
$storeId = 1;
@@ -230,7 +233,7 @@ public function testExecute()
->willReturn(true);
$this->reviewSession->expects($this->any())->method('getFormData')
->with(true)
- ->willReturn($ratingsData);
+ ->willReturn($reviewData);
$this->request->expects($this->at(0))->method('getParam')
->with('category', false)
->willReturn(false);
@@ -260,7 +263,7 @@ public function testExecute()
->with('product', $product)
->willReturnSelf();
$this->review->expects($this->once())->method('setData')
- ->with($ratingsData)
+ ->with($reviewData)
->willReturnSelf();
$this->review->expects($this->once())->method('validate')
->willReturn(true);
@@ -270,6 +273,7 @@ public function testExecute()
$this->review->expects($this->once())->method('setEntityId')
->with(1)
->willReturnSelf();
+ $this->review->expects($this->once())->method('unsetData')->with('review_id');
$product->expects($this->exactly(2))
->method('getId')
->willReturn($productId);
diff --git a/app/code/Magento/Review/composer.json b/app/code/Magento/Review/composer.json
index 1f83b920855f0..ffc47560f86e0 100644
--- a/app/code/Magento/Review/composer.json
+++ b/app/code/Magento/Review/composer.json
@@ -18,7 +18,7 @@
"magento/module-review-sample-data": "Sample Data version:100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Rss/composer.json b/app/code/Magento/Rss/composer.json
index 1a9d002a0e8c7..d72fcb300f9a8 100644
--- a/app/code/Magento/Rss/composer.json
+++ b/app/code/Magento/Rss/composer.json
@@ -9,7 +9,7 @@
"magento/module-customer": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Rule/composer.json b/app/code/Magento/Rule/composer.json
index 332972a0584c5..aa07c072d835f 100644
--- a/app/code/Magento/Rule/composer.json
+++ b/app/code/Magento/Rule/composer.json
@@ -11,7 +11,7 @@
"lib-libxml": "*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Sales/Helper/Guest.php b/app/code/Magento/Sales/Helper/Guest.php
index a69fa337b8da2..c5c755bda8d17 100644
--- a/app/code/Magento/Sales/Helper/Guest.php
+++ b/app/code/Magento/Sales/Helper/Guest.php
@@ -176,7 +176,7 @@ public function loadValidOrder(App\RequestInterface $request)
$errors = true;
if (!empty($protectCode) && !empty($incrementId)) {
$order->loadByIncrementId($incrementId);
- if ($order->getProtectCode() == $protectCode) {
+ if ($order->getProtectCode() === $protectCode) {
// renew cookie
$this->setGuestViewCookie($fromCookie);
$errors = false;
diff --git a/app/code/Magento/Sales/composer.json b/app/code/Magento/Sales/composer.json
index d7498fee8d008..1393f3c97945e 100644
--- a/app/code/Magento/Sales/composer.json
+++ b/app/code/Magento/Sales/composer.json
@@ -32,7 +32,7 @@
"magento/module-sales-sample-data": "Sample Data version:100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals/tax.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals/tax.phtml
old mode 100644
new mode 100755
index 3f156e6ceaa73..090800ded9969
--- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals/tax.phtml
+++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals/tax.phtml
@@ -6,7 +6,9 @@
// @codingStandardsIgnoreFile
+$taxAmount = $block->getTotal()->getValue();
?>
+helper('Magento\Tax\Helper\Data')->displayZeroTax()) || ($taxAmount > 0)): ?>
helper('Magento\Tax\Helper\Data')->displayFullSummary()): ?>
@@ -50,3 +52,5 @@
formatPrice($block->getTotal()->getValue()) ?> |
+
+
diff --git a/app/code/Magento/SalesRule/composer.json b/app/code/Magento/SalesRule/composer.json
index e68e40caa9dc3..4f3ab48370906 100644
--- a/app/code/Magento/SalesRule/composer.json
+++ b/app/code/Magento/SalesRule/composer.json
@@ -24,7 +24,7 @@
"magento/module-sales-rule-sample-data": "Sample Data version:100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/SalesSequence/composer.json b/app/code/Magento/SalesSequence/composer.json
index 0811c634806d4..052af2dbf80e9 100644
--- a/app/code/Magento/SalesSequence/composer.json
+++ b/app/code/Magento/SalesSequence/composer.json
@@ -6,7 +6,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/SampleData/Console/Command/SampleDataDeployCommand.php b/app/code/Magento/SampleData/Console/Command/SampleDataDeployCommand.php
index 8b3ca20ca09c9..6a8ada8a43693 100644
--- a/app/code/Magento/SampleData/Console/Command/SampleDataDeployCommand.php
+++ b/app/code/Magento/SampleData/Console/Command/SampleDataDeployCommand.php
@@ -80,7 +80,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$sampleDataPackages = $this->sampleDataDependency->getSampleDataPackages();
if (!empty($sampleDataPackages)) {
$baseDir = $this->filesystem->getDirectoryRead(DirectoryList::ROOT)->getAbsolutePath();
- $commonArgs = ['--working-dir' => $baseDir, '--no-interaction' => 1, '--no-progress' => 1];
+ $commonArgs = ['--working-dir' => $baseDir, '--no-progress' => 1];
$packages = [];
foreach ($sampleDataPackages as $name => $version) {
$packages[] = "$name:$version";
diff --git a/app/code/Magento/SampleData/composer.json b/app/code/Magento/SampleData/composer.json
index f0c9e5f1c8cf8..ef4dec9986329 100644
--- a/app/code/Magento/SampleData/composer.json
+++ b/app/code/Magento/SampleData/composer.json
@@ -9,7 +9,7 @@
"magento/sample-data-media": "Sample Data version:100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Search/Model/Query.php b/app/code/Magento/Search/Model/Query.php
index 894d8d69f3646..2819a6e2ec570 100644
--- a/app/code/Magento/Search/Model/Query.php
+++ b/app/code/Magento/Search/Model/Query.php
@@ -172,6 +172,12 @@ public function getSuggestCollection()
public function loadByQuery($text)
{
$this->_getResource()->loadByQuery($this, $text);
+
+ $synonymFor = $this->getSynonymFor();
+ if (!empty($synonymFor)) {
+ $this->setQueryText($synonymFor);
+ }
+
$this->_afterLoad();
$this->setOrigData();
return $this;
diff --git a/app/code/Magento/Search/composer.json b/app/code/Magento/Search/composer.json
index f5db805a6c73f..40aed4c2f9812 100644
--- a/app/code/Magento/Search/composer.json
+++ b/app/code/Magento/Search/composer.json
@@ -10,7 +10,7 @@
"magento/module-reports": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/SendFriend/composer.json b/app/code/Magento/SendFriend/composer.json
index f3196997756a6..fc05099798605 100644
--- a/app/code/Magento/SendFriend/composer.json
+++ b/app/code/Magento/SendFriend/composer.json
@@ -10,7 +10,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Shipping/composer.json b/app/code/Magento/Shipping/composer.json
index 820dfafb481a7..efa0eba88154f 100644
--- a/app/code/Magento/Shipping/composer.json
+++ b/app/code/Magento/Shipping/composer.json
@@ -24,7 +24,7 @@
"magento/module-ups": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Sitemap/composer.json b/app/code/Magento/Sitemap/composer.json
index ab6920d074de8..2e95995e63d28 100644
--- a/app/code/Magento/Sitemap/composer.json
+++ b/app/code/Magento/Sitemap/composer.json
@@ -13,7 +13,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Store/Model/Plugin/StoreCookie.php b/app/code/Magento/Store/Model/Plugin/StoreCookie.php
index cb4ec64e03a2f..b42e645799867 100644
--- a/app/code/Magento/Store/Model/Plugin/StoreCookie.php
+++ b/app/code/Magento/Store/Model/Plugin/StoreCookie.php
@@ -52,29 +52,25 @@ public function __construct(
* Delete cookie "store" if the store (a value in the cookie) does not exist or is inactive
*
* @param \Magento\Framework\App\FrontController $subject
- * @param callable $proceed
* @param \Magento\Framework\App\RequestInterface $request
- * @return mixed
+ * @return void
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
- public function aroundDispatch(
+ public function beforeDispatch(
\Magento\Framework\App\FrontController $subject,
- \Closure $proceed,
\Magento\Framework\App\RequestInterface $request
) {
- $defaultStore = $this->storeManager->getDefaultStoreView();
$storeCodeFromCookie = $this->storeCookieManager->getStoreCodeFromCookie();
if ($storeCodeFromCookie) {
try {
$this->storeRepository->getActiveStoreByCode($storeCodeFromCookie);
} catch (StoreIsInactiveException $e) {
- $this->storeCookieManager->deleteStoreCookie($defaultStore);
+ $this->storeCookieManager->deleteStoreCookie($this->storeManager->getDefaultStoreView());
} catch (NoSuchEntityException $e) {
- $this->storeCookieManager->deleteStoreCookie($defaultStore);
+ $this->storeCookieManager->deleteStoreCookie($this->storeManager->getDefaultStoreView());
} catch (InvalidArgumentException $e) {
- $this->storeCookieManager->deleteStoreCookie($defaultStore);
+ $this->storeCookieManager->deleteStoreCookie($this->storeManager->getDefaultStoreView());
}
}
- return $proceed($request);
}
}
diff --git a/app/code/Magento/Store/Model/StoreResolver.php b/app/code/Magento/Store/Model/StoreResolver.php
index f609e271ffd6c..b87a5aabf6f71 100644
--- a/app/code/Magento/Store/Model/StoreResolver.php
+++ b/app/code/Magento/Store/Model/StoreResolver.php
@@ -45,6 +45,11 @@ class StoreResolver implements \Magento\Store\Api\StoreResolverInterface
*/
protected $scopeCode;
+ /*
+ * @var \Magento\Framework\App\RequestInterface
+ */
+ protected $request;
+
/**
* @param \Magento\Store\Api\StoreRepositoryInterface $storeRepository
* @param StoreCookieManagerInterface $storeCookieManager
diff --git a/app/code/Magento/Store/Test/Unit/Model/Plugin/StoreCookieTest.php b/app/code/Magento/Store/Test/Unit/Model/Plugin/StoreCookieTest.php
index 3b2197494bef8..43a471fba9ffc 100644
--- a/app/code/Magento/Store/Test/Unit/Model/Plugin/StoreCookieTest.php
+++ b/app/code/Magento/Store/Test/Unit/Model/Plugin/StoreCookieTest.php
@@ -37,11 +37,6 @@ class StoreCookieTest extends \PHPUnit_Framework_TestCase
*/
protected $storeMock;
- /**
- * @var \Closure
- */
- protected $closureMock;
-
/**
* @var \Magento\Framework\App\FrontController|\PHPUnit_Framework_MockObject_MockObject
*/
@@ -77,10 +72,6 @@ public function setUp()
->setMethods([])
->getMock();
- $this->closureMock = function () {
- return 'ExpectedValue';
- };
-
$this->subjectMock = $this->getMockBuilder('Magento\Framework\App\FrontController')
->disableOriginalConstructor()
->setMethods([])
@@ -106,7 +97,7 @@ public function setUp()
);
}
- public function testAroundDispatchNoSuchEntity()
+ public function testBeforeDispatchNoSuchEntity()
{
$storeCode = 'store';
$this->storeManagerMock->expects($this->once())->method('getDefaultStoreView')->willReturn($this->storeMock);
@@ -115,13 +106,10 @@ public function testAroundDispatchNoSuchEntity()
->method('getActiveStoreByCode')
->willThrowException(new NoSuchEntityException);
$this->storeCookieManagerMock->expects($this->once())->method('deleteStoreCookie')->with($this->storeMock);
- $this->assertEquals(
- 'ExpectedValue',
- $this->plugin->aroundDispatch($this->subjectMock, $this->closureMock, $this->requestMock)
- );
+ $this->plugin->beforeDispatch($this->subjectMock, $this->requestMock);
}
- public function testAroundDispatchStoreIsInactive()
+ public function testBeforeDispatchStoreIsInactive()
{
$storeCode = 'store';
$this->storeManagerMock->expects($this->once())->method('getDefaultStoreView')->willReturn($this->storeMock);
@@ -130,13 +118,10 @@ public function testAroundDispatchStoreIsInactive()
->method('getActiveStoreByCode')
->willThrowException(new StoreIsInactiveException);
$this->storeCookieManagerMock->expects($this->once())->method('deleteStoreCookie')->with($this->storeMock);
- $this->assertEquals(
- 'ExpectedValue',
- $this->plugin->aroundDispatch($this->subjectMock, $this->closureMock, $this->requestMock)
- );
+ $this->plugin->beforeDispatch($this->subjectMock, $this->requestMock);
}
- public function testAroundDispatchInvalidArgument()
+ public function testBeforeDispatchInvalidArgument()
{
$storeCode = 'store';
$this->storeManagerMock->expects($this->once())->method('getDefaultStoreView')->willReturn($this->storeMock);
@@ -145,22 +130,16 @@ public function testAroundDispatchInvalidArgument()
->method('getActiveStoreByCode')
->willThrowException(new InvalidArgumentException);
$this->storeCookieManagerMock->expects($this->once())->method('deleteStoreCookie')->with($this->storeMock);
- $this->assertEquals(
- 'ExpectedValue',
- $this->plugin->aroundDispatch($this->subjectMock, $this->closureMock, $this->requestMock)
- );
+ $this->plugin->beforeDispatch($this->subjectMock, $this->requestMock);
}
- public function testAroundDispatchNoStoreCookie()
+ public function testBeforeDispatchNoStoreCookie()
{
$storeCode = null;
- $this->storeManagerMock->expects($this->once())->method('getDefaultStoreView')->willReturn($this->storeMock);
$this->storeCookieManagerMock->expects($this->once())->method('getStoreCodeFromCookie')->willReturn($storeCode);
+ $this->storeManagerMock->expects($this->never())->method('getDefaultStoreView')->willReturn($this->storeMock);
$this->storeRepositoryMock->expects($this->never())->method('getActiveStoreByCode');
$this->storeCookieManagerMock->expects($this->never())->method('deleteStoreCookie')->with($this->storeMock);
- $this->assertEquals(
- 'ExpectedValue',
- $this->plugin->aroundDispatch($this->subjectMock, $this->closureMock, $this->requestMock)
- );
+ $this->plugin->beforeDispatch($this->subjectMock, $this->requestMock);
}
}
diff --git a/app/code/Magento/Store/composer.json b/app/code/Magento/Store/composer.json
index 4771353c24e9c..d64f9698e7d4e 100644
--- a/app/code/Magento/Store/composer.json
+++ b/app/code/Magento/Store/composer.json
@@ -11,7 +11,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Store/etc/di.xml b/app/code/Magento/Store/etc/di.xml
index e0371cb29ff30..66db600c32d29 100644
--- a/app/code/Magento/Store/etc/di.xml
+++ b/app/code/Magento/Store/etc/di.xml
@@ -281,6 +281,11 @@
+
+
+ Magento\Store\Model\StoreManagerInterface\Proxy
+
+
Magento\Framework\App\Cache\Type\Config
diff --git a/app/code/Magento/Swagger/composer.json b/app/code/Magento/Swagger/composer.json
index 3035c19f9e9a8..c81451a296a71 100644
--- a/app/code/Magento/Swagger/composer.json
+++ b/app/code/Magento/Swagger/composer.json
@@ -6,7 +6,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Swatches/Block/Product/Renderer/Configurable.php b/app/code/Magento/Swatches/Block/Product/Renderer/Configurable.php
index 339ba7dc43419..09458db9085a8 100644
--- a/app/code/Magento/Swatches/Block/Product/Renderer/Configurable.php
+++ b/app/code/Magento/Swatches/Block/Product/Renderer/Configurable.php
@@ -119,7 +119,7 @@ public function __construct(
public function getJsonSwatchConfig()
{
$attributesData = $this->getSwatchAttributesData();
- $allOptionIds = $this->getAllOptionsIdsFromAttributeArray($attributesData);
+ $allOptionIds = $this->getConfigurableOptionsIds($attributesData);
$swatchesData = $this->swatchHelper->getSwatchesByOptionsId($allOptionIds);
$config = [];
@@ -209,9 +209,9 @@ protected function addSwatchDataForAttribute(
$result = [];
foreach ($options as $optionId => $label) {
if (isset($swatchesCollectionArray[$optionId])) {
- $result[$optionId]['label'] = $label;
$result[$optionId] = $this->extractNecessarySwatchData($swatchesCollectionArray[$optionId]);
$result[$optionId] = $this->addAdditionalMediaData($result[$optionId], $optionId, $attributeDataArray);
+ $result[$optionId]['label'] = $label;
}
}
@@ -278,7 +278,8 @@ protected function getVariationMedia($attributeCode, $optionId)
{
$variationProduct = $this->swatchHelper->loadFirstVariationWithSwatchImage(
$this->getProduct(),
- [$attributeCode => $optionId]
+ $attributeCode,
+ $optionId
);
$variationMediaArray = [];
@@ -325,15 +326,20 @@ protected function isProductHasImage(Product $product, $imageType)
* @param array $attributeData
* @return array
*/
- protected function getAllOptionsIdsFromAttributeArray(array $attributeData)
+ protected function getConfigurableOptionsIds(array $attributeData)
{
$ids = [];
- foreach ($attributeData as $item) {
- if (isset($item['options'])) {
- $ids = array_merge($ids, array_keys($item['options']));
+ foreach ($this->getAllowProducts() as $product) {
+ /** @var \Magento\ConfigurableProduct\Model\Product\Type\Configurable\Attribute $attribute */
+ foreach ($this->helper->getAllowAttributes($this->getProduct()) as $attribute) {
+ $productAttribute = $attribute->getProductAttribute();
+ $productAttributeId = $productAttribute->getId();
+ if (isset($attributeData[$productAttributeId])) {
+ $ids[$product->getData($productAttribute->getAttributeCode())] = 1;
+ }
}
}
- return $ids;
+ return array_keys($ids);
}
/**
diff --git a/app/code/Magento/Swatches/Helper/Data.php b/app/code/Magento/Swatches/Helper/Data.php
index aecd9db6cfab9..f2a8d15e667f3 100644
--- a/app/code/Magento/Swatches/Helper/Data.php
+++ b/app/code/Magento/Swatches/Helper/Data.php
@@ -155,30 +155,32 @@ public function populateAdditionalDataEavAttribute(Attribute $attribute)
/**
* @param \Magento\Catalog\Model\Product $product
- * @param array $attributes
- * @return bool|null
+ * @param string $attributeCode
+ * @param string|int $attributeValue
+ * @return \Magento\Catalog\Model\Product|null
* @throws InputException
*/
- public function loadFirstVariationWithSwatchImage($product, array $attributes)
+ public function loadFirstVariationWithSwatchImage($product, $attributeCode, $attributeValue)
{
$product = $this->createSwatchProduct($product);
if (!$product) {
- return false;
+ return null;
}
- $productCollection = $this->prepareVariationCollection($product, $attributes);
-
+ $products = $product->getTypeInstance()->getUsedProducts($product);
$variationProduct = null;
- foreach ($productCollection as $item) {
- $currentProduct = $this->productRepository->getById($item->getId());
- $media = $this->getProductMedia($currentProduct);
- if (! empty($media) && isset($media['swatch_image'])) {
- $variationProduct = $currentProduct;
+ foreach ($products as $item) {
+ if ($item->getData($attributeCode) != $attributeValue) {
+ continue;
+ }
+ $media = $this->getProductMedia($item);
+ if (!empty($media) && isset($media['swatch_image'])) {
+ $variationProduct = $item;
break;
}
if ($variationProduct !== false) {
if (! empty($media) && isset($media['image'])) {
- $variationProduct = $currentProduct;
+ $variationProduct = $item;
} else {
$variationProduct = false;
}
diff --git a/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/ConfigurableTest.php b/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/ConfigurableTest.php
index 2b3500f057f31..cb3183b0df95a 100644
--- a/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/ConfigurableTest.php
+++ b/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/ConfigurableTest.php
@@ -16,9 +16,6 @@ class ConfigurableTest extends \PHPUnit_Framework_TestCase
/** @var Configurable */
private $configurable;
- /** @var \Magento\Catalog\Block\Product\Context|\PHPUnit_Framework_MockObject_MockObject */
- private $context;
-
/** @var \Magento\Framework\Stdlib\ArrayUtils|\PHPUnit_Framework_MockObject_MockObject */
private $arrayUtils;
@@ -60,7 +57,6 @@ class ConfigurableTest extends \PHPUnit_Framework_TestCase
public function setUp()
{
- $this->context = $this->getMock('\Magento\Catalog\Block\Product\Context', [], [], '', false);
$this->arrayUtils = $this->getMock('\Magento\Framework\Stdlib\ArrayUtils', [], [], '', false);
$this->jsonEncoder = $this->getMock('\Magento\Framework\Json\EncoderInterface', [], [], '', false);
$this->helper = $this->getMock('\Magento\ConfigurableProduct\Helper\Data', [], [], '', false);
@@ -75,15 +71,13 @@ public function setUp()
$this->imageHelper = $this->getMock('\Magento\Catalog\Helper\Image', [], [], '', false);
$this->urlBuilder = $this->getMock('\Magento\Framework\UrlInterface');
- $this->context->expects($this->any())->method('getScopeConfig')->willReturn($this->scopeConfig);
- $this->context->expects($this->any())->method('getImageHelper')->willReturn($this->imageHelper);
- $this->context->expects($this->any())->method('getUrlBuilder')->willReturn($this->urlBuilder);
-
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
$this->configurable = $objectManager->getObject(
'\Magento\Swatches\Block\Product\Renderer\Configurable',
[
- 'context' => $this->context,
+ 'scopeConfig' => $this->scopeConfig,
+ 'imageHelper' => $this->imageHelper,
+ 'urlBuilder' => $this->urlBuilder,
'arrayUtils' => $this->arrayUtils,
'jsonEncoder' => $this->jsonEncoder,
'helper' => $this->helper,
@@ -92,7 +86,6 @@ public function setUp()
'catalogProduct' => $this->catalogProduct,
'currentCustomer' => $this->currentCustomer,
'priceCurrency' => $this->priceCurrency,
- 'data' => [],
]
);
}
@@ -146,8 +139,48 @@ public function testSetIsProductListingContext()
);
}
+ private function prepareGetJsonSwatchConfig()
+ {
+ $product1 = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
+ $product1->expects($this->atLeastOnce())->method('isSaleable')->willReturn(true);
+ $product1->expects($this->atLeastOnce())->method('getData')->with('code')->willReturn(1);
+
+ $product2 = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
+ $product2->expects($this->atLeastOnce())->method('isSaleable')->willReturn(true);
+ $product2->expects($this->atLeastOnce())->method('getData')->with('code')->willReturn(3);
+
+ $simpleProducts = [$product1, $product2];
+ $configurableType = $this->getMock(
+ '\Magento\ConfigurableProduct\Model\Product\Type\Configurable',
+ [],
+ [],
+ '',
+ false
+ );
+ $configurableType->expects($this->atLeastOnce())->method('getUsedProducts')->with($this->product, null)
+ ->willReturn($simpleProducts);
+ $this->product->expects($this->any())->method('getTypeInstance')->willReturn($configurableType);
+
+ $productAttribute1 = $this->getMock('\Magento\Eav\Model\Entity\Attribute\AbstractAttribute', [], [], '', false);
+ $productAttribute1->expects($this->any())->method('getId')->willReturn(1);
+ $productAttribute1->expects($this->any())->method('getAttributeCode')->willReturn('code');
+
+ $attribute1 = $this->getMock(
+ '\Magento\ConfigurableProduct\Model\Product\Type\Configurable\Attribute',
+ ['getProductAttribute'],
+ [],
+ '',
+ false
+ );
+ $attribute1->expects($this->any())->method('getProductAttribute')->willReturn($productAttribute1);
+
+ $this->helper->expects($this->any())->method('getAllowAttributes')->with($this->product)
+ ->willReturn([$attribute1]);
+ }
+
public function testGetJsonSwatchConfigNotVisualImageType()
{
+ $this->prepareGetJsonSwatchConfig();
$this->configurable->setProduct($this->product);
$this->swatchHelper->expects($this->once())->method('getSwatchAttributesAsArray')
@@ -167,7 +200,7 @@ public function testGetJsonSwatchConfigNotVisualImageType()
]);
$this->swatchHelper->expects($this->once())->method('loadFirstVariationWithSwatchImage')
- ->with($this->product, ['code' => 3])
+ ->with($this->product, 'code', 3)
->willReturn($this->product);
$this->product->expects($this->exactly(4))->method('getData')
@@ -187,6 +220,7 @@ public function testGetJsonSwatchConfigNotVisualImageType()
public function testGetJsonSwatchConfigVisualImageType()
{
+ $this->prepareGetJsonSwatchConfig();
$this->configurable->setProduct($this->product);
$this->swatchHelper->expects($this->once())->method('getSwatchAttributesAsArray')
@@ -206,7 +240,7 @@ public function testGetJsonSwatchConfigVisualImageType()
]);
$this->swatchHelper->expects($this->once())->method('loadFirstVariationWithSwatchImage')
- ->with($this->product, ['code' => 3])
+ ->with($this->product, 'code', 3)
->willReturn($this->product);
$this->swatchMediaHelper->expects($this->exactly(2))->method('getSwatchAttributeImage')
@@ -233,6 +267,8 @@ public function testGetJsonSwatchConfigVisualImageType()
public function testGetJsonSwatchConfigWithoutVisualImageType()
{
+ $this->prepareGetJsonSwatchConfig();
+
$this->configurable->setProduct($this->product);
$this->swatchHelper->expects($this->once())->method('getSwatchAttributesAsArray')
@@ -252,7 +288,7 @@ public function testGetJsonSwatchConfigWithoutVisualImageType()
]);
$this->swatchHelper->expects($this->once())->method('loadFirstVariationWithSwatchImage')
- ->with($this->product, ['code' => 3])
+ ->with($this->product, 'code', 3)
->willReturn($this->product);
$this->swatchMediaHelper->expects($this->exactly(2))->method('getSwatchAttributeImage')
diff --git a/app/code/Magento/Swatches/Test/Unit/Helper/DataTest.php b/app/code/Magento/Swatches/Test/Unit/Helper/DataTest.php
index 31e868cdf4ca9..c74a9b672f8ad 100644
--- a/app/code/Magento/Swatches/Test/Unit/Helper/DataTest.php
+++ b/app/code/Magento/Swatches/Test/Unit/Helper/DataTest.php
@@ -213,24 +213,21 @@ public function testLoadFirstVariationWithSwatchImage($product, $typesArray)
$this->prepareVariationCollection();
$this->productMock->method('getId')->willReturn(95);
- $this->productRepoMock->expects($this->atLeastOnce())->method('getById')->with(95)->willReturn(
- $this->productMock
- );
$this->getProductMedia($typesArray);
- $this->swatchHelperObject->loadFirstVariationWithSwatchImage($this->productMock, ['color' => 31]);
+ $this->swatchHelperObject->loadFirstVariationWithSwatchImage($this->productMock, 'color', 31);
}
public function testLoadFirstVariationWithSwatchImageWithException()
{
$this->setExpectedException('\Magento\Framework\Exception\InputException');
- $this->swatchHelperObject->loadFirstVariationWithSwatchImage(null, ['color' => 31]);
+ $this->swatchHelperObject->loadFirstVariationWithSwatchImage(null, 'color', 31);
}
public function testLoadFirstVariationWithSwatchImageWithoutProduct()
{
- $this->swatchHelperObject->loadFirstVariationWithSwatchImage($this->productMock, ['color' => 31]);
+ $this->swatchHelperObject->loadFirstVariationWithSwatchImage($this->productMock, 'color', 31);
}
/**
@@ -394,7 +391,7 @@ protected function createSwatchProduct($product)
{
if (gettype($product) == 'integer') {
$this->productRepoMock
- ->expects($this->once())
+ ->expects($this->any())
->method('getById')
->with(95)
->willReturn($this->productMock);
@@ -411,6 +408,16 @@ protected function getSwatchAttributes()
protected function getAttributesFromConfigurable()
{
+ $product1 = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
+ $product1->expects($this->any())->method('isSaleable')->willReturn(true);
+ $product1->expects($this->any())->method('getData')->with('color')->willReturn(1);
+
+ $product2 = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
+ $product2->expects($this->any())->method('isSaleable')->willReturn(true);
+ $product2->expects($this->any())->method('getData')->with('color')->willReturn(3);
+
+ $simpleProducts = [$product1, $product2];
+
$configurable = $this->getMock(
'\Magento\ConfigurableProduct\Model\Product\Type\Configurable',
[],
@@ -433,13 +440,16 @@ protected function getAttributesFromConfigurable()
);
$configurable
- ->expects($this->atLeastOnce())
+ ->expects($this->any())
->method('getConfigurableAttributes')
->with($this->productMock)
->willReturn([$confAttribute, $confAttribute]);
+ $configurable->expects($this->any())->method('getUsedProducts')->with($this->productMock)
+ ->willReturn($simpleProducts);
+
$confAttribute
- ->expects($this->atLeastOnce())
+ ->expects($this->any())
->method('__call')
->with('getProductAttribute')
->willReturn($this->attributeMock);
@@ -448,7 +458,7 @@ protected function getAttributesFromConfigurable()
protected function prepareVariationCollection()
{
$this->productCollectionFactoryMock
- ->expects($this->once())
+ ->expects($this->any())
->method('create')
->willReturn($this->productCollectionMock);
diff --git a/app/code/Magento/Swatches/composer.json b/app/code/Magento/Swatches/composer.json
index f965f819f867e..0f5ec4a0858a6 100644
--- a/app/code/Magento/Swatches/composer.json
+++ b/app/code/Magento/Swatches/composer.json
@@ -19,7 +19,7 @@
"magento/module-swatches-sample-data": "Sample Data version:100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"proprietary"
],
diff --git a/app/code/Magento/Swatches/view/frontend/templates/product/listing/renderer.phtml b/app/code/Magento/Swatches/view/frontend/templates/product/listing/renderer.phtml
index 95d030ddfa392..db350ca98a7aa 100644
--- a/app/code/Magento/Swatches/view/frontend/templates/product/listing/renderer.phtml
+++ b/app/code/Magento/Swatches/view/frontend/templates/product/listing/renderer.phtml
@@ -13,8 +13,8 @@
onlySwatches: true,
enableControlLabel: false,
numberToShow: getNumberSwatchesPerProduct(); ?>,
- jsonConfig: getJsonConfig(); ?>,
- jsonSwatchConfig: getJsonSwatchConfig(); ?>,
+ jsonConfig: getJsonConfig(); ?>,
+ jsonSwatchConfig: getJsonSwatchConfig(); ?>,
mediaCallback: 'getMediaCallback() ?>'
});
});
diff --git a/app/code/Magento/Tax/Model/Quote/GrandTotalDetailsPlugin.php b/app/code/Magento/Tax/Model/Quote/GrandTotalDetailsPlugin.php
index 9f52085e7d839..14a0fc425ee9b 100644
--- a/app/code/Magento/Tax/Model/Quote/GrandTotalDetailsPlugin.php
+++ b/app/code/Magento/Tax/Model/Quote/GrandTotalDetailsPlugin.php
@@ -75,6 +75,7 @@ protected function getRatesData($rates)
* @param \Magento\Quote\Model\Quote\Address\Total[] $addressTotals
* @return \Magento\Quote\Api\Data\TotalSegmentInterface[]
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function aroundProcess(
\Magento\Quote\Model\Cart\TotalsConverter $subject,
@@ -94,7 +95,11 @@ public function aroundProcess(
$detailsId = 1;
$finalData = [];
- foreach (unserialize($taxes['full_info']) as $info) {
+ $fullInfo = $taxes['full_info'];
+ if (is_string($fullInfo)) {
+ $fullInfo = unserialize($fullInfo);
+ }
+ foreach ($fullInfo as $info) {
if ((array_key_exists('hidden', $info) && $info['hidden'])
|| ($info['amount'] == 0 && $this->taxConfig->displayCartZeroTax())
) {
diff --git a/app/code/Magento/Tax/Model/Sales/Total/Quote/Tax.php b/app/code/Magento/Tax/Model/Sales/Total/Quote/Tax.php
old mode 100644
new mode 100755
index 34562754e0893..19fbc9747f161
--- a/app/code/Magento/Tax/Model/Sales/Total/Quote/Tax.php
+++ b/app/code/Magento/Tax/Model/Sales/Total/Quote/Tax.php
@@ -299,6 +299,9 @@ public function fetch(\Magento\Quote\Model\Quote $quote, \Magento\Quote\Model\Qu
$totals = [];
$store = $quote->getStore();
$applied = $total->getAppliedTaxes();
+ if (is_string($applied)) {
+ $applied = unserialize($applied);
+ }
$amount = $total->getTaxAmount();
if ($amount == null) {
$this->enhanceTotalData($quote, $total);
@@ -311,15 +314,13 @@ public function fetch(\Magento\Quote\Model\Quote $quote, \Magento\Quote\Model\Qu
$area = 'taxes';
}
- if ($amount != 0 || $this->_config->displayCartZeroTax($store)) {
- $totals[] = [
- 'code' => $this->getCode(),
- 'title' => __('Tax'),
- 'full_info' => $applied ? $applied : [],
- 'value' => $amount,
- 'area' => $area,
- ];
- }
+ $totals[] = [
+ 'code' => $this->getCode(),
+ 'title' => __('Tax'),
+ 'full_info' => $applied ? $applied : [],
+ 'value' => $amount,
+ 'area' => $area,
+ ];
/**
* Modify subtotal
diff --git a/app/code/Magento/Tax/Test/Unit/Model/Quote/GrandTotalDetailsPluginTest.php b/app/code/Magento/Tax/Test/Unit/Model/Quote/GrandTotalDetailsPluginTest.php
new file mode 100644
index 0000000000000..1870806dd4262
--- /dev/null
+++ b/app/code/Magento/Tax/Test/Unit/Model/Quote/GrandTotalDetailsPluginTest.php
@@ -0,0 +1,216 @@
+subjectMock = $this->getMockBuilder('\Magento\Quote\Model\Cart\TotalsConverter')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->totalSegmentExtensionFactoryMock = $this->getMockBuilder(
+ '\Magento\Quote\Api\Data\TotalSegmentExtensionFactory'
+ )->disableOriginalConstructor()
+ ->getMock();
+
+ $this->detailsFactoryMock = $this->getMockBuilder('\Magento\Tax\Api\Data\GrandTotalDetailsInterfaceFactory')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->ratesFactoryMock = $this->getMockBuilder('\Magento\Tax\Api\Data\GrandTotalRatesInterfaceFactory')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->taxConfigMock = $this->getMockBuilder('\Magento\Tax\Model\Config')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->objectManagerHelper = new ObjectManager($this);
+ $this->model = $this->objectManagerHelper->getObject(
+ '\Magento\Tax\Model\Quote\GrandTotalDetailsPlugin',
+ [
+ 'totalSegmentExtensionFactory' => $this->totalSegmentExtensionFactoryMock,
+ 'ratesFactory' => $this->ratesFactoryMock,
+ 'detailsFactory' => $this->detailsFactoryMock,
+ 'taxConfig' => $this->taxConfigMock,
+ ]
+ );
+ }
+
+ protected function setupTaxTotal(array $data)
+ {
+ $taxTotalMock = $this->getMockBuilder('\Magento\Quote\Model\Quote\Address\Total')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $taxTotalMock->expects($this->any())
+ ->method('getData')
+ ->willReturn($data);
+
+ return $taxTotalMock;
+ }
+
+ protected function setupTaxRateFactoryMock(array $taxRate)
+ {
+ $taxRateMock = $this->getMockBuilder('\Magento\Tax\Api\Data\GrandTotalRatesInterface')
+ ->getMock();
+
+ $this->ratesFactoryMock->expects($this->once())
+ ->method('create')
+ ->with([])
+ ->willReturn($taxRateMock);
+
+ $taxRateMock->expects($this->once())
+ ->method('setPercent')
+ ->with($taxRate['percent'])
+ ->willReturnSelf();
+ $taxRateMock->expects($this->once())
+ ->method('setTitle')
+ ->with($taxRate['title'])
+ ->willReturnSelf();
+ return $taxRateMock;
+ }
+
+ protected function setupTaxDetails(array $taxDetails)
+ {
+ $taxDetailsMock = $this->getMockBuilder('\Magento\Tax\Api\Data\GrandTotalDetailsInterface')
+ ->getMock();
+
+ $this->detailsFactoryMock->expects($this->once())
+ ->method('create')
+ ->willReturn($taxDetailsMock);
+
+ $taxDetailsMock->expects($this->once())
+ ->method('setAmount')
+ ->with($taxDetails['amount'])
+ ->willReturnSelf();
+
+ $taxDetailsMock->expects($this->once())
+ ->method('setRates')
+ ->with($taxDetails['rates'])
+ ->willReturnSelf();
+
+ $taxDetailsMock->expects($this->once())
+ ->method('setGroupId')
+ ->with(1)
+ ->willReturnSelf();
+
+ return $taxDetailsMock;
+ }
+
+ public function testAroundProcess()
+ {
+ $taxRate = [
+ 'percent' => 8.25,
+ 'title' => 'TX',
+ ];
+ $taxAmount = 10;
+
+
+ $taxRateMock = $this->setupTaxRateFactoryMock($taxRate);
+
+ $taxDetailsMock = $this->setupTaxDetails(
+ [
+ 'amount' => $taxAmount,
+ 'rates' => [$taxRateMock],
+ ]
+ );
+
+ $taxTotalData = [
+ 'full_info' => [
+ [
+ 'amount' => $taxAmount,
+ 'rates' => [$taxRate],
+ ],
+ ],
+ ];
+ $taxTotalMock = $this->setupTaxTotal($taxTotalData);
+ $addressTotals = [
+ 'tax' => $taxTotalMock,
+ ];
+
+ $extensionAttributeMock = $this->getMockBuilder(
+ '\Magento\Quote\Api\Data\TotalSegmentExtensionInterface'
+ )->setMethods(
+ [
+ 'setTaxGrandtotalDetails',
+
+ ]
+ )->getMockForAbstractClass();
+ $extensionAttributeMock->expects($this->once())
+ ->method('setTaxGrandtotalDetails')
+ ->with([$taxDetailsMock])
+ ->willReturnSelf();
+
+
+ $taxSegmentMock = $this->getMockBuilder('\Magento\Quote\Model\Cart\TotalSegment')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $taxSegmentMock->expects($this->once())
+ ->method('getExtensionAttributes')
+ ->willReturn($extensionAttributeMock);
+ $taxSegmentMock->expects($this->once())
+ ->method('setExtensionAttributes')
+ ->with($extensionAttributeMock)
+ ->willReturnSelf();
+
+ $totalSegments = [
+ 'tax' => $taxSegmentMock,
+ ];
+
+ $this->closureMock = function () use ($totalSegments) {
+ return $totalSegments;
+ };
+
+ $result = $this->model->aroundProcess($this->subjectMock, $this->closureMock, $addressTotals);
+ $this->assertEquals($totalSegments, $result);
+ }
+}
diff --git a/app/code/Magento/Tax/composer.json b/app/code/Magento/Tax/composer.json
index 26fb4a3742cd3..596d2f1f05d97 100644
--- a/app/code/Magento/Tax/composer.json
+++ b/app/code/Magento/Tax/composer.json
@@ -22,7 +22,7 @@
"magento/module-tax-sample-data": "Sample Data version:100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/TaxImportExport/composer.json b/app/code/Magento/TaxImportExport/composer.json
index b922509550d80..715d69d3eb340 100644
--- a/app/code/Magento/TaxImportExport/composer.json
+++ b/app/code/Magento/TaxImportExport/composer.json
@@ -10,7 +10,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Theme/composer.json b/app/code/Magento/Theme/composer.json
index af8cafcc66618..066a9c5a9715a 100644
--- a/app/code/Magento/Theme/composer.json
+++ b/app/code/Magento/Theme/composer.json
@@ -19,7 +19,7 @@
"magento/module-theme-sample-data": "Sample Data version:100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Theme/view/frontend/layout/default.xml b/app/code/Magento/Theme/view/frontend/layout/default.xml
index e34fc0ad52988..abcfc0905f650 100644
--- a/app/code/Magento/Theme/view/frontend/layout/default.xml
+++ b/app/code/Magento/Theme/view/frontend/layout/default.xml
@@ -8,6 +8,7 @@
+
diff --git a/app/code/Magento/Theme/view/frontend/templates/page/js/require_js.phtml b/app/code/Magento/Theme/view/frontend/templates/page/js/require_js.phtml
new file mode 100644
index 0000000000000..7928160420a79
--- /dev/null
+++ b/app/code/Magento/Theme/view/frontend/templates/page/js/require_js.phtml
@@ -0,0 +1,11 @@
+
+
diff --git a/app/code/Magento/Translation/composer.json b/app/code/Magento/Translation/composer.json
index 518f679c2157c..72c61363ac540 100644
--- a/app/code/Magento/Translation/composer.json
+++ b/app/code/Magento/Translation/composer.json
@@ -10,7 +10,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Ui/Component/Form.php b/app/code/Magento/Ui/Component/Form.php
index 24f4f5ed60436..41088748c0fd7 100644
--- a/app/code/Magento/Ui/Component/Form.php
+++ b/app/code/Magento/Ui/Component/Form.php
@@ -53,21 +53,22 @@ public function getComponentName()
public function getDataSourceData()
{
$dataSource = [];
- $id = $this->getContext()->getRequestParam($this->getContext()->getDataProvider()->getRequestFieldName());
+ $id = $this->getContext()->getRequestParam($this->getContext()->getDataProvider()->getRequestFieldName());
if ($id) {
$filter = $this->filterBuilder->setField($this->getContext()->getDataProvider()->getPrimaryFieldName())
->setValue($id)
->create();
$this->getContext()->getDataProvider()
->addFilter($filter);
- }
- $data = $this->getContext()->getDataProvider()->getData();
- if (isset($data[$id])) {
- $dataSource = [
- 'data' => $data[$id]
- ];
+ $data = $this->getContext()->getDataProvider()->getData();
+
+ if (isset($data[$id])) {
+ $dataSource = [
+ 'data' => $data[$id]
+ ];
+ }
}
return $dataSource;
diff --git a/app/code/Magento/Ui/Component/Form/Field.php b/app/code/Magento/Ui/Component/Form/Field.php
index d2ff377ae5bd4..c79b162b8cab0 100644
--- a/app/code/Magento/Ui/Component/Form/Field.php
+++ b/app/code/Magento/Ui/Component/Form/Field.php
@@ -71,7 +71,8 @@ public function prepare()
$formElement = $this->getData('config/formElement');
if (null === $formElement) {
throw new LocalizedException(__(
- 'The configuration parameter "formElement" is a required for "' . $this->getName() . '" field.'
+ 'The configuration parameter "formElement" is a required for "%1" field.',
+ $this->getName()
));
}
// Create of wrapped component
diff --git a/app/code/Magento/Ui/Component/Layout/Tabs.php b/app/code/Magento/Ui/Component/Layout/Tabs.php
index 34021f0d8782d..66ff8693add39 100644
--- a/app/code/Magento/Ui/Component/Layout/Tabs.php
+++ b/app/code/Magento/Ui/Component/Layout/Tabs.php
@@ -96,6 +96,7 @@ public function build(UiComponentInterface $component)
* @param string $componentType
* @return void
* @throws \Magento\Framework\Exception\LocalizedException
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
protected function addChildren(array &$topNode, UiComponentInterface $component, $componentType)
{
@@ -137,8 +138,8 @@ protected function addChildren(array &$topNode, UiComponentInterface $component,
'type' => 'collection',
'config' => [
'active' => 1,
- 'removeLabel' => __('Remove ' . $label),
- 'addLabel' => __('Add New ' . $label),
+ 'removeLabel' => __('Remove %1', $label),
+ 'addLabel' => __('Add New %1', $label),
'removeMessage' => $childComponent->getData('config/removeMessage'),
'itemTemplate' => 'item_template',
],
@@ -148,7 +149,7 @@ protected function addChildren(array &$topNode, UiComponentInterface $component,
'component' => 'Magento_Ui/js/form/components/collection/item',
'childType' => 'group',
'config' => [
- 'label' => __('New ' . $label),
+ 'label' => __('New %1', $label),
],
'children' => $childrenStructure
]
diff --git a/app/code/Magento/Ui/Test/Unit/Component/FormTest.php b/app/code/Magento/Ui/Test/Unit/Component/FormTest.php
new file mode 100644
index 0000000000000..b03c4ad72ffed
--- /dev/null
+++ b/app/code/Magento/Ui/Test/Unit/Component/FormTest.php
@@ -0,0 +1,208 @@
+contextMock = $this->getMockBuilder('Magento\Framework\View\Element\UiComponent\ContextInterface')
+ ->getMockForAbstractClass();
+ $this->filterBuilderMock = $this->getMockBuilder('Magento\Framework\Api\FilterBuilder')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->processorMock = $this->getMockBuilder('Magento\Framework\View\Element\UiComponent\Processor')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->contextMock->expects($this->any())
+ ->method('getProcessor')
+ ->willReturn($this->processorMock);
+
+ $this->processorMock->expects($this->once())
+ ->method('register');
+
+ $this->model = new Form(
+ $this->contextMock,
+ $this->filterBuilderMock
+ );
+ }
+
+ public function testGetComponentName()
+ {
+ $this->assertEquals(Form::NAME, $this->model->getComponentName());
+ }
+
+ public function testGetDataSourceData()
+ {
+ $requestFieldName = 'request_id';
+ $primaryFieldName = 'primary_id';
+ $fieldId = 44;
+ $row = ['key' => 'value'];
+ $data = [
+ $fieldId => $row,
+ ];
+ $dataSource = [
+ 'data' => $row,
+ ];
+
+ /** @var DataProviderInterface|\PHPUnit_Framework_MockObject_MockObject $dataProviderMock */
+ $dataProviderMock =
+ $this->getMockBuilder('Magento\Framework\View\Element\UiComponent\DataProvider\DataProviderInterface')
+ ->getMock();
+ $dataProviderMock->expects($this->once())
+ ->method('getRequestFieldName')
+ ->willReturn($requestFieldName);
+ $dataProviderMock->expects($this->once())
+ ->method('getPrimaryFieldName')
+ ->willReturn($primaryFieldName);
+
+ $this->contextMock->expects($this->any())
+ ->method('getDataProvider')
+ ->willReturn($dataProviderMock);
+ $this->contextMock->expects($this->once())
+ ->method('getRequestParam')
+ ->with($requestFieldName)
+ ->willReturn($fieldId);
+
+ /** @var Filter|\PHPUnit_Framework_MockObject_MockObject $filterMock */
+ $filterMock = $this->getMockBuilder('Magento\Framework\Api\Filter')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->filterBuilderMock->expects($this->once())
+ ->method('setField')
+ ->with($primaryFieldName)
+ ->willReturnSelf();
+ $this->filterBuilderMock->expects($this->once())
+ ->method('setValue')
+ ->with($fieldId)
+ ->willReturnSelf();
+ $this->filterBuilderMock->expects($this->once())
+ ->method('create')
+ ->willReturn($filterMock);
+
+ $dataProviderMock->expects($this->once())
+ ->method('addFilter')
+ ->with($filterMock);
+ $dataProviderMock->expects($this->once())
+ ->method('getData')
+ ->willReturn($data);
+
+ $this->assertEquals($dataSource, $this->model->getDataSourceData());
+ }
+
+ public function testGetDataSourceDataWithoutData()
+ {
+ $requestFieldName = 'request_id';
+ $primaryFieldName = 'primary_id';
+ $fieldId = 44;
+ $data = [];
+ $dataSource = [];
+
+ /** @var DataProviderInterface|\PHPUnit_Framework_MockObject_MockObject $dataProviderMock */
+ $dataProviderMock =
+ $this->getMockBuilder('Magento\Framework\View\Element\UiComponent\DataProvider\DataProviderInterface')
+ ->getMock();
+ $dataProviderMock->expects($this->once())
+ ->method('getRequestFieldName')
+ ->willReturn($requestFieldName);
+ $dataProviderMock->expects($this->once())
+ ->method('getPrimaryFieldName')
+ ->willReturn($primaryFieldName);
+
+ $this->contextMock->expects($this->any())
+ ->method('getDataProvider')
+ ->willReturn($dataProviderMock);
+ $this->contextMock->expects($this->once())
+ ->method('getRequestParam')
+ ->with($requestFieldName)
+ ->willReturn($fieldId);
+
+ /** @var Filter|\PHPUnit_Framework_MockObject_MockObject $filterMock */
+ $filterMock = $this->getMockBuilder('Magento\Framework\Api\Filter')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->filterBuilderMock->expects($this->once())
+ ->method('setField')
+ ->with($primaryFieldName)
+ ->willReturnSelf();
+ $this->filterBuilderMock->expects($this->once())
+ ->method('setValue')
+ ->with($fieldId)
+ ->willReturnSelf();
+ $this->filterBuilderMock->expects($this->once())
+ ->method('create')
+ ->willReturn($filterMock);
+
+ $dataProviderMock->expects($this->once())
+ ->method('addFilter')
+ ->with($filterMock);
+ $dataProviderMock->expects($this->once())
+ ->method('getData')
+ ->willReturn($data);
+
+ $this->assertEquals($dataSource, $this->model->getDataSourceData());
+ }
+
+ public function testGetDataSourceDataWithoutId()
+ {
+ $requestFieldName = 'request_id';
+ $dataSource = [];
+
+ /** @var DataProviderInterface|\PHPUnit_Framework_MockObject_MockObject $dataProviderMock */
+ $dataProviderMock =
+ $this->getMockBuilder('Magento\Framework\View\Element\UiComponent\DataProvider\DataProviderInterface')
+ ->getMock();
+ $dataProviderMock->expects($this->once())
+ ->method('getRequestFieldName')
+ ->willReturn($requestFieldName);
+ $dataProviderMock->expects($this->never())
+ ->method('getPrimaryFieldName');
+
+ $this->contextMock->expects($this->any())
+ ->method('getDataProvider')
+ ->willReturn($dataProviderMock);
+ $this->contextMock->expects($this->once())
+ ->method('getRequestParam')
+ ->with($requestFieldName)
+ ->willReturn(null);
+
+ $this->filterBuilderMock->expects($this->never())
+ ->method('setField');
+ $this->filterBuilderMock->expects($this->never())
+ ->method('setValue');
+ $this->filterBuilderMock->expects($this->never())
+ ->method('create');
+
+ $dataProviderMock->expects($this->never())
+ ->method('addFilter');
+ $dataProviderMock->expects($this->never())
+ ->method('getData');
+
+ $this->assertEquals($dataSource, $this->model->getDataSourceData());
+ }
+}
diff --git a/app/code/Magento/Ui/composer.json b/app/code/Magento/Ui/composer.json
index 22b89b8eab609..17808fd1fd9b4 100644
--- a/app/code/Magento/Ui/composer.json
+++ b/app/code/Magento/Ui/composer.json
@@ -10,7 +10,7 @@
"magento/module-user": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/onoff.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/onoff.js
index 3d82b6667645e..4b553467517ba 100755
--- a/app/code/Magento/Ui/view/base/web/js/grid/columns/onoff.js
+++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/onoff.js
@@ -41,14 +41,38 @@ define([
*/
setDefaultSelections: function () {
var positionCacheValid = registry.get('position_cache_valid'),
+ selectedFromCache = registry.get('selected_cache'),
key,
i;
- registry.set('position_cache_valid', true);
+ if (positionCacheValid && this.selected().length === 0) {
+ // Check selected data
+ selectedFromCache = JSON.parse(selectedFromCache);
+
+ for (i = 0; i < selectedFromCache.length; i++) {
+ this.selected.push(selectedFromCache[i]);
+ }
+
+ registry.set('position_cache_valid', true);
+ registry.set('selected_cache', JSON.stringify(this.selected()));
- if (this.selectedData.length === 0 || positionCacheValid) {
return;
}
+
+ if (positionCacheValid && this.selected().length > 0) {
+ registry.set('position_cache_valid', true);
+ registry.set('selected_cache', JSON.stringify(this.selected()));
+
+ return;
+ }
+
+ if (this.selectedData.length === 0) {
+ registry.set('position_cache_valid', true);
+ registry.set('selected_cache', JSON.stringify([]));
+
+ return;
+ }
+
// Check selected data
for (key in this.selectedData) {
if (this.selectedData.hasOwnProperty(key) && this.selected().indexOf(key) === -1) {
@@ -61,6 +85,8 @@ define([
this.selectedData.hasOwnProperty(key) || this.selected.splice(this.selected().indexOf(key), 1);
this.selectedData.hasOwnProperty(key) || i--;
}
+ registry.set('position_cache_valid', true);
+ registry.set('selected_cache', JSON.stringify(this.selected()));
},
/**
@@ -91,12 +117,18 @@ define([
* @returns {Object} Chainable.
*/
updateState: function () {
- var totalRecords = this.totalRecords(),
+ var positionCacheValid = registry.get('position_cache_valid'),
+ totalRecords = this.totalRecords(),
selected = this.selected().length,
excluded = this.excluded().length,
totalSelected = this.totalSelected(),
allSelected;
+ if (positionCacheValid && this.selected().length > 0) {
+ registry.set('position_cache_valid', true);
+ registry.set('selected_cache', JSON.stringify(this.selected()));
+ }
+
// When filters are enabled then totalRecords is unknown
if (this.getFiltering()) {
if (this.getFiltering().search !== '') {
diff --git a/app/code/Magento/Ups/composer.json b/app/code/Magento/Ups/composer.json
index 2d513330992d3..7bcdf39aff8d9 100644
--- a/app/code/Magento/Ups/composer.json
+++ b/app/code/Magento/Ups/composer.json
@@ -13,7 +13,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/UrlRewrite/composer.json b/app/code/Magento/UrlRewrite/composer.json
index 44256246568f4..65009660d2195 100644
--- a/app/code/Magento/UrlRewrite/composer.json
+++ b/app/code/Magento/UrlRewrite/composer.json
@@ -12,7 +12,7 @@
"magento/module-cms-url-rewrite": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/User/Model/ResourceModel/User.php b/app/code/Magento/User/Model/ResourceModel/User.php
index 1c87be70f24ef..6f782c75f3108 100644
--- a/app/code/Magento/User/Model/ResourceModel/User.php
+++ b/app/code/Magento/User/Model/ResourceModel/User.php
@@ -539,7 +539,7 @@ public function getOldPasswords($user, $retainLimit = 4)
$userId = (int)$user->getId();
$table = $this->getTable('admin_passwords');
- // purge expired passwords, except that should retain
+ // purge expired passwords, except those which should be retained
$retainPasswordIds = $this->getConnection()->fetchCol(
$this->getConnection()
->select()
@@ -556,7 +556,7 @@ public function getOldPasswords($user, $retainLimit = 4)
}
$this->getConnection()->delete($table, $where);
- // now get all remained passwords
+ // get all remaining passwords
return $this->getConnection()->fetchCol(
$this->getConnection()
->select()
diff --git a/app/code/Magento/User/Model/User.php b/app/code/Magento/User/Model/User.php
index b9573b4f76e30..c5d38e8b98e25 100644
--- a/app/code/Magento/User/Model/User.php
+++ b/app/code/Magento/User/Model/User.php
@@ -256,9 +256,9 @@ protected function _getValidationRulesBeforeSave()
}
/**
- * Validate customer attribute values.
- * For existing customer password + confirmation will be validated only when password is set
- * (i.e. its change is requested)
+ * Validate admin user data.
+ *
+ * Existing user password confirmation will be validated only when password is set
*
* @return bool|string[]
*/
@@ -272,8 +272,35 @@ public function validate()
return $validator->getMessages();
}
- return true;
+ return $this->validatePasswordChange();
+ }
+
+ /**
+ * Make sure admin password was changed.
+ *
+ * New password is compared to at least 4 previous passwords to prevent setting them again
+ *
+ * @return bool|string[]
+ */
+ protected function validatePasswordChange()
+ {
+ $password = $this->getPassword();
+ if ($password && !$this->getForceNewPassword() && $this->getId()) {
+ $errorMessage = __('Sorry, but this password has already been used. Please create another.');
+ // Check if password is equal to the current one
+ if ($this->_encryptor->isValidHash($password, $this->getOrigData('password'))) {
+ return [$errorMessage];
+ }
+ // Check whether password was used before
+ $passwordHash = $this->_encryptor->getHash($password, false);
+ foreach ($this->getResource()->getOldPasswords($this) as $oldPasswordHash) {
+ if ($passwordHash === $oldPasswordHash) {
+ return [$errorMessage];
+ }
+ }
+ }
+ return true;
}
/**
diff --git a/app/code/Magento/User/Observer/Backend/CheckAdminPasswordChangeObserver.php b/app/code/Magento/User/Observer/Backend/CheckAdminPasswordChangeObserver.php
deleted file mode 100644
index 3bf06a441e248..0000000000000
--- a/app/code/Magento/User/Observer/Backend/CheckAdminPasswordChangeObserver.php
+++ /dev/null
@@ -1,82 +0,0 @@
-userResource = $userResource;
- $this->encryptor = $encryptor;
- }
-
- /**
- * Harden admin password change.
- *
- * New password must be minimum 7 chars length and include alphanumeric characters
- * The password is compared to at least last 4 previous passwords to prevent setting them again
- *
- * @param EventObserver $observer
- * @return void
- * @throws \Magento\Framework\Exception\LocalizedException
- */
- public function execute(EventObserver $observer)
- {
- /* @var $user \Magento\User\Model\User */
- $user = $observer->getEvent()->getObject();
-
- if ($user->getNewPassword()) {
- $password = $user->getNewPassword();
- } else {
- $password = $user->getPassword();
- }
-
- if ($password && !$user->getForceNewPassword() && $user->getId()) {
- if ($this->encryptor->isValidHash($password, $user->getOrigData('password'))) {
- throw new \Magento\Framework\Exception\LocalizedException(
- __('Sorry, but this password has already been used. Please create another.')
- );
- }
-
- // check whether password was used before
- $passwordHash = $this->encryptor->getHash($password, false);
- foreach ($this->userResource->getOldPasswords($user) as $oldPasswordHash) {
- if ($passwordHash === $oldPasswordHash) {
- throw new \Magento\Framework\Exception\LocalizedException(
- __('Sorry, but this password has already been used. Please create another.')
- );
- }
- }
- }
- }
-}
diff --git a/app/code/Magento/User/Observer/Backend/TrackAdminNewPasswordObserver.php b/app/code/Magento/User/Observer/Backend/TrackAdminNewPasswordObserver.php
index 790d78301f058..0f33107ac0173 100644
--- a/app/code/Magento/User/Observer/Backend/TrackAdminNewPasswordObserver.php
+++ b/app/code/Magento/User/Observer/Backend/TrackAdminNewPasswordObserver.php
@@ -71,7 +71,7 @@ public function __construct(
}
/**
- * Save new admin password
+ * Save current admin password to prevent its usage when changed in the future.
*
* @param EventObserver $observer
* @return void
@@ -81,7 +81,7 @@ public function execute(EventObserver $observer)
/* @var $user \Magento\User\Model\User */
$user = $observer->getEvent()->getObject();
if ($user->getId()) {
- $password = $user->getNewPassword();
+ $password = $user->getCurrentPassword();
$passwordLifetime = $this->observerConfig->getAdminPasswordLifetime();
if ($passwordLifetime && $password && !$user->getForceNewPassword()) {
$passwordHash = $this->encryptor->getHash($password, false);
diff --git a/app/code/Magento/User/Test/Unit/Model/UserTest.php b/app/code/Magento/User/Test/Unit/Model/UserTest.php
index ed495d41e369d..d2f89414527de 100644
--- a/app/code/Magento/User/Test/Unit/Model/UserTest.php
+++ b/app/code/Magento/User/Test/Unit/Model/UserTest.php
@@ -610,4 +610,104 @@ public function testIsResetPasswordLinkTokenExpiredIsNotExpiredToken()
$this->userDataMock->expects($this->once())->method('getResetPasswordLinkExpirationPeriod')->willReturn(1);
$this->assertFalse($this->model->isResetPasswordLinkTokenExpired());
}
+
+ public function testCheckPasswordChangeEqualToCurrent()
+ {
+ /** @var $validatorMock \Magento\Framework\Validator\DataObject|\PHPUnit_Framework_MockObject_MockObject */
+ $validatorMock = $this->getMockBuilder('Magento\Framework\Validator\DataObject')
+ ->disableOriginalConstructor()
+ ->setMethods([])
+ ->getMock();
+ $this->validatorObjectFactoryMock->expects($this->once())->method('create')->willReturn($validatorMock);
+ $this->validationRulesMock->expects($this->once())
+ ->method('addUserInfoRules')
+ ->with($validatorMock);
+ $validatorMock->expects($this->once())->method('isValid')->willReturn(true);
+
+ $newPassword = "NEWmYn3wpassw0rd";
+ $oldPassword = "OLDmYn3wpassw0rd";
+ $this->model->setPassword($newPassword)
+ ->setId(1)
+ ->setOrigData('password', $oldPassword);
+ $this->encryptorMock->expects($this->once())
+ ->method('isValidHash')
+ ->with($newPassword, $oldPassword)
+ ->willReturn(true);
+ $result = $this->model->validate();
+ $this->assertInternalType('array', $result);
+ $this->assertCount(1, $result);
+ $this->assertContains("Sorry, but this password has already been used.", (string)$result[0]);
+ }
+
+ public function testCheckPasswordChangeEqualToPrevious()
+ {
+ /** @var $validatorMock \Magento\Framework\Validator\DataObject|\PHPUnit_Framework_MockObject_MockObject */
+ $validatorMock = $this->getMockBuilder('Magento\Framework\Validator\DataObject')
+ ->disableOriginalConstructor()
+ ->setMethods([])
+ ->getMock();
+ $this->validatorObjectFactoryMock->expects($this->once())->method('create')->willReturn($validatorMock);
+ $this->validationRulesMock->expects($this->once())
+ ->method('addUserInfoRules')
+ ->with($validatorMock);
+ $validatorMock->expects($this->once())->method('isValid')->willReturn(true);
+
+ $newPassword = "NEWmYn3wpassw0rd";
+ $newPasswordHash = "new password hash";
+ $oldPassword = "OLDmYn3wpassw0rd";
+ $this->model->setPassword($newPassword)
+ ->setId(1)
+ ->setOrigData('password', $oldPassword);
+ $this->encryptorMock->expects($this->once())
+ ->method('isValidHash')
+ ->with($newPassword, $oldPassword)
+ ->willReturn(false);
+
+ $this->encryptorMock->expects($this->once())
+ ->method('getHash')
+ ->with($newPassword, false)
+ ->willReturn($newPasswordHash);
+
+ $this->resourceMock->expects($this->once())->method('getOldPasswords')->willReturn(['hash1', $newPasswordHash]);
+
+ $result = $this->model->validate();
+ $this->assertInternalType('array', $result);
+ $this->assertCount(1, $result);
+ $this->assertContains("Sorry, but this password has already been used.", (string)$result[0]);
+ }
+
+ public function testCheckPasswordChangeValid()
+ {
+ /** @var $validatorMock \Magento\Framework\Validator\DataObject|\PHPUnit_Framework_MockObject_MockObject */
+ $validatorMock = $this->getMockBuilder('Magento\Framework\Validator\DataObject')
+ ->disableOriginalConstructor()
+ ->setMethods([])
+ ->getMock();
+ $this->validatorObjectFactoryMock->expects($this->once())->method('create')->willReturn($validatorMock);
+ $this->validationRulesMock->expects($this->once())
+ ->method('addUserInfoRules')
+ ->with($validatorMock);
+ $validatorMock->expects($this->once())->method('isValid')->willReturn(true);
+
+ $newPassword = "NEWmYn3wpassw0rd";
+ $newPasswordHash = "new password hash";
+ $oldPassword = "OLDmYn3wpassw0rd";
+ $this->model->setPassword($newPassword)
+ ->setId(1)
+ ->setOrigData('password', $oldPassword);
+ $this->encryptorMock->expects($this->once())
+ ->method('isValidHash')
+ ->with($newPassword, $oldPassword)
+ ->willReturn(false);
+
+ $this->encryptorMock->expects($this->once())
+ ->method('getHash')
+ ->with($newPassword, false)
+ ->willReturn($newPasswordHash);
+
+ $this->resourceMock->expects($this->once())->method('getOldPasswords')->willReturn(['hash1', 'hash2']);
+
+ $result = $this->model->validate();
+ $this->assertTrue($result);
+ }
}
diff --git a/app/code/Magento/User/Test/Unit/Observer/Backend/CheckAdminPasswordChangeObserverTest.php b/app/code/Magento/User/Test/Unit/Observer/Backend/CheckAdminPasswordChangeObserverTest.php
deleted file mode 100644
index a4b9b37edbfa8..0000000000000
--- a/app/code/Magento/User/Test/Unit/Observer/Backend/CheckAdminPasswordChangeObserverTest.php
+++ /dev/null
@@ -1,126 +0,0 @@
-userMock = $this->getMockBuilder('Magento\User\Model\ResourceModel\User')
- ->disableOriginalConstructor()
- ->setMethods([])
- ->getMock();
-
- $this->encryptorMock = $this->getMockBuilder('\Magento\Framework\Encryption\EncryptorInterface')
- ->disableOriginalConstructor()
- ->setMethods([])
- ->getMock();
-
- $this->eventManagerMock = $this->getMockBuilder('Magento\Framework\Event\ManagerInterface')
- ->disableOriginalConstructor()
- ->setMethods([])
- ->getMockForAbstractClass();
-
- $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
-
- $this->model = $helper->getObject(
- '\Magento\User\Observer\Backend\CheckAdminPasswordChangeObserver',
- [
- 'userResource' => $this->userMock,
- 'encryptor' => $this->encryptorMock,
- ]
- );
- }
-
- public function testCheckAdminPasswordChange()
- {
- $newPW = "mYn3wpassw0rd";
- $uid = 123;
- /** @var \Magento\Framework\Event\Observer|\PHPUnit_Framework_MockObject_MockObject $eventObserverMock */
- $eventObserverMock = $this->getMockBuilder('Magento\Framework\Event\Observer')
- ->disableOriginalConstructor()
- ->setMethods([])
- ->getMock();
-
- /** @var \Magento\Framework\Event|\PHPUnit_Framework_MockObject_MockObject */
- $eventMock = $this->getMockBuilder('Magento\Framework\Event')
- ->disableOriginalConstructor()
- ->setMethods(['getObject'])
- ->getMock();
-
- /** @var \Magento\User\Model\User|\PHPUnit_Framework_MockObject_MockObject $userMock */
- $userMock = $this->getMockBuilder('Magento\User\Model\User')
- ->disableOriginalConstructor()
- ->setMethods(['getId', 'getNewPassword', 'getForceNewPassword'])
- ->getMock();
-
- $eventObserverMock->expects($this->once())->method('getEvent')->willReturn($eventMock);
- $eventMock->expects($this->once())->method('getObject')->willReturn($userMock);
- $userMock->expects($this->atLeastOnce())->method('getNewPassword')->willReturn($newPW);
- $userMock->expects($this->once())->method('getForceNewPassword')->willReturn(false);
- $userMock->expects($this->once())->method('getId')->willReturn($uid);
- $this->encryptorMock->expects($this->once())->method('isValidHash')->willReturn(false);
- $this->encryptorMock->expects($this->once())->method('getHash')->willReturn(md5($newPW));
- $this->userMock->method('getOldPasswords')->willReturn([md5('pw1'), md5('pw2')]);
-
- $this->model->execute($eventObserverMock);
- }
-
- public function testCheckAdminPasswordChangeThrowsLocalizedExp()
- {
- $newPW = "mYn3wpassw0rd";
- $uid = 123;
- /** @var \Magento\Framework\Event\Observer|\PHPUnit_Framework_MockObject_MockObject $eventObserverMock */
- $eventObserverMock = $this->getMockBuilder('Magento\Framework\Event\Observer')
- ->disableOriginalConstructor()
- ->setMethods([])
- ->getMock();
-
- /** @var \Magento\Framework\Event|\PHPUnit_Framework_MockObject_MockObject */
- $eventMock = $this->getMockBuilder('Magento\Framework\Event')
- ->disableOriginalConstructor()
- ->setMethods(['getObject'])
- ->getMock();
-
- /** @var \Magento\User\Model\User|\PHPUnit_Framework_MockObject_MockObject $userMock */
- $userMock = $this->getMockBuilder('Magento\User\Model\User')
- ->disableOriginalConstructor()
- ->setMethods(['getId', 'getNewPassword', 'getForceNewPassword'])
- ->getMock();
-
- $eventObserverMock->expects($this->once())->method('getEvent')->willReturn($eventMock);
- $eventMock->expects($this->once())->method('getObject')->willReturn($userMock);
- $userMock->expects($this->atLeastOnce())->method('getNewPassword')->willReturn($newPW);
- $userMock->expects($this->once())->method('getForceNewPassword')->willReturn(false);
- $userMock->expects($this->once())->method('getId')->willReturn($uid);
- $this->encryptorMock->expects($this->once())->method('isValidHash')->willReturn(true);
- $this->userMock->method('getOldPasswords')->willReturn([md5('pw1'), md5('pw2')]);
-
- try {
- $this->model->execute($eventObserverMock);
- } catch (\Magento\Framework\Exception\LocalizedException $expected) {
- return;
- }
- $this->fail('An expected exception has not been raised.');
- }
-}
diff --git a/app/code/Magento/User/Test/Unit/Observer/Backend/TrackAdminNewPasswordObserverTest.php b/app/code/Magento/User/Test/Unit/Observer/Backend/TrackAdminNewPasswordObserverTest.php
index eb1b930771dd3..d6dc5ddde8dc6 100644
--- a/app/code/Magento/User/Test/Unit/Observer/Backend/TrackAdminNewPasswordObserverTest.php
+++ b/app/code/Magento/User/Test/Unit/Observer/Backend/TrackAdminNewPasswordObserverTest.php
@@ -108,13 +108,13 @@ public function testTrackAdminPassword()
/** @var \Magento\User\Model\User|\PHPUnit_Framework_MockObject_MockObject $userMock */
$userMock = $this->getMockBuilder('Magento\User\Model\User')
->disableOriginalConstructor()
- ->setMethods(['getId', 'getNewPassword', 'getForceNewPassword'])
+ ->setMethods(['getId', 'getCurrentPassword', 'getForceNewPassword'])
->getMock();
$eventObserverMock->expects($this->once())->method('getEvent')->willReturn($eventMock);
$eventMock->expects($this->once())->method('getObject')->willReturn($userMock);
$userMock->expects($this->once())->method('getId')->willReturn($uid);
- $userMock->expects($this->once())->method('getNewPassword')->willReturn($newPW);
+ $userMock->expects($this->once())->method('getCurrentPassword')->willReturn($newPW);
$this->configInterfaceMock
->expects($this->atLeastOnce())
->method('getValue')
diff --git a/app/code/Magento/User/composer.json b/app/code/Magento/User/composer.json
index 6ffae63706a00..22102070b217f 100644
--- a/app/code/Magento/User/composer.json
+++ b/app/code/Magento/User/composer.json
@@ -11,7 +11,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/User/etc/adminhtml/events.xml b/app/code/Magento/User/etc/adminhtml/events.xml
index 1bcdab99c7667..469c19b9c1b25 100755
--- a/app/code/Magento/User/etc/adminhtml/events.xml
+++ b/app/code/Magento/User/etc/adminhtml/events.xml
@@ -12,9 +12,6 @@
-
-
-
diff --git a/app/code/Magento/Usps/Helper/Data.php b/app/code/Magento/Usps/Helper/Data.php
index 68a126ceb3e14..24631d5c025c3 100644
--- a/app/code/Magento/Usps/Helper/Data.php
+++ b/app/code/Magento/Usps/Helper/Data.php
@@ -22,7 +22,7 @@ class Data extends AbstractHelper
'usps_1', // Priority Mail
'usps_2', // Priority Mail Express Hold For Pickup
'usps_3', // Priority Mail Express
- 'usps_4', // Standard Post
+ 'usps_4', // Retail Ground
'usps_6', // Media Mail
'usps_INT_1', // Priority Mail Express International
'usps_INT_2', // Priority Mail International
@@ -36,7 +36,6 @@ class Data extends AbstractHelper
'usps_INT_14', // First-Class Mail International Large Envelope
'usps_INT_16', // Priority Mail International Small Flat Rate Box
'usps_INT_20', // Priority Mail International Small Flat Rate Envelope
- 'usps_INT_26', // Priority Mail Express International Flat Rate Boxes
];
/**
diff --git a/app/code/Magento/Usps/Model/Carrier.php b/app/code/Magento/Usps/Model/Carrier.php
index ef722b58a9850..1fdc35eab1393 100644
--- a/app/code/Magento/Usps/Model/Carrier.php
+++ b/app/code/Magento/Usps/Model/Carrier.php
@@ -614,7 +614,7 @@ public function getCode($type, $code = '')
'1' => __('Priority Mail'),
'2' => __('Priority Mail Express Hold For Pickup'),
'3' => __('Priority Mail Express'),
- '4' => __('Standard Post'),
+ '4' => __('Retail Ground'),
'6' => __('Media Mail'),
'7' => __('Library Mail'),
'13' => __('Priority Mail Express Flat Rate Envelope'),
@@ -649,8 +649,6 @@ public function getCode($type, $code = '')
'49' => __('Priority Mail Regional Rate Box B'),
'50' => __('Priority Mail Regional Rate Box B Hold For Pickup'),
'53' => __('First-Class Package Service Hold For Pickup'),
- '55' => __('Priority Mail Express Flat Rate Boxes'),
- '56' => __('Priority Mail Express Flat Rate Boxes Hold For Pickup'),
'57' => __('Priority Mail Express Sunday/Holiday Delivery Flat Rate Boxes'),
'58' => __('Priority Mail Regional Rate Box C'),
'59' => __('Priority Mail Regional Rate Box C Hold For Pickup'),
@@ -682,7 +680,6 @@ public function getCode($type, $code = '')
'INT_23' => __('Priority Mail International Padded Flat Rate Envelope'),
'INT_24' => __('Priority Mail International DVD Flat Rate priced box'),
'INT_25' => __('Priority Mail International Large Video Flat Rate priced box'),
- 'INT_26' => __('Priority Mail Express International Flat Rate Boxes'),
'INT_27' => __('Priority Mail Express International Padded Flat Rate Envelope'),
],
'service_to_code' => [
@@ -693,7 +690,7 @@ public function getCode($type, $code = '')
'1' => 'Priority',
'2' => 'Priority Express',
'3' => 'Priority Express',
- '4' => 'Standard Post',
+ '4' => 'Retail Ground',
'6' => 'Media',
'7' => 'Library',
'13' => 'Priority Express',
@@ -728,8 +725,6 @@ public function getCode($type, $code = '')
'49' => 'Priority',
'50' => 'Priority',
'53' => 'First Class',
- '55' => 'Priority Express',
- '56' => 'Priority Express',
'57' => 'Priority Express',
'58' => 'Priority',
'59' => 'Priority',
@@ -761,7 +756,6 @@ public function getCode($type, $code = '')
'INT_23' => 'Priority',
'INT_24' => 'Priority',
'INT_25' => 'Priority',
- 'INT_26' => 'Priority Express',
'INT_27' => 'Priority Express',
],
'method_to_code' => [
@@ -800,9 +794,7 @@ public function getCode($type, $code = '')
'Priority Mail Small Flat Rate Envelope',
'Priority Mail Small Flat Rate Envelope Hold For Pickup',
'First-Class Package Service Hold For Pickup',
- 'Priority Mail Express Flat Rate Boxes',
- 'Priority Mail Express Flat Rate Boxes Hold For Pickup',
- 'Standard Post',
+ 'Retail Ground',
'Media Mail',
'First-Class Mail Large Envelope',
'Priority Mail Express Sunday/Holiday Delivery',
@@ -894,7 +886,7 @@ public function getCode($type, $code = '')
'method' => [
'Priority Mail Express',
'Priority Mail',
- 'Standard Post',
+ 'Retail Ground',
'Media Mail',
'Library Mail',
'First-Class Package Service',
@@ -917,7 +909,7 @@ public function getCode($type, $code = '')
'method' => [
'Priority Mail Express',
'Priority Mail',
- 'Standard Post',
+ 'Retail Ground',
'Media Mail',
'Library Mail',
],
@@ -1489,7 +1481,8 @@ protected function _formUsSignatureConfirmationShipmentRequest(\Magento\Framewor
break;
case 'STANDARD':
case 'Standard Post':
- $serviceType = 'Standard Post';
+ case 'Retail Ground':
+ $serviceType = 'Retail Ground';
break;
case 'MEDIA':
case 'Media':
diff --git a/app/code/Magento/Usps/Setup/InstallData.php b/app/code/Magento/Usps/Setup/InstallData.php
index 71385fcbea097..234d036a2ee7f 100644
--- a/app/code/Magento/Usps/Setup/InstallData.php
+++ b/app/code/Magento/Usps/Setup/InstallData.php
@@ -40,7 +40,7 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
'First-Class Mail Parcel' => '0_FCP',
'First-Class Mail Package' => '0_FCP',
'Parcel Post' => '4',
- 'Standard Post' => '4',
+ 'Retail Ground' => '4',
'Media Mail' => '6',
'Library Mail' => '7',
'Express Mail' => '3',
diff --git a/app/code/Magento/Usps/Test/Unit/Helper/DataTest.php b/app/code/Magento/Usps/Test/Unit/Helper/DataTest.php
index dec567c7c188a..d4fb8ffc05457 100644
--- a/app/code/Magento/Usps/Test/Unit/Helper/DataTest.php
+++ b/app/code/Magento/Usps/Test/Unit/Helper/DataTest.php
@@ -49,7 +49,7 @@ public function shippingMethodDataProvider()
['usps_1'], // Priority Mail
['usps_2'], // Priority Mail Express Hold For Pickup
['usps_3'], // Priority Mail Express
- ['usps_4'], // Standard Post
+ ['usps_4'], // Retail Ground
['usps_6'], // Media Mail
['usps_INT_1'], // Priority Mail Express International
['usps_INT_2'], // Priority Mail International
@@ -63,7 +63,6 @@ public function shippingMethodDataProvider()
['usps_INT_14'], // First-Class Mail International Large Envelope
['usps_INT_16'], // Priority Mail International Small Flat Rate Box
['usps_INT_20'], // Priority Mail International Small Flat Rate Envelope
- ['usps_INT_26'] // Priority Mail Express International Flat Rate Boxes
];
}
}
diff --git a/app/code/Magento/Usps/Test/Unit/Model/_files/success_usps_response_rates.xml b/app/code/Magento/Usps/Test/Unit/Model/_files/success_usps_response_rates.xml
index cac9563b6579a..42c640752a355 100644
--- a/app/code/Magento/Usps/Test/Unit/Model/_files/success_usps_response_rates.xml
+++ b/app/code/Magento/Usps/Test/Unit/Model/_files/success_usps_response_rates.xml
@@ -138,7 +138,7 @@
5.60
- Standard Post<sup>®</sup>
+ Retail Ground<sup>®</sup>
8.85
diff --git a/app/code/Magento/Usps/composer.json b/app/code/Magento/Usps/composer.json
index 02fd46e98201f..ad7ca3c358de0 100644
--- a/app/code/Magento/Usps/composer.json
+++ b/app/code/Magento/Usps/composer.json
@@ -15,7 +15,7 @@
"lib-libxml": "*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Usps/i18n/en_US.csv b/app/code/Magento/Usps/i18n/en_US.csv
index 9ae0b37ee41ec..d5043c9f78bbf 100644
--- a/app/code/Magento/Usps/i18n/en_US.csv
+++ b/app/code/Magento/Usps/i18n/en_US.csv
@@ -28,7 +28,7 @@ Length,Length
"Priority Mail","Priority Mail"
"Priority Mail Express Hold For Pickup","Priority Mail Express Hold For Pickup"
"Priority Mail Express","Priority Mail Express"
-"Standard Post","Standard Post"
+"Retail Ground","Retail Ground"
"Media Mail","Media Mail"
"Library Mail","Library Mail"
"Priority Mail Express Flat Rate Envelope","Priority Mail Express Flat Rate Envelope"
@@ -63,8 +63,6 @@ Length,Length
"Priority Mail Regional Rate Box B","Priority Mail Regional Rate Box B"
"Priority Mail Regional Rate Box B Hold For Pickup","Priority Mail Regional Rate Box B Hold For Pickup"
"First-Class Package Service Hold For Pickup","First-Class Package Service Hold For Pickup"
-"Priority Mail Express Flat Rate Boxes","Priority Mail Express Flat Rate Boxes"
-"Priority Mail Express Flat Rate Boxes Hold For Pickup","Priority Mail Express Flat Rate Boxes Hold For Pickup"
"Priority Mail Express Sunday/Holiday Delivery Flat Rate Boxes","Priority Mail Express Sunday/Holiday Delivery Flat Rate Boxes"
"Priority Mail Regional Rate Box C","Priority Mail Regional Rate Box C"
"Priority Mail Regional Rate Box C Hold For Pickup","Priority Mail Regional Rate Box C Hold For Pickup"
@@ -96,7 +94,6 @@ Length,Length
"Priority Mail International Padded Flat Rate Envelope","Priority Mail International Padded Flat Rate Envelope"
"Priority Mail International DVD Flat Rate priced box","Priority Mail International DVD Flat Rate priced box"
"Priority Mail International Large Video Flat Rate priced box","Priority Mail International Large Video Flat Rate priced box"
-"Priority Mail Express International Flat Rate Boxes","Priority Mail Express International Flat Rate Boxes"
"Priority Mail Express International Padded Flat Rate Envelope","Priority Mail Express International Padded Flat Rate Envelope"
Letter,Letter
Flat,Flat
diff --git a/app/code/Magento/Variable/composer.json b/app/code/Magento/Variable/composer.json
index 63964f723175f..34de38cbb54cf 100644
--- a/app/code/Magento/Variable/composer.json
+++ b/app/code/Magento/Variable/composer.json
@@ -9,7 +9,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Version/composer.json b/app/code/Magento/Version/composer.json
index 9bc1f70ace828..ffcbc58a49c6b 100644
--- a/app/code/Magento/Version/composer.json
+++ b/app/code/Magento/Version/composer.json
@@ -6,7 +6,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Webapi/composer.json b/app/code/Magento/Webapi/composer.json
index 6140f083c68d6..7f0568cc08ba5 100644
--- a/app/code/Magento/Webapi/composer.json
+++ b/app/code/Magento/Webapi/composer.json
@@ -13,7 +13,7 @@
"magento/module-user": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Weee/Model/Tax.php b/app/code/Magento/Weee/Model/Tax.php
index b1293159031e9..d3de2f754ca00 100644
--- a/app/code/Magento/Weee/Model/Tax.php
+++ b/app/code/Magento/Weee/Model/Tax.php
@@ -344,7 +344,9 @@ public function getProductWeeeAttributes(
}
$one = new \Magento\Framework\DataObject();
- $one->setName(__($attribute['label_value'] ? $attribute['label_value'] : $attribute['frontend_label']))
+ $one->setName(
+ __($attribute['label_value']) ? __($attribute['label_value']) : __($attribute['frontend_label'])
+ )
->setAmount($amount)
->setTaxAmount($taxAmount)
->setAmountExclTax($amountExclTax)
diff --git a/app/code/Magento/Weee/composer.json b/app/code/Magento/Weee/composer.json
index 96b2f810e2111..26e47f10614f8 100644
--- a/app/code/Magento/Weee/composer.json
+++ b/app/code/Magento/Weee/composer.json
@@ -17,7 +17,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Widget/composer.json b/app/code/Magento/Widget/composer.json
index 1273a7778213c..acca43c0a5059 100644
--- a/app/code/Magento/Widget/composer.json
+++ b/app/code/Magento/Widget/composer.json
@@ -16,7 +16,7 @@
"magento/module-widget-sample-data": "Sample Data version:100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Wishlist/composer.json b/app/code/Magento/Wishlist/composer.json
index c5ec4e0687249..9e0d1fd56c066 100644
--- a/app/code/Magento/Wishlist/composer.json
+++ b/app/code/Magento/Wishlist/composer.json
@@ -24,7 +24,7 @@
"magento/module-wishlist-sample-data": "Sample Data version:100.0.*"
},
"type": "magento2-module",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/design/adminhtml/Magento/backend/composer.json b/app/design/adminhtml/Magento/backend/composer.json
index 5254959e1b632..0ee8b346bba7d 100644
--- a/app/design/adminhtml/Magento/backend/composer.json
+++ b/app/design/adminhtml/Magento/backend/composer.json
@@ -6,7 +6,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-theme",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/design/frontend/Magento/blank/composer.json b/app/design/frontend/Magento/blank/composer.json
index 2674351efd1c6..60c8918566ff7 100644
--- a/app/design/frontend/Magento/blank/composer.json
+++ b/app/design/frontend/Magento/blank/composer.json
@@ -6,7 +6,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-theme",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/design/frontend/Magento/luma/composer.json b/app/design/frontend/Magento/luma/composer.json
index ca0ccabb087c3..1cf27ce8460a7 100644
--- a/app/design/frontend/Magento/luma/composer.json
+++ b/app/design/frontend/Magento/luma/composer.json
@@ -7,7 +7,7 @@
"magento/framework": "100.0.*"
},
"type": "magento2-theme",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/i18n/magento/de_de/composer.json b/app/i18n/magento/de_de/composer.json
index 3205dec624633..7c76bcdd54400 100644
--- a/app/i18n/magento/de_de/composer.json
+++ b/app/i18n/magento/de_de/composer.json
@@ -1,7 +1,7 @@
{
"name": "magento/language-de_de",
"description": "German (Germany) language",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/i18n/magento/en_us/composer.json b/app/i18n/magento/en_us/composer.json
index f0691ca0b4238..ec1d7fa510d51 100644
--- a/app/i18n/magento/en_us/composer.json
+++ b/app/i18n/magento/en_us/composer.json
@@ -1,7 +1,7 @@
{
"name": "magento/language-en_us",
"description": "English (United States) language",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/i18n/magento/es_es/composer.json b/app/i18n/magento/es_es/composer.json
index b7731e68cac3b..df11758c3154c 100644
--- a/app/i18n/magento/es_es/composer.json
+++ b/app/i18n/magento/es_es/composer.json
@@ -1,7 +1,7 @@
{
"name": "magento/language-es_es",
"description": "Spanish (Spain) language",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/i18n/magento/fr_fr/composer.json b/app/i18n/magento/fr_fr/composer.json
index a6bde1a5c61ed..9fc42057c3a0d 100644
--- a/app/i18n/magento/fr_fr/composer.json
+++ b/app/i18n/magento/fr_fr/composer.json
@@ -1,7 +1,7 @@
{
"name": "magento/language-fr_fr",
"description": "French (France) language",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/i18n/magento/nl_nl/composer.json b/app/i18n/magento/nl_nl/composer.json
index b50ce5792fe6b..e0811f7ec9bb0 100644
--- a/app/i18n/magento/nl_nl/composer.json
+++ b/app/i18n/magento/nl_nl/composer.json
@@ -1,7 +1,7 @@
{
"name": "magento/language-nl_nl",
"description": "Dutch (Netherlands) language",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/i18n/magento/pt_br/composer.json b/app/i18n/magento/pt_br/composer.json
index b6df90831aa62..8f0437ae2267c 100644
--- a/app/i18n/magento/pt_br/composer.json
+++ b/app/i18n/magento/pt_br/composer.json
@@ -1,7 +1,7 @@
{
"name": "magento/language-pt_br",
"description": "Portuguese (Brazil) language",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/i18n/magento/zh_hans_cn/composer.json b/app/i18n/magento/zh_hans_cn/composer.json
index c2c97fff43fdc..2871692565ef4 100644
--- a/app/i18n/magento/zh_hans_cn/composer.json
+++ b/app/i18n/magento/zh_hans_cn/composer.json
@@ -1,7 +1,7 @@
{
"name": "magento/language-zh_hans_cn",
"description": "Chinese (China) language",
- "version": "100.0.2",
+ "version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/composer.json b/composer.json
index 700c9de61aeaf..ca43676bf014e 100644
--- a/composer.json
+++ b/composer.json
@@ -2,7 +2,7 @@
"name": "magento/magento2ce",
"description": "Magento 2 (Community Edition)",
"type": "project",
- "version": "2.0.0",
+ "version": "2.0.2",
"license": [
"OSL-3.0",
"AFL-3.0"
@@ -63,127 +63,128 @@
"ext-intl": "*",
"ext-xsl": "*",
"ext-mbstring": "*",
- "ext-openssl": "*"
+ "ext-openssl": "*",
+ "ext-zip": "*"
},
"require-dev": {
"phpunit/phpunit": "4.1.0",
"squizlabs/php_codesniffer": "1.5.3",
"phpmd/phpmd": "@stable",
- "pdepend/pdepend": "2.0.6",
+ "pdepend/pdepend": "2.2.2",
"sjparkinson/static-review": "~4.1",
"fabpot/php-cs-fixer": "~1.2",
"lusitanian/oauth": "~0.3 <=0.7.0"
},
"replace": {
- "magento/module-marketplace": "100.0.2",
- "magento/module-admin-notification": "100.0.2",
- "magento/module-advanced-pricing-import-export": "100.0.2",
- "magento/module-authorization": "100.0.2",
- "magento/module-authorizenet": "100.0.2",
- "magento/module-backend": "100.0.2",
- "magento/module-backup": "100.0.2",
- "magento/module-braintree": "100.0.2",
- "magento/module-bundle": "100.0.2",
- "magento/module-bundle-import-export": "100.0.2",
- "magento/module-cache-invalidate": "100.0.2",
- "magento/module-captcha": "100.0.2",
- "magento/module-catalog": "100.0.2",
- "magento/module-catalog-import-export": "100.0.2",
- "magento/module-catalog-inventory": "100.0.2",
- "magento/module-catalog-rule": "100.0.2",
- "magento/module-catalog-rule-configurable": "100.0.2",
- "magento/module-catalog-search": "100.0.2",
- "magento/module-catalog-url-rewrite": "100.0.2",
- "magento/module-catalog-widget": "100.0.2",
- "magento/module-checkout": "100.0.2",
- "magento/module-checkout-agreements": "100.0.2",
- "magento/module-cms": "100.0.2",
- "magento/module-cms-url-rewrite": "100.0.2",
- "magento/module-config": "100.0.2",
- "magento/module-configurable-import-export": "100.0.2",
- "magento/module-configurable-product": "100.0.2",
- "magento/module-contact": "100.0.2",
- "magento/module-cookie": "100.0.2",
- "magento/module-cron": "100.0.2",
- "magento/module-currency-symbol": "100.0.2",
- "magento/module-customer": "100.0.2",
- "magento/module-customer-import-export": "100.0.2",
- "magento/module-deploy": "100.0.2",
- "magento/module-developer": "100.0.2",
- "magento/module-dhl": "100.0.2",
- "magento/module-directory": "100.0.2",
- "magento/module-downloadable": "100.0.2",
- "magento/module-downloadable-import-export": "100.0.2",
- "magento/module-eav": "100.0.2",
- "magento/module-email": "100.0.2",
- "magento/module-encryption-key": "100.0.2",
- "magento/module-fedex": "100.0.2",
- "magento/module-gift-message": "100.0.2",
- "magento/module-google-adwords": "100.0.2",
- "magento/module-google-analytics": "100.0.2",
- "magento/module-google-optimizer": "100.0.2",
- "magento/module-grouped-import-export": "100.0.2",
- "magento/module-grouped-product": "100.0.2",
- "magento/module-import-export": "100.0.2",
- "magento/module-indexer": "100.0.2",
- "magento/module-integration": "100.0.2",
- "magento/module-layered-navigation": "100.0.2",
- "magento/module-media-storage": "100.0.2",
- "magento/module-msrp": "100.0.2",
- "magento/module-multishipping": "100.0.2",
- "magento/module-new-relic-reporting": "100.0.2",
- "magento/module-newsletter": "100.0.2",
- "magento/module-offline-payments": "100.0.2",
- "magento/module-offline-shipping": "100.0.2",
- "magento/module-page-cache": "100.0.2",
- "magento/module-payment": "100.0.2",
- "magento/module-paypal": "100.0.2",
- "magento/module-persistent": "100.0.2",
- "magento/module-product-alert": "100.0.2",
- "magento/module-product-video": "100.0.2",
- "magento/module-quote": "100.0.2",
- "magento/module-reports": "100.0.2",
- "magento/module-require-js": "100.0.2",
- "magento/module-review": "100.0.2",
- "magento/module-rss": "100.0.2",
- "magento/module-rule": "100.0.2",
- "magento/module-sales": "100.0.2",
- "magento/module-sales-rule": "100.0.2",
- "magento/module-sales-sequence": "100.0.2",
- "magento/module-sample-data": "100.0.2",
- "magento/module-search": "100.0.2",
- "magento/module-send-friend": "100.0.2",
- "magento/module-shipping": "100.0.2",
- "magento/module-sitemap": "100.0.2",
- "magento/module-store": "100.0.2",
- "magento/module-swagger": "100.0.2",
- "magento/module-swatches": "100.0.2",
- "magento/module-tax": "100.0.2",
- "magento/module-tax-import-export": "100.0.2",
- "magento/module-theme": "100.0.2",
- "magento/module-translation": "100.0.2",
- "magento/module-ui": "100.0.2",
- "magento/module-ups": "100.0.2",
- "magento/module-url-rewrite": "100.0.2",
- "magento/module-user": "100.0.2",
- "magento/module-usps": "100.0.2",
- "magento/module-variable": "100.0.2",
- "magento/module-version": "100.0.2",
- "magento/module-webapi": "100.0.2",
- "magento/module-weee": "100.0.2",
- "magento/module-widget": "100.0.2",
- "magento/module-wishlist": "100.0.2",
- "magento/theme-adminhtml-backend": "100.0.2",
- "magento/theme-frontend-blank": "100.0.2",
- "magento/theme-frontend-luma": "100.0.2",
- "magento/language-de_de": "100.0.2",
- "magento/language-en_us": "100.0.2",
- "magento/language-es_es": "100.0.2",
- "magento/language-fr_fr": "100.0.2",
- "magento/language-nl_nl": "100.0.2",
- "magento/language-pt_br": "100.0.2",
- "magento/language-zh_hans_cn": "100.0.2",
- "magento/framework": "100.0.2",
+ "magento/module-marketplace": "100.0.3",
+ "magento/module-admin-notification": "100.0.3",
+ "magento/module-advanced-pricing-import-export": "100.0.3",
+ "magento/module-authorization": "100.0.3",
+ "magento/module-authorizenet": "100.0.3",
+ "magento/module-backend": "100.0.3",
+ "magento/module-backup": "100.0.3",
+ "magento/module-braintree": "100.0.3",
+ "magento/module-bundle": "100.0.3",
+ "magento/module-bundle-import-export": "100.0.3",
+ "magento/module-cache-invalidate": "100.0.3",
+ "magento/module-captcha": "100.0.3",
+ "magento/module-catalog": "100.0.3",
+ "magento/module-catalog-import-export": "100.0.3",
+ "magento/module-catalog-inventory": "100.0.3",
+ "magento/module-catalog-rule": "100.0.3",
+ "magento/module-catalog-rule-configurable": "100.0.3",
+ "magento/module-catalog-search": "100.0.3",
+ "magento/module-catalog-url-rewrite": "100.0.3",
+ "magento/module-catalog-widget": "100.0.3",
+ "magento/module-checkout": "100.0.3",
+ "magento/module-checkout-agreements": "100.0.3",
+ "magento/module-cms": "100.0.3",
+ "magento/module-cms-url-rewrite": "100.0.3",
+ "magento/module-config": "100.0.3",
+ "magento/module-configurable-import-export": "100.0.3",
+ "magento/module-configurable-product": "100.0.3",
+ "magento/module-contact": "100.0.3",
+ "magento/module-cookie": "100.0.3",
+ "magento/module-cron": "100.0.3",
+ "magento/module-currency-symbol": "100.0.3",
+ "magento/module-customer": "100.0.3",
+ "magento/module-customer-import-export": "100.0.3",
+ "magento/module-deploy": "100.0.3",
+ "magento/module-developer": "100.0.3",
+ "magento/module-dhl": "100.0.3",
+ "magento/module-directory": "100.0.3",
+ "magento/module-downloadable": "100.0.3",
+ "magento/module-downloadable-import-export": "100.0.3",
+ "magento/module-eav": "100.0.3",
+ "magento/module-email": "100.0.3",
+ "magento/module-encryption-key": "100.0.3",
+ "magento/module-fedex": "100.0.3",
+ "magento/module-gift-message": "100.0.3",
+ "magento/module-google-adwords": "100.0.3",
+ "magento/module-google-analytics": "100.0.3",
+ "magento/module-google-optimizer": "100.0.3",
+ "magento/module-grouped-import-export": "100.0.3",
+ "magento/module-grouped-product": "100.0.3",
+ "magento/module-import-export": "100.0.3",
+ "magento/module-indexer": "100.0.3",
+ "magento/module-integration": "100.0.3",
+ "magento/module-layered-navigation": "100.0.3",
+ "magento/module-media-storage": "100.0.3",
+ "magento/module-msrp": "100.0.3",
+ "magento/module-multishipping": "100.0.3",
+ "magento/module-new-relic-reporting": "100.0.3",
+ "magento/module-newsletter": "100.0.3",
+ "magento/module-offline-payments": "100.0.3",
+ "magento/module-offline-shipping": "100.0.3",
+ "magento/module-page-cache": "100.0.3",
+ "magento/module-payment": "100.0.3",
+ "magento/module-paypal": "100.0.3",
+ "magento/module-persistent": "100.0.3",
+ "magento/module-product-alert": "100.0.3",
+ "magento/module-product-video": "100.0.3",
+ "magento/module-quote": "100.0.3",
+ "magento/module-reports": "100.0.3",
+ "magento/module-require-js": "100.0.3",
+ "magento/module-review": "100.0.3",
+ "magento/module-rss": "100.0.3",
+ "magento/module-rule": "100.0.3",
+ "magento/module-sales": "100.0.3",
+ "magento/module-sales-rule": "100.0.3",
+ "magento/module-sales-sequence": "100.0.3",
+ "magento/module-sample-data": "100.0.3",
+ "magento/module-search": "100.0.3",
+ "magento/module-send-friend": "100.0.3",
+ "magento/module-shipping": "100.0.3",
+ "magento/module-sitemap": "100.0.3",
+ "magento/module-store": "100.0.3",
+ "magento/module-swagger": "100.0.3",
+ "magento/module-swatches": "100.0.3",
+ "magento/module-tax": "100.0.3",
+ "magento/module-tax-import-export": "100.0.3",
+ "magento/module-theme": "100.0.3",
+ "magento/module-translation": "100.0.3",
+ "magento/module-ui": "100.0.3",
+ "magento/module-ups": "100.0.3",
+ "magento/module-url-rewrite": "100.0.3",
+ "magento/module-user": "100.0.3",
+ "magento/module-usps": "100.0.3",
+ "magento/module-variable": "100.0.3",
+ "magento/module-version": "100.0.3",
+ "magento/module-webapi": "100.0.3",
+ "magento/module-weee": "100.0.3",
+ "magento/module-widget": "100.0.3",
+ "magento/module-wishlist": "100.0.3",
+ "magento/theme-adminhtml-backend": "100.0.3",
+ "magento/theme-frontend-blank": "100.0.3",
+ "magento/theme-frontend-luma": "100.0.3",
+ "magento/language-de_de": "100.0.3",
+ "magento/language-en_us": "100.0.3",
+ "magento/language-es_es": "100.0.3",
+ "magento/language-fr_fr": "100.0.3",
+ "magento/language-nl_nl": "100.0.3",
+ "magento/language-pt_br": "100.0.3",
+ "magento/language-zh_hans_cn": "100.0.3",
+ "magento/framework": "100.0.4",
"trentrichardson/jquery-timepicker-addon": "1.4.3",
"colinmollenhour/cache-backend-redis": "1.8",
"colinmollenhour/credis": "1.5",
diff --git a/composer.lock b/composer.lock
index e8f51a8f3a7aa..cfed364daa9af 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "hash": "a89e22120ba1ef2146473b6e378acaed",
+ "hash": "d6ff14e9404679ea0b9bdae4b154df45",
"packages": [
{
"name": "braintree/braintree_php",
@@ -121,20 +121,20 @@
},
{
"name": "justinrainbow/json-schema",
- "version": "1.5.0",
+ "version": "1.6.1",
"source": {
"type": "git",
"url": "https://github.com/justinrainbow/json-schema.git",
- "reference": "a4bee9f4b344b66e0a0d96c7afae1e92edf385fe"
+ "reference": "cc84765fb7317f6b07bd8ac78364747f95b86341"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/a4bee9f4b344b66e0a0d96c7afae1e92edf385fe",
- "reference": "a4bee9f4b344b66e0a0d96c7afae1e92edf385fe",
+ "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/cc84765fb7317f6b07bd8ac78364747f95b86341",
+ "reference": "cc84765fb7317f6b07bd8ac78364747f95b86341",
"shasum": ""
},
"require": {
- "php": ">=5.3.2"
+ "php": ">=5.3.29"
},
"require-dev": {
"json-schema/json-schema-test-suite": "1.1.0",
@@ -147,7 +147,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.4.x-dev"
+ "dev-master": "1.6.x-dev"
}
},
"autoload": {
@@ -183,7 +183,7 @@
"json",
"schema"
],
- "time": "2015-09-08 22:28:04"
+ "time": "2016-01-25 15:43:01"
},
{
"name": "magento/composer",
@@ -216,16 +216,16 @@
},
{
"name": "magento/magento-composer-installer",
- "version": "0.1.5",
+ "version": "0.1.6",
"source": {
"type": "git",
"url": "https://github.com/magento/magento-composer-installer.git",
- "reference": "1b33917bfc3f4a0856276dcbe46ce35362f50fc3"
+ "reference": "5b5d29ebe060bc6754c2999206923489db8ca641"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/magento/magento-composer-installer/zipball/1b33917bfc3f4a0856276dcbe46ce35362f50fc3",
- "reference": "1b33917bfc3f4a0856276dcbe46ce35362f50fc3",
+ "url": "https://api.github.com/repos/magento/magento-composer-installer/zipball/5b5d29ebe060bc6754c2999206923489db8ca641",
+ "reference": "5b5d29ebe060bc6754c2999206923489db8ca641",
"shasum": ""
},
"require": {
@@ -288,7 +288,7 @@
"composer-installer",
"magento"
],
- "time": "2015-09-14 19:59:55"
+ "time": "2016-01-25 22:04:43"
},
{
"name": "magento/zendframework1",
@@ -666,20 +666,20 @@
},
{
"name": "seld/jsonlint",
- "version": "1.3.1",
+ "version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/jsonlint.git",
- "reference": "863ae85c6d3ef60ca49cb12bd051c4a0648c40c4"
+ "reference": "66834d3e3566bb5798db7294619388786ae99394"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/863ae85c6d3ef60ca49cb12bd051c4a0648c40c4",
- "reference": "863ae85c6d3ef60ca49cb12bd051c4a0648c40c4",
+ "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/66834d3e3566bb5798db7294619388786ae99394",
+ "reference": "66834d3e3566bb5798db7294619388786ae99394",
"shasum": ""
},
"require": {
- "php": ">=5.3.0"
+ "php": "^5.3 || ^7.0"
},
"bin": [
"bin/jsonlint"
@@ -708,11 +708,11 @@
"parser",
"validator"
],
- "time": "2015-01-04 21:18:15"
+ "time": "2015-11-21 02:21:41"
},
{
"name": "symfony/console",
- "version": "v2.6.11",
+ "version": "v2.6.13",
"target-dir": "Symfony/Component/Console",
"source": {
"type": "git",
@@ -770,16 +770,16 @@
},
{
"name": "symfony/event-dispatcher",
- "version": "v2.7.6",
+ "version": "v2.8.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
- "reference": "87a5db5ea887763fa3a31a5471b512ff1596d9b8"
+ "reference": "ee278f7c851533e58ca307f66305ccb9188aceda"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/87a5db5ea887763fa3a31a5471b512ff1596d9b8",
- "reference": "87a5db5ea887763fa3a31a5471b512ff1596d9b8",
+ "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/ee278f7c851533e58ca307f66305ccb9188aceda",
+ "reference": "ee278f7c851533e58ca307f66305ccb9188aceda",
"shasum": ""
},
"require": {
@@ -787,10 +787,10 @@
},
"require-dev": {
"psr/log": "~1.0",
- "symfony/config": "~2.0,>=2.0.5",
- "symfony/dependency-injection": "~2.6",
- "symfony/expression-language": "~2.6",
- "symfony/stopwatch": "~2.3"
+ "symfony/config": "~2.0,>=2.0.5|~3.0.0",
+ "symfony/dependency-injection": "~2.6|~3.0.0",
+ "symfony/expression-language": "~2.6|~3.0.0",
+ "symfony/stopwatch": "~2.3|~3.0.0"
},
"suggest": {
"symfony/dependency-injection": "",
@@ -799,13 +799,16 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.7-dev"
+ "dev-master": "2.8-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\EventDispatcher\\": ""
- }
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -823,20 +826,20 @@
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com",
- "time": "2015-10-11 09:39:48"
+ "time": "2016-01-13 10:28:07"
},
{
"name": "symfony/finder",
- "version": "v2.7.6",
+ "version": "v2.8.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
- "reference": "2ffb4e9598db3c48eb6d0ae73b04bbf09280c59d"
+ "reference": "c90fabdd97e431ee19b6383999cf35334dff27da"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/finder/zipball/2ffb4e9598db3c48eb6d0ae73b04bbf09280c59d",
- "reference": "2ffb4e9598db3c48eb6d0ae73b04bbf09280c59d",
+ "url": "https://api.github.com/repos/symfony/finder/zipball/c90fabdd97e431ee19b6383999cf35334dff27da",
+ "reference": "c90fabdd97e431ee19b6383999cf35334dff27da",
"shasum": ""
},
"require": {
@@ -845,13 +848,16 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.7-dev"
+ "dev-master": "2.8-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Finder\\": ""
- }
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -869,20 +875,20 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
- "time": "2015-10-11 09:39:48"
+ "time": "2016-01-14 08:26:52"
},
{
"name": "symfony/process",
- "version": "v2.7.6",
+ "version": "v2.8.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
- "reference": "4a959dd4e19c2c5d7512689413921e0a74386ec7"
+ "reference": "6f1979c3b0f4c22c77a8a8971afaa7dd07f082ac"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/process/zipball/4a959dd4e19c2c5d7512689413921e0a74386ec7",
- "reference": "4a959dd4e19c2c5d7512689413921e0a74386ec7",
+ "url": "https://api.github.com/repos/symfony/process/zipball/6f1979c3b0f4c22c77a8a8971afaa7dd07f082ac",
+ "reference": "6f1979c3b0f4c22c77a8a8971afaa7dd07f082ac",
"shasum": ""
},
"require": {
@@ -891,13 +897,16 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.7-dev"
+ "dev-master": "2.8-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Process\\": ""
- }
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -915,7 +924,7 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
- "time": "2015-10-23 14:47:27"
+ "time": "2016-01-06 09:59:23"
},
{
"name": "tedivm/jshrink",
@@ -1009,7 +1018,7 @@
},
{
"name": "zendframework/zend-code",
- "version": "2.4.8",
+ "version": "2.4.9",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-code.git",
@@ -1062,7 +1071,7 @@
},
{
"name": "zendframework/zend-config",
- "version": "2.4.8",
+ "version": "2.4.9",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-config.git",
@@ -1119,7 +1128,7 @@
},
{
"name": "zendframework/zend-console",
- "version": "2.4.8",
+ "version": "2.4.9",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-console.git",
@@ -1169,28 +1178,29 @@
},
{
"name": "zendframework/zend-crypt",
- "version": "2.4.8",
+ "version": "2.4.9",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-crypt.git",
- "reference": "ec78d08abaa1a09b76b4b8161ba7d27a675e5bf1"
+ "reference": "165ec063868884eb952f6bca258f464f7103b79f"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/zendframework/zend-crypt/zipball/ec78d08abaa1a09b76b4b8161ba7d27a675e5bf1",
- "reference": "ec78d08abaa1a09b76b4b8161ba7d27a675e5bf1",
+ "url": "https://api.github.com/repos/zendframework/zend-crypt/zipball/165ec063868884eb952f6bca258f464f7103b79f",
+ "reference": "165ec063868884eb952f6bca258f464f7103b79f",
"shasum": ""
},
"require": {
"php": ">=5.3.23",
- "zendframework/zend-math": "self.version",
- "zendframework/zend-servicemanager": "self.version",
- "zendframework/zend-stdlib": "self.version"
+ "zendframework/zend-math": "~2.4.0",
+ "zendframework/zend-servicemanager": "~2.4.0",
+ "zendframework/zend-stdlib": "~2.4.0"
},
"require-dev": {
"fabpot/php-cs-fixer": "1.7.*",
"phpunit/phpunit": "~4.0",
- "satooshi/php-coveralls": "dev-master"
+ "satooshi/php-coveralls": "dev-master",
+ "zendframework/zend-config": "~2.4.0"
},
"suggest": {
"ext-mcrypt": "Required for most features of Zend\\Crypt"
@@ -1216,11 +1226,11 @@
"crypt",
"zf2"
],
- "time": "2015-05-07 14:55:31"
+ "time": "2015-11-23 16:33:27"
},
{
"name": "zendframework/zend-di",
- "version": "2.4.8",
+ "version": "2.4.9",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-di.git",
@@ -1271,7 +1281,7 @@
},
{
"name": "zendframework/zend-escaper",
- "version": "2.4.8",
+ "version": "2.4.9",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-escaper.git",
@@ -1316,7 +1326,7 @@
},
{
"name": "zendframework/zend-eventmanager",
- "version": "2.4.8",
+ "version": "2.4.9",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-eventmanager.git",
@@ -1362,7 +1372,7 @@
},
{
"name": "zendframework/zend-filter",
- "version": "2.4.8",
+ "version": "2.4.9",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-filter.git",
@@ -1418,7 +1428,7 @@
},
{
"name": "zendframework/zend-form",
- "version": "2.4.8",
+ "version": "2.4.9",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-form.git",
@@ -1489,7 +1499,7 @@
},
{
"name": "zendframework/zend-http",
- "version": "2.4.8",
+ "version": "2.4.9",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-http.git",
@@ -1540,7 +1550,7 @@
},
{
"name": "zendframework/zend-i18n",
- "version": "2.4.8",
+ "version": "2.4.9",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-i18n.git",
@@ -1604,7 +1614,7 @@
},
{
"name": "zendframework/zend-inputfilter",
- "version": "2.4.8",
+ "version": "2.4.9",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-inputfilter.git",
@@ -1655,7 +1665,7 @@
},
{
"name": "zendframework/zend-json",
- "version": "2.4.8",
+ "version": "2.4.9",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-json.git",
@@ -1709,7 +1719,7 @@
},
{
"name": "zendframework/zend-loader",
- "version": "2.4.8",
+ "version": "2.4.9",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-loader.git",
@@ -1754,7 +1764,7 @@
},
{
"name": "zendframework/zend-log",
- "version": "2.4.8",
+ "version": "2.4.9",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-log.git",
@@ -1816,7 +1826,7 @@
},
{
"name": "zendframework/zend-math",
- "version": "2.4.8",
+ "version": "2.4.9",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-math.git",
@@ -1867,7 +1877,7 @@
},
{
"name": "zendframework/zend-modulemanager",
- "version": "2.4.8",
+ "version": "2.4.9",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-modulemanager.git",
@@ -1925,7 +1935,7 @@
},
{
"name": "zendframework/zend-mvc",
- "version": "2.4.8",
+ "version": "2.4.9",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-mvc.git",
@@ -2013,7 +2023,7 @@
},
{
"name": "zendframework/zend-serializer",
- "version": "2.4.8",
+ "version": "2.4.9",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-serializer.git",
@@ -2066,7 +2076,7 @@
},
{
"name": "zendframework/zend-server",
- "version": "2.4.8",
+ "version": "2.4.9",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-server.git",
@@ -2113,7 +2123,7 @@
},
{
"name": "zendframework/zend-servicemanager",
- "version": "2.4.8",
+ "version": "2.4.9",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-servicemanager.git",
@@ -2163,7 +2173,7 @@
},
{
"name": "zendframework/zend-soap",
- "version": "2.4.8",
+ "version": "2.4.9",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-soap.git",
@@ -2215,7 +2225,7 @@
},
{
"name": "zendframework/zend-stdlib",
- "version": "2.4.8",
+ "version": "2.4.9",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-stdlib.git",
@@ -2270,7 +2280,7 @@
},
{
"name": "zendframework/zend-text",
- "version": "2.4.8",
+ "version": "2.4.9",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-text.git",
@@ -2317,7 +2327,7 @@
},
{
"name": "zendframework/zend-uri",
- "version": "2.4.8",
+ "version": "2.4.9",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-uri.git",
@@ -2365,7 +2375,7 @@
},
{
"name": "zendframework/zend-validator",
- "version": "2.4.8",
+ "version": "2.4.9",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-validator.git",
@@ -2430,7 +2440,7 @@
},
{
"name": "zendframework/zend-view",
- "version": "2.4.8",
+ "version": "2.4.9",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-view.git",
@@ -2563,28 +2573,28 @@
},
{
"name": "fabpot/php-cs-fixer",
- "version": "v1.10.2",
+ "version": "v1.11.1",
"source": {
"type": "git",
"url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git",
- "reference": "e8b3c4e41dc1484210fdc45363c41af6c2d56f20"
+ "reference": "2c9f8298181f059c5077abda78019b9a0c9a7cc0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/e8b3c4e41dc1484210fdc45363c41af6c2d56f20",
- "reference": "e8b3c4e41dc1484210fdc45363c41af6c2d56f20",
+ "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/2c9f8298181f059c5077abda78019b9a0c9a7cc0",
+ "reference": "2c9f8298181f059c5077abda78019b9a0c9a7cc0",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.3.6",
"sebastian/diff": "~1.1",
- "symfony/console": "~2.3",
- "symfony/event-dispatcher": "~2.1",
- "symfony/filesystem": "~2.1",
- "symfony/finder": "~2.1",
- "symfony/process": "~2.3",
- "symfony/stopwatch": "~2.5"
+ "symfony/console": "~2.3|~3.0",
+ "symfony/event-dispatcher": "~2.1|~3.0",
+ "symfony/filesystem": "~2.1|~3.0",
+ "symfony/finder": "~2.1|~3.0",
+ "symfony/process": "~2.3|~3.0",
+ "symfony/stopwatch": "~2.5|~3.0"
},
"require-dev": {
"satooshi/php-coveralls": "0.7.*@dev"
@@ -2613,7 +2623,7 @@
}
],
"description": "A tool to automatically fix PHP code style",
- "time": "2015-10-21 19:19:43"
+ "time": "2016-01-20 19:00:28"
},
{
"name": "league/climate",
@@ -2733,26 +2743,27 @@
},
{
"name": "pdepend/pdepend",
- "version": "2.0.6",
+ "version": "2.2.2",
"source": {
"type": "git",
"url": "https://github.com/pdepend/pdepend.git",
- "reference": "a15ffcbfbcc4570d4a733ca7b76e9cac0a56c3f4"
+ "reference": "d3ae0d084d526cdc6c3f1b858fb7148de77b41c5"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/pdepend/pdepend/zipball/a15ffcbfbcc4570d4a733ca7b76e9cac0a56c3f4",
- "reference": "a15ffcbfbcc4570d4a733ca7b76e9cac0a56c3f4",
+ "url": "https://api.github.com/repos/pdepend/pdepend/zipball/d3ae0d084d526cdc6c3f1b858fb7148de77b41c5",
+ "reference": "d3ae0d084d526cdc6c3f1b858fb7148de77b41c5",
"shasum": ""
},
"require": {
- "symfony/config": ">=2.4",
- "symfony/dependency-injection": ">=2.4",
- "symfony/filesystem": ">=2.4"
+ "php": ">=5.3.7",
+ "symfony/config": "^2.3.0",
+ "symfony/dependency-injection": "^2.3.0",
+ "symfony/filesystem": "^2.3.0"
},
"require-dev": {
- "phpunit/phpunit": "4.*@stable",
- "squizlabs/php_codesniffer": "@stable"
+ "phpunit/phpunit": "^4.0.0,<4.8",
+ "squizlabs/php_codesniffer": "^2.0.0"
},
"bin": [
"src/bin/pdepend"
@@ -2768,7 +2779,7 @@
"BSD-3-Clause"
],
"description": "Official version of pdepend to be handled with Composer",
- "time": "2015-03-02 08:06:43"
+ "time": "2015-10-16 08:49:58"
},
{
"name": "phpmd/phpmd",
@@ -3269,28 +3280,28 @@
},
{
"name": "sebastian/diff",
- "version": "1.3.0",
+ "version": "1.4.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
- "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3"
+ "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3",
- "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3",
+ "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e",
+ "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
- "phpunit/phpunit": "~4.2"
+ "phpunit/phpunit": "~4.8"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.3-dev"
+ "dev-master": "1.4-dev"
}
},
"autoload": {
@@ -3313,24 +3324,24 @@
}
],
"description": "Diff implementation",
- "homepage": "http://www.github.com/sebastianbergmann/diff",
+ "homepage": "https://github.com/sebastianbergmann/diff",
"keywords": [
"diff"
],
- "time": "2015-02-22 15:13:53"
+ "time": "2015-12-08 07:14:41"
},
{
"name": "sebastian/environment",
- "version": "1.3.2",
+ "version": "1.3.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
- "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44"
+ "reference": "6e7133793a8e5a5714a551a8324337374be209df"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6324c907ce7a52478eeeaede764f48733ef5ae44",
- "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44",
+ "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6e7133793a8e5a5714a551a8324337374be209df",
+ "reference": "6e7133793a8e5a5714a551a8324337374be209df",
"shasum": ""
},
"require": {
@@ -3367,7 +3378,7 @@
"environment",
"hhvm"
],
- "time": "2015-08-03 06:14:51"
+ "time": "2015-12-02 08:37:27"
},
{
"name": "sebastian/exporter",
@@ -3437,16 +3448,16 @@
},
{
"name": "sebastian/recursion-context",
- "version": "1.0.1",
+ "version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/recursion-context.git",
- "reference": "994d4a811bafe801fb06dccbee797863ba2792ba"
+ "reference": "913401df809e99e4f47b27cdd781f4a258d58791"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/994d4a811bafe801fb06dccbee797863ba2792ba",
- "reference": "994d4a811bafe801fb06dccbee797863ba2792ba",
+ "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791",
+ "reference": "913401df809e99e4f47b27cdd781f4a258d58791",
"shasum": ""
},
"require": {
@@ -3486,7 +3497,7 @@
],
"description": "Provides functionality to recursively process PHP variables",
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
- "time": "2015-06-21 08:04:50"
+ "time": "2015-11-11 19:50:13"
},
{
"name": "sebastian/version",
@@ -3653,32 +3664,35 @@
},
{
"name": "symfony/config",
- "version": "v2.7.6",
+ "version": "v2.8.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/config.git",
- "reference": "831f88908b51b9ce945f5e6f402931d1ac544423"
+ "reference": "41ee6c70758f40fa1dbf90d019ae0a66c4a09e74"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/config/zipball/831f88908b51b9ce945f5e6f402931d1ac544423",
- "reference": "831f88908b51b9ce945f5e6f402931d1ac544423",
+ "url": "https://api.github.com/repos/symfony/config/zipball/41ee6c70758f40fa1dbf90d019ae0a66c4a09e74",
+ "reference": "41ee6c70758f40fa1dbf90d019ae0a66c4a09e74",
"shasum": ""
},
"require": {
"php": ">=5.3.9",
- "symfony/filesystem": "~2.3"
+ "symfony/filesystem": "~2.3|~3.0.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.7-dev"
+ "dev-master": "2.8-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Config\\": ""
- }
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -3696,20 +3710,20 @@
],
"description": "Symfony Config Component",
"homepage": "https://symfony.com",
- "time": "2015-10-11 09:39:48"
+ "time": "2016-01-03 15:33:41"
},
{
"name": "symfony/dependency-injection",
- "version": "v2.7.6",
+ "version": "v2.8.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/dependency-injection.git",
- "reference": "af284e795ec8a08c80d1fc47518fd23004b89847"
+ "reference": "ba94a914e244e0d05f0aaef460d5558d5541d2b1"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/af284e795ec8a08c80d1fc47518fd23004b89847",
- "reference": "af284e795ec8a08c80d1fc47518fd23004b89847",
+ "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/ba94a914e244e0d05f0aaef460d5558d5541d2b1",
+ "reference": "ba94a914e244e0d05f0aaef460d5558d5541d2b1",
"shasum": ""
},
"require": {
@@ -3719,9 +3733,9 @@
"symfony/expression-language": "<2.6"
},
"require-dev": {
- "symfony/config": "~2.2",
- "symfony/expression-language": "~2.6",
- "symfony/yaml": "~2.1"
+ "symfony/config": "~2.2|~3.0.0",
+ "symfony/expression-language": "~2.6|~3.0.0",
+ "symfony/yaml": "~2.1|~3.0.0"
},
"suggest": {
"symfony/config": "",
@@ -3731,13 +3745,16 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.7-dev"
+ "dev-master": "2.8-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\DependencyInjection\\": ""
- }
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -3755,20 +3772,20 @@
],
"description": "Symfony DependencyInjection Component",
"homepage": "https://symfony.com",
- "time": "2015-10-27 15:38:06"
+ "time": "2016-01-12 17:46:01"
},
{
"name": "symfony/filesystem",
- "version": "v2.7.6",
+ "version": "v2.8.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
- "reference": "56fd6df73be859323ff97418d97edc1d756df6df"
+ "reference": "637b64d0ee10f44ae98dbad651b1ecdf35a11e8c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/filesystem/zipball/56fd6df73be859323ff97418d97edc1d756df6df",
- "reference": "56fd6df73be859323ff97418d97edc1d756df6df",
+ "url": "https://api.github.com/repos/symfony/filesystem/zipball/637b64d0ee10f44ae98dbad651b1ecdf35a11e8c",
+ "reference": "637b64d0ee10f44ae98dbad651b1ecdf35a11e8c",
"shasum": ""
},
"require": {
@@ -3777,13 +3794,16 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.7-dev"
+ "dev-master": "2.8-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Filesystem\\": ""
- }
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -3801,35 +3821,38 @@
],
"description": "Symfony Filesystem Component",
"homepage": "https://symfony.com",
- "time": "2015-10-18 20:23:18"
+ "time": "2016-01-13 10:28:07"
},
{
"name": "symfony/stopwatch",
- "version": "v2.7.6",
+ "version": "v3.0.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/stopwatch.git",
- "reference": "f8ab957c17e4b85a73c4df03bdf94ee597f2bd55"
+ "reference": "6aeac8907e3e1340a0033b0a9ec075f8e6524800"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/stopwatch/zipball/f8ab957c17e4b85a73c4df03bdf94ee597f2bd55",
- "reference": "f8ab957c17e4b85a73c4df03bdf94ee597f2bd55",
+ "url": "https://api.github.com/repos/symfony/stopwatch/zipball/6aeac8907e3e1340a0033b0a9ec075f8e6524800",
+ "reference": "6aeac8907e3e1340a0033b0a9ec075f8e6524800",
"shasum": ""
},
"require": {
- "php": ">=5.3.9"
+ "php": ">=5.5.9"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.7-dev"
+ "dev-master": "3.0-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Stopwatch\\": ""
- }
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -3847,20 +3870,20 @@
],
"description": "Symfony Stopwatch Component",
"homepage": "https://symfony.com",
- "time": "2015-10-12 12:42:24"
+ "time": "2015-10-30 23:35:59"
},
{
"name": "symfony/yaml",
- "version": "v2.7.6",
+ "version": "v2.8.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
- "reference": "eca9019c88fbe250164affd107bc8057771f3f4d"
+ "reference": "34c8a4b51e751e7ea869b8262f883d008a2b81b8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/yaml/zipball/eca9019c88fbe250164affd107bc8057771f3f4d",
- "reference": "eca9019c88fbe250164affd107bc8057771f3f4d",
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/34c8a4b51e751e7ea869b8262f883d008a2b81b8",
+ "reference": "34c8a4b51e751e7ea869b8262f883d008a2b81b8",
"shasum": ""
},
"require": {
@@ -3869,13 +3892,16 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.7-dev"
+ "dev-master": "2.8-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Yaml\\": ""
- }
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -3893,7 +3919,7 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
- "time": "2015-10-11 09:39:48"
+ "time": "2016-01-13 10:28:07"
}
],
"aliases": [],
@@ -3919,7 +3945,8 @@
"ext-intl": "*",
"ext-xsl": "*",
"ext-mbstring": "*",
- "ext-openssl": "*"
+ "ext-openssl": "*",
+ "ext-zip": "*"
},
"platform-dev": []
}
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFileTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFileTest.php
index b005c52813a7b..5653f9c0ea46c 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFileTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFileTest.php
@@ -175,6 +175,25 @@ public function testValidate()
$this->assertEquals($this->expectedValidate(), $result);
}
+ public function testEmptyFile()
+ {
+ $this->prepareEnvForEmptyFile();
+
+ $this->setExpectedException(
+ '\Magento\Framework\Exception\LocalizedException',
+ 'The file is empty. Please choose another one'
+ );
+
+ $httpAdapterMock = $this->getMock('Zend_File_Transfer_Adapter_Http', ['isValid']);
+ $httpAdapterMock->expects($this->once())->method('isValid')->will($this->returnValue(true));
+ $this->httpFactoryMock->expects($this->once())->method('create')->will($this->returnValue($httpAdapterMock));
+
+ $this->model->validate(
+ $this->objectManager->create('Magento\Framework\DataObject'),
+ $this->getProductOption()
+ );
+ }
+
/**
* @param array $options
* @return \Magento\Catalog\Model\Product\Option
@@ -233,6 +252,27 @@ protected function prepareEnv()
];
}
+ /**
+ * Test exception for empty file
+ *
+ * @return void
+ */
+ protected function prepareEnvForEmptyFile()
+ {
+ $file = 'magento_empty.jpg';
+
+ /** @var \Magento\Framework\Filesystem $filesystem */
+ $filesystem = $this->objectManager->get('Magento\Framework\Filesystem');
+ $tmpDirectory = $filesystem->getDirectoryWrite(\Magento\Framework\App\Filesystem\DirectoryList::SYS_TMP);
+ $filePath = $tmpDirectory->getAbsolutePath($file);
+
+ $_FILES['options_1_file'] = [
+ 'name' => 'test.jpg',
+ 'type' => 'image/jpeg',
+ 'tmp_name' => $filePath,
+ ];
+ }
+
/**
* @return array
*/
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/_files/product_simple.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/_files/product_simple.php
index 5b3ad31d63469..ddef0332af3b0 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/_files/product_simple.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/_files/product_simple.php
@@ -42,5 +42,5 @@
->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH)
->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED)
->setUrlKey('url-key')
- ->setUrlPath('url-key.html')
+ ->setUrlPath('url-key')
->save();
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/magento_empty.jpg b/dev/tests/integration/testsuite/Magento/Catalog/_files/magento_empty.jpg
new file mode 100644
index 0000000000000..e69de29bb2d1d
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/validate_image.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/validate_image.php
index 222ba1665b994..ab94752b170a2 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/_files/validate_image.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/validate_image.php
@@ -16,3 +16,6 @@
$targetTmpFilePath = $tmpDirectory->getAbsolutePath('magento_small_image.jpg');
copy(__DIR__ . '/magento_small_image.jpg', $targetTmpFilePath);
// Copying the image to target dir is not necessary because during product save, it will be moved there from tmp dir
+
+$targetTmpFilePath = $tmpDirectory->getAbsolutePath('magento_empty.jpg');
+copy(__DIR__ . '/magento_empty.jpg', $targetTmpFilePath);
diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php
index 2a89b0b2fb499..812ef1dfa44b1 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php
@@ -45,8 +45,14 @@ class ProductTest extends \PHPUnit_Framework_TestCase
*/
protected $_stockStateProvider;
+ /**
+ * @var \Magento\Framework\ObjectManagerInterface
+ */
+ protected $objectManager;
+
protected function setUp()
{
+ $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
$this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
'Magento\CatalogImportExport\Model\Import\Product'
);
@@ -93,9 +99,12 @@ public function testSaveProductsVisibility()
->create('Magento\Framework\Filesystem');
$directory = $filesystem->getDirectoryWrite(DirectoryList::ROOT);
- $source = new \Magento\ImportExport\Model\Import\Source\Csv(
- __DIR__ . '/_files/products_to_import.csv',
- $directory
+ $source = $this->objectManager->create(
+ '\Magento\ImportExport\Model\Import\Source\Csv',
+ [
+ 'file' => __DIR__ . '/_files/products_to_import.csv',
+ 'directory' => $directory
+ ]
);
$errors = $this->_model->setParameters(
['behavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND, 'entity' => 'catalog_product']
@@ -145,9 +154,12 @@ public function testSaveStockItemQty()
$filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
->create('Magento\Framework\Filesystem');
$directory = $filesystem->getDirectoryWrite(DirectoryList::ROOT);
- $source = new \Magento\ImportExport\Model\Import\Source\Csv(
- __DIR__ . '/_files/products_to_import.csv',
- $directory
+ $source = $this->objectManager->create(
+ '\Magento\ImportExport\Model\Import\Source\Csv',
+ [
+ 'file' => __DIR__ . '/_files/products_to_import.csv',
+ 'directory' => $directory
+ ]
);
$errors = $this->_model->setParameters(
['behavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND, 'entity' => 'catalog_product']
@@ -187,9 +199,12 @@ public function testStockState()
$filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
->create('Magento\Framework\Filesystem');
$directory = $filesystem->getDirectoryWrite(DirectoryList::ROOT);
- $source = new \Magento\ImportExport\Model\Import\Source\Csv(
- __DIR__ . '/_files/products_to_import_with_qty.csv',
- $directory
+ $source = $this->objectManager->create(
+ '\Magento\ImportExport\Model\Import\Source\Csv',
+ [
+ 'file' => __DIR__ . '/_files/products_to_import_with_qty.csv',
+ 'directory' => $directory
+ ]
);
$errors = $this->_model->setParameters(
@@ -218,7 +233,13 @@ public function testSaveCustomOptions($importFile, $sku)
->create('Magento\Framework\Filesystem');
$directory = $filesystem->getDirectoryWrite(DirectoryList::ROOT);
- $source = new \Magento\ImportExport\Model\Import\Source\Csv($pathToFile, $directory);
+ $source = $this->objectManager->create(
+ '\Magento\ImportExport\Model\Import\Source\Csv',
+ [
+ 'file' => $pathToFile,
+ 'directory' => $directory
+ ]
+ );
$errors = $this->_model->setParameters(
['behavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND, 'entity' => 'catalog_product']
)->setSource(
@@ -312,9 +333,12 @@ public function testSaveDatetimeAttribute()
->create('Magento\Framework\Filesystem');
$directory = $filesystem->getDirectoryWrite(DirectoryList::ROOT);
- $source = new \Magento\ImportExport\Model\Import\Source\Csv(
- __DIR__ . '/_files/products_to_import_with_datetime.csv',
- $directory
+ $source = $this->objectManager->create(
+ '\Magento\ImportExport\Model\Import\Source\Csv',
+ [
+ 'file' => __DIR__ . '/_files/products_to_import_with_datetime.csv',
+ 'directory' => $directory
+ ]
);
$errors = $this->_model->setParameters(
['behavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND, 'entity' => 'catalog_product']
@@ -518,9 +542,12 @@ public function testSaveMediaImage()
->create('Magento\Framework\Filesystem');
$directory = $filesystem->getDirectoryWrite(DirectoryList::ROOT);
- $source = new \Magento\ImportExport\Model\Import\Source\Csv(
- __DIR__ . '/_files/import_media.csv',
- $directory
+ $source = $this->objectManager->create(
+ '\Magento\ImportExport\Model\Import\Source\Csv',
+ [
+ 'file' => __DIR__ . '/_files/import_media.csv',
+ 'directory' => $directory
+ ]
);
$this->_model->setParameters(
[
@@ -636,7 +663,13 @@ public function testInvalidSkuLink()
'Magento\Framework\Filesystem'
);
$directory = $filesystem->getDirectoryWrite(DirectoryList::ROOT);
- $source = new \Magento\ImportExport\Model\Import\Source\Csv($pathToFile, $directory);
+ $source = $this->objectManager->create(
+ '\Magento\ImportExport\Model\Import\Source\Csv',
+ [
+ 'file' => $pathToFile,
+ 'directory' => $directory
+ ]
+ );
$errors = $this->_model->setParameters(
[
'behavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND,
@@ -677,9 +710,12 @@ public function testValidateInvalidMultiselectValues()
'Magento\Framework\Filesystem'
);
$directory = $filesystem->getDirectoryWrite(DirectoryList::ROOT);
- $source = new \Magento\ImportExport\Model\Import\Source\Csv(
- __DIR__ . '/_files/products_with_invalid_multiselect_values.csv',
- $directory
+ $source = $this->objectManager->create(
+ '\Magento\ImportExport\Model\Import\Source\Csv',
+ [
+ 'file' => __DIR__ . '/_files/products_with_invalid_multiselect_values.csv',
+ 'directory' => $directory
+ ]
);
$errors = $this->_model->setParameters(
['behavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND, 'entity' => 'catalog_product']
@@ -709,10 +745,12 @@ public function testProductsWithMultipleStores()
$filesystem = $objectManager->create('Magento\Framework\Filesystem');
$directory = $filesystem->getDirectoryWrite(DirectoryList::ROOT);
-
- $source = new \Magento\ImportExport\Model\Import\Source\Csv(
- __DIR__ . '/_files/products_multiple_stores.csv',
- $directory
+ $source = $this->objectManager->create(
+ '\Magento\ImportExport\Model\Import\Source\Csv',
+ [
+ 'file' => __DIR__ . '/_files/products_multiple_stores.csv',
+ 'directory' => $directory
+ ]
);
$errors = $this->_model->setParameters(
['behavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND, 'entity' => 'catalog_product']
@@ -752,7 +790,13 @@ public function testProductWithInvalidWeight()
);
$directory = $filesystem->getDirectoryWrite(DirectoryList::ROOT);
- $source = new \Magento\ImportExport\Model\Import\Source\Csv($pathToFile, $directory);
+ $source = $this->objectManager->create(
+ '\Magento\ImportExport\Model\Import\Source\Csv',
+ [
+ 'file' => $pathToFile,
+ 'directory' => $directory
+ ]
+ );
$errors = $this->_model->setSource(
$source
)->setParameters(
@@ -781,7 +825,13 @@ public function testProductCategories($fixture, $separator)
);
$directory = $filesystem->getDirectoryWrite(DirectoryList::ROOT);
- $source = new \Magento\ImportExport\Model\Import\Source\Csv($pathToFile, $directory);
+ $source = $this->objectManager->create(
+ '\Magento\ImportExport\Model\Import\Source\Csv',
+ [
+ 'file' => $pathToFile,
+ 'directory' => $directory
+ ]
+ );
$errors = $this->_model->setSource(
$source
)->setParameters(
@@ -819,4 +869,81 @@ public function categoryTestDataProvider()
['import_new_categories_custom_separator.csv', '|']
];
}
+
+ /**
+ * @magentoDataFixture Magento/Catalog/Model/ResourceModel/_files/product_simple.php
+ * @magentoAppIsolation enabled
+ * @dataProvider validateUrlKeysDataProvider
+ * @param $importFile string
+ * @param $errorsCount int
+ */
+ public function testValidateUrlKeys($importFile, $errorsCount)
+ {
+ $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ 'Magento\Framework\Filesystem'
+ );
+ $directory = $filesystem->getDirectoryWrite(DirectoryList::ROOT);
+
+ $source = $this->objectManager->create(
+ '\Magento\ImportExport\Model\Import\Source\Csv',
+ [
+ 'file' => __DIR__ . '/_files/' . $importFile,
+ 'directory' => $directory
+ ]
+ );
+ $errors = $this->_model->setParameters(
+ ['behavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND, 'entity' => 'catalog_product']
+ )->setSource(
+ $source
+ )->validateData();
+
+ $this->assertTrue($errors->getErrorsCount() == $errorsCount);
+ if ($errorsCount >= 1) {
+ $this->assertEquals(
+ "Specified url key is already exist",
+ $errors->getErrorByRowNumber(1)[0]->getErrorMessage()
+ );
+ }
+ }
+
+ /**
+ * @return array
+ */
+ public function validateUrlKeysDataProvider()
+ {
+ return [
+ ['products_to_check_valid_url_keys.csv', 0],
+ ['products_to_check_duplicated_url_keys.csv', 2],
+ ['products_to_check_duplicated_names.csv' , 1]
+ ];
+ }
+
+ /**
+ * @magentoDataFixture Magento/Store/_files/website.php
+ * @magentoDataFixture Magento/Store/_files/core_fixturestore.php
+ * @magentoDataFixture Magento/Catalog/Model/ResourceModel/_files/product_simple.php
+ * @magentoAppIsolation enabled
+ */
+ public function testValidateUrlKeysMultipleStores()
+ {
+ $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ 'Magento\Framework\Filesystem'
+ );
+ $directory = $filesystem->getDirectoryWrite(DirectoryList::ROOT);
+
+ $source = $this->objectManager->create(
+ '\Magento\ImportExport\Model\Import\Source\Csv',
+ [
+ 'file' => __DIR__ . '/_files/products_to_check_valid_url_keys_multiple_stores.csv',
+ 'directory' => $directory
+ ]
+ );
+ $errors = $this->_model->setParameters(
+ ['behavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND, 'entity' => 'catalog_product']
+ )->setSource(
+ $source
+ )->validateData();
+
+ $this->assertTrue($errors->getErrorsCount() == 0);
+ }
}
diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/products_to_check_duplicated_names.csv b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/products_to_check_duplicated_names.csv
new file mode 100644
index 0000000000000..3813e7fd775c5
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/products_to_check_duplicated_names.csv
@@ -0,0 +1,4 @@
+sku,product_type,store_view_code,name,price,attribute_set_code
+simple1,simple,,"simple 1",25,Default
+simple2,simple,,"simple 1",34,Default
+simple3,simple,,"simple 2",58,Default
diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/products_to_check_duplicated_url_keys.csv b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/products_to_check_duplicated_url_keys.csv
new file mode 100644
index 0000000000000..879342569bbff
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/products_to_check_duplicated_url_keys.csv
@@ -0,0 +1,4 @@
+sku,product_type,store_view_code,name,price,attribute_set_code,url_key
+simple1,simple,,"simple 1",25,Default,key1
+simple2,simple,,"simple 2",34,Default,key1
+simple3,simple,,"simple 3",58,Default,url-key
diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/products_to_check_valid_url_keys.csv b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/products_to_check_valid_url_keys.csv
new file mode 100644
index 0000000000000..821781a938865
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/products_to_check_valid_url_keys.csv
@@ -0,0 +1,4 @@
+sku,product_type,store_view_code,name,price,attribute_set_code,url_key
+simple1,simple,,"simple 1",25,Default,key1
+simple2,simple,,"simple 2",34,Default,key2
+simple3,simple,,"simple 3",58,Default,key3
diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/products_to_check_valid_url_keys_multiple_stores.csv b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/products_to_check_valid_url_keys_multiple_stores.csv
new file mode 100644
index 0000000000000..7cd3b3a7ff283
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/products_to_check_valid_url_keys_multiple_stores.csv
@@ -0,0 +1,7 @@
+sku,product_type,store_view_code,name,price,attribute_set_code,url_key
+simple1,simple,,"simple",25,Default,key1
+simple1,simple,default,"simple",34,Default,key1
+simple1,simple,fixturestore,"simple",58,Default,key1
+simple2,simple,,"simple",25,Default,key2
+simple2,simple,default,"simple",34,Default,
+simple2,simple,fixturestore,"simple",58,Default,
\ No newline at end of file
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Code/_expected/SourceClassWithNamespaceProxy.php.sample b/dev/tests/integration/testsuite/Magento/Framework/Code/_expected/SourceClassWithNamespaceProxy.php.sample
index 5ee9c95448ef8..9074f2a8e0926 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Code/_expected/SourceClassWithNamespaceProxy.php.sample
+++ b/dev/tests/integration/testsuite/Magento/Framework/Code/_expected/SourceClassWithNamespaceProxy.php.sample
@@ -7,7 +7,7 @@ namespace Magento\Framework\Code\GeneratorTest\SourceClassWithNamespace;
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-class Proxy extends \Magento\Framework\Code\GeneratorTest\SourceClassWithNamespace
+class Proxy extends \Magento\Framework\Code\GeneratorTest\SourceClassWithNamespace implements \Magento\Framework\ObjectManager\NoninterceptableInterface
{
/**
* Object Manager instance
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.json b/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.json
index 55c5e6591f085..53009187a595a 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.json
+++ b/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.json
@@ -39,11 +39,5 @@
}
},
"minimum-stability": "alpha",
- "prefer-stable": true,
- "repositories": [
- {
- "type": "composer",
- "url": "https://repo.magento.com/"
- }
- ]
+ "prefer-stable": true
}
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.json b/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.json
index a8f4e398d2609..2625b60abff4f 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.json
+++ b/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.json
@@ -4,12 +4,6 @@
"magento/product-community-edition": "0.74.0-beta2",
"magento/sample-module-minimal" : "*"
},
- "repositories": [
- {
- "type": "composer",
- "url": "https://repo.magento.com/"
- }
- ],
"autoload": {
"psr-4": {
"Magento\\Framework\\": "htdocs/lib/internal/Magento/Framework/",
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Filesystem/Driver/FileTest.php b/dev/tests/integration/testsuite/Magento/Framework/Filesystem/Driver/FileTest.php
index 7dbb721cfc39f..d7c15828557fd 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Filesystem/Driver/FileTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Filesystem/Driver/FileTest.php
@@ -66,4 +66,16 @@ public function testReadDirectoryRecursivelyFailure()
{
$this->driver->readDirectoryRecursively($this->getTestPath('not-existing-directory'));
}
+
+ public function testCreateDirectory()
+ {
+ $generatedPath = $this->getTestPath('generated/roo/bar/baz/foo');
+ $generatedPathBase = $this->getTestPath('generated');
+ // Delete the generated directory if it already exists
+ if (is_dir($generatedPath)) {
+ $this->assertTrue($this->driver->deleteDirectory($generatedPathBase));
+ }
+ $this->assertTrue($this->driver->createDirectory($generatedPath, '755'));
+ $this->assertTrue(is_dir($generatedPath));
+ }
}
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Element/AbstractBlockTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/Element/AbstractBlockTest.php
index ef1ea1fd983ee..fb4873b17fd95 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/View/Element/AbstractBlockTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/Element/AbstractBlockTest.php
@@ -5,6 +5,8 @@
*/
namespace Magento\Framework\View\Element;
+use Magento\Framework\View\Element\AbstractBlock;
+
/**
* @magentoAppIsolation enabled
*/
@@ -556,7 +558,7 @@ public function testGetCacheKey()
$this->assertNotEquals($name, $key);
$block->setCacheKey('key');
- $this->assertEquals('key', $block->getCacheKey());
+ $this->assertEquals(AbstractBlock::CACHE_KEY_PREFIX . 'key', $block->getCacheKey());
}
/**
diff --git a/dev/tests/integration/testsuite/Magento/GoogleOptimizer/Observer/Block/Category/AddGoogleExperimentFieldsObserverTest.php b/dev/tests/integration/testsuite/Magento/GoogleOptimizer/Observer/Block/Category/AddGoogleExperimentFieldsObserverTest.php
new file mode 100644
index 0000000000000..319d9909682f5
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/GoogleOptimizer/Observer/Block/Category/AddGoogleExperimentFieldsObserverTest.php
@@ -0,0 +1,67 @@
+objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
+ $this->config = $this->objectManager->create(
+ 'Magento\Config\Model\ResourceModel\Config'
+ );
+ $this->config->saveConfig('google/analytics/active', 1, 'default', 0);
+ $this->config->saveConfig('google/analytics/type', 'universal', 'default', 0);
+ $this->config->saveConfig('google/analytics/experiments', 1, 'default', 0);
+ $this->config->saveConfig('google/analytics/account', 1234567890, 'default', 0);
+ $this->resetConfig();
+ }
+
+ /**
+ * @magentoAppIsolation enabled
+ * @magentoDbIsolation enabled
+ */
+ public function testExecute()
+ {
+ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
+ /** @var \Magento\Catalog\Block\Adminhtml\Product\Edit\NewCategory $newCategoryForm */
+ $newCategoryForm = $objectManager->get('Magento\Catalog\Block\Adminhtml\Product\Edit\NewCategory');
+ $html = $newCategoryForm->toHtml();
+ $this->assertContains('name="google_experiment[code_id]"', $html);
+ $this->assertContains('name="google_experiment[experiment_script]"', $html);
+ }
+
+ protected function tearDown()
+ {
+ $this->config->deleteConfig('google/analytics/active', 'default', 0);
+ $this->config->deleteConfig('google/analytics/type', 'default', 0);
+ $this->config->deleteConfig('google/analytics/experiments', 'default', 0);
+ $this->config->deleteConfig('google/analytics/account', 'default', 0);
+ $this->resetConfig();
+ }
+
+ /**
+ * Clear config cache
+ */
+ protected function resetConfig()
+ {
+ $this->objectManager->get('Magento\Framework\App\Config\ReinitableConfigInterface')->reinit();
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Model/UpdatePackagesCacheTest.php b/dev/tests/integration/testsuite/Magento/Setup/Model/UpdatePackagesCacheTest.php
index 939054260269b..690f7e6a4dbd2 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Model/UpdatePackagesCacheTest.php
+++ b/dev/tests/integration/testsuite/Magento/Setup/Model/UpdatePackagesCacheTest.php
@@ -6,11 +6,10 @@
namespace Magento\Setup\Model;
-use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\TestFramework\Helper\Bootstrap;
use Magento\Framework\Composer\ComposerJsonFinder;
use Magento\Framework\Composer\MagentoComposerApplicationFactory;
-use Magento\Framework\Stdlib\DateTime\DateTime;
+use Magento\Setup\Model\UpdatePackagesCache;
/**
* Tests Magento\Framework\ComposerInformation
@@ -88,19 +87,19 @@ public function testGetPackagesForUpdate()
->method('get')
->willReturn($this->objectManager);
- /** @var \Magento\Setup\Model\UpdatePackagesCache $updatePackagesCache */
- $updatePackagesCache = $this->objectManager->create(
- 'Magento\Setup\Model\UpdatePackagesCache',
- [
- 'applicationFactory' => new MagentoComposerApplicationFactory(
- $this->composerJsonFinder,
- $this->directoryList
- ),
- 'filesystem' => $this->filesystem,
- 'composerInformation' => $this->composerInformation,
- 'objectManagerProvider' => $objectManagerProvider,
+ /** @var UpdatePackagesCache $updatePackagesCache|\PHPUnit_Framework_MockObject_MockObject */
+ $updatePackagesCache = $this->getMock('Magento\Setup\Model\UpdatePackagesCache', [], [], '', false);
+
+ $packages = [
+ 'packages' => [
+ $packageName => [
+ 'latestVersion' => '1000.100.200'
+ ]
]
- );
+ ];
+
+ $updatePackagesCache->expects($this->once())->method('syncPackagesForUpdate')->willReturn(true);
+ $updatePackagesCache->expects($this->once())->method('getPackagesForUpdate')->willReturn($packages);
$requiredPackages = $this->composerInformation->getInstalledMagentoPackages();
$this->assertArrayHasKey($packageName, $requiredPackages);
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Model/_files/testSkeleton/composer.json b/dev/tests/integration/testsuite/Magento/Setup/Model/_files/testSkeleton/composer.json
index a8f4e398d2609..2625b60abff4f 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Model/_files/testSkeleton/composer.json
+++ b/dev/tests/integration/testsuite/Magento/Setup/Model/_files/testSkeleton/composer.json
@@ -4,12 +4,6 @@
"magento/product-community-edition": "0.74.0-beta2",
"magento/sample-module-minimal" : "*"
},
- "repositories": [
- {
- "type": "composer",
- "url": "https://repo.magento.com/"
- }
- ],
"autoload": {
"psr-4": {
"Magento\\Framework\\": "htdocs/lib/internal/Magento/Framework/",
diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/PageCache/frontend/js/page-cache.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/PageCache/frontend/js/page-cache.test.js
index 1f7a247a2faf1..8df486f29c6fb 100644
--- a/dev/tests/js/jasmine/tests/app/code/Magento/PageCache/frontend/js/page-cache.test.js
+++ b/dev/tests/js/jasmine/tests/app/code/Magento/PageCache/frontend/js/page-cache.test.js
@@ -64,64 +64,6 @@ define([
});
});
- describe('Testing msgBox Widget', function () {
- var wdContainer,
- msgCookieName,
- msgContainer;
-
- beforeEach(function () {
- wdContainer = $('');
- msgContainer = $('');
- msgCookieName = 'FAKE_COOKIE';
- });
-
- afterEach(function () {
- $(wdContainer).remove();
- $(msgContainer).remove();
- });
-
- it('widget extends jQuery object', function () {
- expect($.fn.msgBox).toBeDefined();
- });
-
- it('widget gets options', function () {
- wdContainer.msgBox({
- 'msgBoxCookieName': msgCookieName
- });
- expect(wdContainer.msgBox('option', 'msgBoxCookieName')).toBe('FAKE_COOKIE');
- });
-
- it('widget disables cookie if it exist', function () {
- spyOn($.mage.cookies, 'get').and.returnValue('FAKE_MAGE_COOKIE');
- spyOn($.mage.cookies, 'clear');
-
- wdContainer.msgBox({
- 'msgBoxSelector': msgContainer
- });
-
- expect($.mage.cookies.get).toHaveBeenCalled();
- expect($.mage.cookies.clear).toHaveBeenCalled();
- });
-
- it('widget disables messageBox if cookie not exist', function () {
- spyOn($.mage.cookies, 'get');
-
- wdContainer.msgBox({
- 'msgBoxSelector': msgContainer
- });
-
- expect($.mage.cookies.get).toHaveBeenCalled();
- expect(msgContainer.is(':hidden')).toBeTruthy();
- });
-
- it('widget exist on load on body', function (done) {
- $(function () {
- expect($('body').data('mageMsgBox')).toBeDefined();
- done();
- });
- });
- });
-
describe('Testing FormKey Widget', function () {
var wdContainer,
msgCookieName,
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php
index a03cced85cf25..6a88c679b8f1d 100755
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php
@@ -3878,6 +3878,7 @@
'Magento\Framework\Component\ComponentRegistrar'
],
['Magento\Framework\App\Router\ActionList\Reader'],
+ ['Magento\User\Observer\Backend\CheckAdminPasswordChangeObserver'],
['Magento\Framework\View\File\AbstractCollector'],
['Magento\Tools\Migration\Acl\FileManager'],
['Magento\Tools\Migration\Acl\Formatter'],
diff --git a/lib/internal/Magento/Framework/App/AreaList/Proxy.php b/lib/internal/Magento/Framework/App/AreaList/Proxy.php
index 7f2b0a63dbcd8..e7f39ff8aa3e3 100644
--- a/lib/internal/Magento/Framework/App/AreaList/Proxy.php
+++ b/lib/internal/Magento/Framework/App/AreaList/Proxy.php
@@ -7,7 +7,8 @@
*/
namespace Magento\Framework\App\AreaList;
-class Proxy extends \Magento\Framework\App\AreaList
+class Proxy extends \Magento\Framework\App\AreaList implements
+ \Magento\Framework\ObjectManager\NoninterceptableInterface
{
/**
* Object Manager instance
diff --git a/lib/internal/Magento/Framework/App/Cache/Proxy.php b/lib/internal/Magento/Framework/App/Cache/Proxy.php
index 932d5b0c265c8..2e50e0b5d042f 100644
--- a/lib/internal/Magento/Framework/App/Cache/Proxy.php
+++ b/lib/internal/Magento/Framework/App/Cache/Proxy.php
@@ -3,15 +3,17 @@
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
+namespace Magento\Framework\App\Cache;
+
+use \Magento\Framework\App\CacheInterface;
+use \Magento\Framework\ObjectManager\NoninterceptableInterface;
/**
* System cache proxy model
*/
-namespace Magento\Framework\App\Cache;
-
-use Magento\Framework\App\CacheInterface;
-
-class Proxy implements CacheInterface
+class Proxy implements
+ CacheInterface,
+ NoninterceptableInterface
{
/**
* @var \Magento\Framework\ObjectManagerInterface
diff --git a/lib/internal/Magento/Framework/App/ObjectManager/Environment/Developer.php b/lib/internal/Magento/Framework/App/ObjectManager/Environment/Developer.php
index 09d25c7de4d1b..df2a6ceee56e0 100644
--- a/lib/internal/Magento/Framework/App/ObjectManager/Environment/Developer.php
+++ b/lib/internal/Magento/Framework/App/ObjectManager/Environment/Developer.php
@@ -62,6 +62,7 @@ public function getObjectManagerConfigLoader()
*/
public function configureObjectManager(ConfigInterface $diConfig, &$sharedInstances)
{
+ $originalSharedInstances = $sharedInstances;
$objectManager = ObjectManager::getInstance();
$sharedInstances['Magento\Framework\ObjectManager\ConfigLoaderInterface'] = $objectManager
->get('Magento\Framework\App\ObjectManager\ConfigLoader');
@@ -80,5 +81,9 @@ public function configureObjectManager(ConfigInterface $diConfig, &$sharedInstan
$diConfig->setInterceptionConfig(
$objectManager->get('Magento\Framework\Interception\Config\Config')
);
+ /** Reset the shared instances once interception config is set so classes can be intercepted if necessary */
+ $sharedInstances = $originalSharedInstances;
+ $sharedInstances['Magento\Framework\ObjectManager\ConfigLoaderInterface'] = $objectManager
+ ->get('Magento\Framework\App\ObjectManager\ConfigLoader');
}
}
diff --git a/lib/internal/Magento/Framework/App/ResourceConnection/ConnectionFactory.php b/lib/internal/Magento/Framework/App/ResourceConnection/ConnectionFactory.php
index 7924f4babdac9..f054c815916c2 100644
--- a/lib/internal/Magento/Framework/App/ResourceConnection/ConnectionFactory.php
+++ b/lib/internal/Magento/Framework/App/ResourceConnection/ConnectionFactory.php
@@ -22,9 +22,9 @@ class ConnectionFactory extends ModelConnectionFactory
public function create(array $connectionConfig)
{
$connection = parent::create($connectionConfig);
- /** @var \Magento\Framework\App\Cache\Type\FrontendPool $pool */
- $pool = $this->objectManager->get(\Magento\Framework\App\Cache\Type\FrontendPool::class);
- $connection->setCacheAdapter($pool->get(DdlCache::TYPE_IDENTIFIER));
+ /** @var \Magento\Framework\DB\Adapter\DdlCache $ddlCache */
+ $ddlCache = $this->objectManager->get(\Magento\Framework\DB\Adapter\DdlCache::class);
+ $connection->setCacheAdapter($ddlCache);
return $connection;
}
}
diff --git a/lib/internal/Magento/Framework/App/Route/ConfigInterface/Proxy.php b/lib/internal/Magento/Framework/App/Route/ConfigInterface/Proxy.php
index 50a02c458595a..50056798c85ea 100644
--- a/lib/internal/Magento/Framework/App/Route/ConfigInterface/Proxy.php
+++ b/lib/internal/Magento/Framework/App/Route/ConfigInterface/Proxy.php
@@ -10,7 +10,9 @@
/**
* Proxy class for \Magento\Framework\App\ResourceConnection
*/
-class Proxy implements \Magento\Framework\App\Route\ConfigInterface
+class Proxy implements
+ \Magento\Framework\App\Route\ConfigInterface,
+ \Magento\Framework\ObjectManager\NoninterceptableInterface
{
/**
* Object Manager instance
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/Environment/DeveloperTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/Environment/DeveloperTest.php
index c86318181a2c0..6e7ddc94f3d26 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/Environment/DeveloperTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/Environment/DeveloperTest.php
@@ -5,6 +5,7 @@
*/
namespace Magento\Framework\App\Test\Unit\ObjectManager\Environment;
+use Magento\Framework\App\ObjectManager;
use Magento\Framework\App\ObjectManager\Environment\Developer;
class DeveloperTest extends \PHPUnit_Framework_TestCase
@@ -29,4 +30,61 @@ public function testGetObjectManagerConfigLoader()
{
$this->assertNull($this->_developer->getObjectManagerConfigLoader());
}
+
+ public function testConfigureObjectManager()
+ {
+ try {
+ $origObjectManager = ObjectManager::getInstance();
+ } catch (\Exception $e) {
+ $origObjectManager = null;
+ }
+
+
+ $objectManagerMock = $this->getMockBuilder('Magento\Framework\App\ObjectManager')
+ ->disableOriginalConstructor()
+ ->getMock();
+ ObjectManager::setInstance($objectManagerMock);
+ $diConfigMock = $this->getMockBuilder('\Magento\Framework\Interception\ObjectManager\ConfigInterface')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $configLoaderMock = $this->getMockBuilder('Magento\Framework\App\ObjectManager\ConfigLoader')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $configLoaderMock->expects($this->any())->method('load')->willReturn([]);
+ $omReturnMap = [
+ ['Magento\Framework\App\ObjectManager\ConfigLoader', $configLoaderMock],
+ [
+ 'Magento\Framework\Config\ScopeInterface',
+ $this->getMockBuilder('Magento\Framework\Config\ScopeInterface')
+ ->disableOriginalConstructor()
+ ->getMock()
+ ],
+ [
+ 'Magento\Framework\App\ObjectManager\ConfigCache',
+ $this->getMockBuilder('Magento\Framework\App\ObjectManager\ConfigCache')
+ ->disableOriginalConstructor()
+ ->getMock()
+ ],
+ [
+ 'Magento\Framework\Interception\Config\Config',
+ $this->getMockBuilder('Magento\Framework\Interception\Config\Config')
+ ->disableOriginalConstructor()
+ ->getMock()
+ ]
+ ];
+ $objectManagerMock->expects($this->any())->method('get')->willReturnMap($omReturnMap);
+
+ $sharedInstances = ['class_name' => 'shared_object'];
+ $this->_developer->configureObjectManager($diConfigMock, $sharedInstances);
+
+ $expectedSharedInstances = [
+ 'class_name' => 'shared_object',
+ 'Magento\Framework\ObjectManager\ConfigLoaderInterface' => $configLoaderMock
+ ];
+ $this->assertSame($expectedSharedInstances, $sharedInstances);
+ if (isset($origObjectManager)) {
+ ObjectManager::setInstance($origObjectManager);
+ }
+ }
}
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConnectionFactoryTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConnectionFactoryTest.php
index 8a1b7296bbff1..77e6c428ae9b2 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConnectionFactoryTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConnectionFactoryTest.php
@@ -5,8 +5,6 @@
*/
namespace Magento\Framework\App\Test\Unit\ResourceConnection;
-use Magento\Framework\DB\Adapter\DdlCache;
-
class ConnectionFactoryTest extends \PHPUnit_Framework_TestCase
{
/**
@@ -38,7 +36,7 @@ protected function setUp()
public function testCreate()
{
- $cacheAdapterMock = $this->getMockBuilder('Magento\Framework\Cache\FrontendInterface')
+ $cacheAdapterMock = $this->getMockBuilder('Magento\Framework\DB\Adapter\DdlCache')
->disableOriginalConstructor()
->getMock();
$loggerMock = $this->getMockBuilder('Magento\Framework\DB\LoggerInterface')
@@ -63,19 +61,12 @@ public function testCreate()
->method('create')
->with('Magento\Framework\App\ResourceConnection\ConnectionAdapterInterface')
->will($this->returnValue($connectionAdapterMock));
- $poolMock = $this->getMockBuilder('Magento\Framework\App\Cache\Type\FrontendPool')
- ->disableOriginalConstructor()
- ->getMock();
- $poolMock->expects($this->once())
- ->method('get')
- ->with(DdlCache::TYPE_IDENTIFIER)
- ->will($this->returnValue($cacheAdapterMock));
$this->objectManagerMock->expects($this->any())
->method('get')
->will($this->returnValueMap(
[
['Magento\Framework\DB\LoggerInterface', $loggerMock],
- ['Magento\Framework\App\Cache\Type\FrontendPool', $poolMock],
+ ['Magento\Framework\DB\Adapter\DdlCache', $cacheAdapterMock],
]
));
$this->assertSame($connectionMock, $this->model->create(['active' => true]));
diff --git a/lib/internal/Magento/Framework/AppInterface.php b/lib/internal/Magento/Framework/AppInterface.php
index 15589f0eabcca..bedc458904ee2 100644
--- a/lib/internal/Magento/Framework/AppInterface.php
+++ b/lib/internal/Magento/Framework/AppInterface.php
@@ -17,7 +17,7 @@ interface AppInterface
/**
* Magento version
*/
- const VERSION = '2.0.0';
+ const VERSION = '2.0.2';
/**
* Launch application
diff --git a/lib/internal/Magento/Framework/Archive/Zip.php b/lib/internal/Magento/Framework/Archive/Zip.php
index d6ba5c970cfa5..b3abd075fc8f9 100644
--- a/lib/internal/Magento/Framework/Archive/Zip.php
+++ b/lib/internal/Magento/Framework/Archive/Zip.php
@@ -21,7 +21,7 @@ public function __construct()
$type = 'Zip';
if (!class_exists('\ZipArchive')) {
throw new \Magento\Framework\Exception\LocalizedException(
- new \Magento\Framework\Phrase('\'%1\' file extension is not supported', $type)
+ new \Magento\Framework\Phrase('\'%1\' file extension is not supported', [$type])
);
}
}
diff --git a/lib/internal/Magento/Framework/Config/Reader/Filesystem.php b/lib/internal/Magento/Framework/Config/Reader/Filesystem.php
index bbe3544318f84..e1b271f9bd0f1 100644
--- a/lib/internal/Magento/Framework/Config/Reader/Filesystem.php
+++ b/lib/internal/Magento/Framework/Config/Reader/Filesystem.php
@@ -67,6 +67,16 @@ class Filesystem implements \Magento\Framework\Config\ReaderInterface
*/
protected $validationState;
+ /**
+ * @var string
+ */
+ protected $_defaultScope;
+
+ /**
+ * @var string
+ */
+ protected $_schemaFile;
+
/**
* Constructor
*
diff --git a/lib/internal/Magento/Framework/Data/Form/FormKey.php b/lib/internal/Magento/Framework/Data/Form/FormKey.php
index 6a5485d7bb4f2..55d841ff35194 100644
--- a/lib/internal/Magento/Framework/Data/Form/FormKey.php
+++ b/lib/internal/Magento/Framework/Data/Form/FormKey.php
@@ -22,16 +22,24 @@ class FormKey
*/
protected $session;
+ /**
+ * @var \Magento\Framework\Escaper
+ */
+ protected $escaper;
+
/**
* @param \Magento\Framework\Math\Random $mathRandom
* @param \Magento\Framework\Session\SessionManagerInterface $session
+ * @param \Magento\Framework\Escaper $escaper
*/
public function __construct(
\Magento\Framework\Math\Random $mathRandom,
- \Magento\Framework\Session\SessionManagerInterface $session
+ \Magento\Framework\Session\SessionManagerInterface $session,
+ \Magento\Framework\Escaper $escaper
) {
$this->mathRandom = $mathRandom;
$this->session = $session;
+ $this->escaper = $escaper;
}
/**
@@ -44,7 +52,7 @@ public function getFormKey()
if (!$this->isPresent()) {
$this->set($this->mathRandom->getRandomString(16));
}
- return $this->session->getData(self::FORM_KEY);
+ return $this->escaper->escapeHtmlAttr($this->session->getData(self::FORM_KEY));
}
/**
diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/FormKeyTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/FormKeyTest.php
index 5adb36c4ccef7..de92b3b911c69 100644
--- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/FormKeyTest.php
+++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/FormKeyTest.php
@@ -22,6 +22,11 @@ class FormKeyTest extends \PHPUnit_Framework_TestCase
*/
protected $sessionMock;
+ /**
+ * @var \Zend\Escaper\Escaper|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $escaperMock;
+
/**
* @var FormKey
*/
@@ -32,9 +37,12 @@ protected function setUp()
$this->mathRandomMock = $this->getMock('Magento\Framework\Math\Random', [], [], '', false);
$methods = ['setData', 'getData'];
$this->sessionMock = $this->getMock('Magento\Framework\Session\SessionManager', $methods, [], '', false);
+ $this->escaperMock = $this->getMock('Magento\Framework\Escaper', [], [], '', false);
+ $this->escaperMock->expects($this->any())->method('escapeHtmlAttr')->willReturnArgument(0);
$this->formKey = new FormKey(
$this->mathRandomMock,
- $this->sessionMock
+ $this->sessionMock,
+ $this->escaperMock
);
}
diff --git a/lib/internal/Magento/Framework/DataObject/Copy/Config/Data/Proxy.php b/lib/internal/Magento/Framework/DataObject/Copy/Config/Data/Proxy.php
index 85abc882c7bb4..480af7b06ac86 100644
--- a/lib/internal/Magento/Framework/DataObject/Copy/Config/Data/Proxy.php
+++ b/lib/internal/Magento/Framework/DataObject/Copy/Config/Data/Proxy.php
@@ -8,7 +8,8 @@
/**
* Proxy class for @see \Magento\Framework\DataObject\Copy\Config\Data
*/
-class Proxy extends \Magento\Framework\DataObject\Copy\Config\Data
+class Proxy extends \Magento\Framework\DataObject\Copy\Config\Data implements
+ \Magento\Framework\ObjectManager\NoninterceptableInterface
{
/**
* Object Manager instance
diff --git a/lib/internal/Magento/Framework/Escaper.php b/lib/internal/Magento/Framework/Escaper.php
index f28374eb0ac61..c6792dc93fa89 100644
--- a/lib/internal/Magento/Framework/Escaper.php
+++ b/lib/internal/Magento/Framework/Escaper.php
@@ -8,7 +8,7 @@
/**
* Magento escape methods
*/
-class Escaper
+class Escaper extends \Zend\Escaper\Escaper
{
/**
* Escape html entities
diff --git a/lib/internal/Magento/Framework/Event/Config/Converter.php b/lib/internal/Magento/Framework/Event/Config/Converter.php
index c06372a5c0732..f979ccedb1a36 100644
--- a/lib/internal/Magento/Framework/Event/Config/Converter.php
+++ b/lib/internal/Magento/Framework/Event/Config/Converter.php
@@ -38,7 +38,7 @@ public function convert($source)
$config['name'] = $observerNameNode->nodeValue;
$eventObservers[$observerNameNode->nodeValue] = $config;
}
- $output[$eventName] = $eventObservers;
+ $output[mb_strtolower($eventName)] = $eventObservers;
}
return $output;
}
diff --git a/lib/internal/Magento/Framework/Event/Manager.php b/lib/internal/Magento/Framework/Event/Manager.php
index 7f6916ddf1dc3..4451dabc35f59 100644
--- a/lib/internal/Magento/Framework/Event/Manager.php
+++ b/lib/internal/Magento/Framework/Event/Manager.php
@@ -53,6 +53,7 @@ public function __construct(InvokerInterface $invoker, ConfigInterface $eventCon
*/
public function dispatch($eventName, array $data = [])
{
+ $eventName = mb_strtolower($eventName);
\Magento\Framework\Profiler::start('EVENT:' . $eventName, ['group' => 'EVENT', 'name' => $eventName]);
foreach ($this->_eventConfig->getObservers($eventName) as $observerConfig) {
$event = new \Magento\Framework\Event($data);
diff --git a/lib/internal/Magento/Framework/Event/Test/Unit/Config/ConverterTest.php b/lib/internal/Magento/Framework/Event/Test/Unit/Config/ConverterTest.php
index e0c9593e5cf21..91bade40692c8 100644
--- a/lib/internal/Magento/Framework/Event/Test/Unit/Config/ConverterTest.php
+++ b/lib/internal/Magento/Framework/Event/Test/Unit/Config/ConverterTest.php
@@ -5,35 +5,44 @@
*/
namespace Magento\Framework\Event\Test\Unit\Config;
+use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
+use Magento\Framework\Event\Config\Converter;
+
class ConverterTest extends \PHPUnit_Framework_TestCase
{
/**
- * @var \Magento\Framework\Event\Config\Converter
+ * @var Converter
*/
- protected $_model;
+ protected $model;
/**
* @var string
*/
- protected $_filePath;
+ protected $filePath;
/**
* @var \DOMDocument
*/
- protected $_source;
+ protected $source;
+
+ /**
+ * @var ObjectManagerHelper
+ */
+ protected $objectManagerHelper;
protected function setUp()
{
- $this->_filePath = __DIR__ . '/_files/';
- $this->_source = new \DOMDocument();
- $this->_model = new \Magento\Framework\Event\Config\Converter();
+ $this->objectManagerHelper = new ObjectManagerHelper($this);
+ $this->filePath = __DIR__ . '/_files/';
+ $this->source = new \DOMDocument();
+ $this->model = $this->objectManagerHelper->getObject(Converter::class);
}
public function testConvert()
{
- $this->_source->loadXML(file_get_contents($this->_filePath . 'event_config.xml'));
- $convertedFile = include $this->_filePath . 'event_config.php';
- $this->assertEquals($convertedFile, $this->_model->convert($this->_source));
+ $this->source->loadXML(file_get_contents($this->filePath . 'event_config.xml'));
+ $convertedFile = include $this->filePath . 'event_config.php';
+ $this->assertEquals($convertedFile, $this->model->convert($this->source));
}
/**
@@ -42,7 +51,7 @@ public function testConvert()
*/
public function testConvertThrowsExceptionWhenDomIsInvalid()
{
- $this->_source->loadXML(file_get_contents($this->_filePath . 'event_invalid_config.xml'));
- $this->_model->convert($this->_source);
+ $this->source->loadXML(file_get_contents($this->filePath . 'event_invalid_config.xml'));
+ $this->model->convert($this->source);
}
}
diff --git a/lib/internal/Magento/Framework/Event/Test/Unit/Config/_files/event_config.php b/lib/internal/Magento/Framework/Event/Test/Unit/Config/_files/event_config.php
index 141b0b4b927db..88d9961b928d2 100644
--- a/lib/internal/Magento/Framework/Event/Test/Unit/Config/_files/event_config.php
+++ b/lib/internal/Magento/Framework/Event/Test/Unit/Config/_files/event_config.php
@@ -15,5 +15,8 @@
'shared' => false,
'name' => 'observer_2',
],
+ ],
+ 'some_eventname' => [
+ 'observer_3' => ['instance' => 'instance_3', 'name' => 'observer_3'],
]
];
diff --git a/lib/internal/Magento/Framework/Event/Test/Unit/Config/_files/event_config.xml b/lib/internal/Magento/Framework/Event/Test/Unit/Config/_files/event_config.xml
index 87dcbc0d45972..228fa6b5251b8 100644
--- a/lib/internal/Magento/Framework/Event/Test/Unit/Config/_files/event_config.xml
+++ b/lib/internal/Magento/Framework/Event/Test/Unit/Config/_files/event_config.xml
@@ -13,4 +13,7 @@
+
+
+
\ No newline at end of file
diff --git a/lib/internal/Magento/Framework/Event/Test/Unit/ManagerTest.php b/lib/internal/Magento/Framework/Event/Test/Unit/ManagerTest.php
index 6c519bc6fbbe3..43f79df53c2d9 100644
--- a/lib/internal/Magento/Framework/Event/Test/Unit/ManagerTest.php
+++ b/lib/internal/Magento/Framework/Event/Test/Unit/ManagerTest.php
@@ -5,6 +5,11 @@
*/
namespace Magento\Framework\Event\Test\Unit;
+use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
+use Magento\Framework\Event\InvokerInterface;
+use Magento\Framework\Event\ConfigInterface;
+use Magento\Framework\Event\Manager as EventManager;
+
/**
* Class ManagerTest
*
@@ -15,74 +20,74 @@ class ManagerTest extends \PHPUnit_Framework_TestCase
/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
- protected $_invoker;
+ protected $invokerMock;
/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
- protected $_eventFactory;
+ protected $eventFactory;
/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
- protected $_event;
+ protected $event;
/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
- protected $_wrapperFactory;
+ protected $wrapperFactory;
/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
- protected $_observer;
+ protected $observer;
/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
- protected $_eventConfigMock;
+ protected $eventConfigMock;
/**
* @var \Magento\Framework\Event\Manager
*/
- protected $_eventManager;
+ protected $eventManager;
+
+ /**
+ * @var ObjectManagerHelper
+ */
+ protected $objectManagerHelper;
protected function setUp()
{
- $this->_invoker = $this->getMock('Magento\Framework\Event\InvokerInterface');
- $this->_eventConfigMock = $this->getMock('Magento\Framework\Event\ConfigInterface');
+ $this->objectManagerHelper = new ObjectManagerHelper($this);
+ $this->invokerMock = $this->getMock(InvokerInterface::class);
+ $this->eventConfigMock = $this->getMock(ConfigInterface::class);
- $this->_eventManager = new \Magento\Framework\Event\Manager($this->_invoker, $this->_eventConfigMock);
+ $this->eventManager = $this->objectManagerHelper->getObject(
+ EventManager::class,
+ [
+ 'invoker' => $this->invokerMock,
+ 'eventConfig' => $this->eventConfigMock
+ ]
+ );
}
public function testDispatch()
{
- $this->_eventConfigMock->expects(
- $this->once()
- )->method(
- 'getObservers'
- )->with(
- 'some_event'
- )->will(
- $this->returnValue(
- ['observer' => ['instance' => 'class', 'method' => 'method', 'name' => 'observer']]
- )
- );
- $this->_eventManager->dispatch('some_event', ['123']);
+ $this->eventConfigMock->expects($this->once())
+ ->method('getObservers')
+ ->with('some_eventname')
+ ->willReturn(['observer' => ['instance' => 'class', 'method' => 'method', 'name' => 'observer']]);
+ $this->eventManager->dispatch('some_eventName', ['123']);
}
public function testDispatchWithEmptyEventObservers()
{
- $this->_eventConfigMock->expects(
- $this->once()
- )->method(
- 'getObservers'
- )->with(
- 'some_event'
- )->will(
- $this->returnValue([])
- );
- $this->_invoker->expects($this->never())->method('dispatch');
- $this->_eventManager->dispatch('some_event');
+ $this->eventConfigMock->expects($this->once())
+ ->method('getObservers')
+ ->with('some_event')
+ ->willReturn([]);
+ $this->invokerMock->expects($this->never())->method('dispatch');
+ $this->eventManager->dispatch('some_event');
}
}
diff --git a/lib/internal/Magento/Framework/Filesystem/Driver/File.php b/lib/internal/Magento/Framework/Filesystem/Driver/File.php
index 56b2b5b65ada1..422bc56001905 100644
--- a/lib/internal/Magento/Framework/Filesystem/Driver/File.php
+++ b/lib/internal/Magento/Framework/Filesystem/Driver/File.php
@@ -195,14 +195,39 @@ public function getParentDirectory($path)
*/
public function createDirectory($path, $permissions)
{
- $result = @mkdir($this->getScheme() . $path, $permissions, true);
+ return $this->mkdirRecursive($path, $permissions);
+ }
+
+ /**
+ * Create a directory recursively taking into account race conditions
+ *
+ * @param string $path
+ * @param int $permissions
+ * @return bool
+ * @throws FileSystemException
+ */
+ private function mkdirRecursive($path, $permissions)
+ {
+ $path = $this->getScheme() . $path;
+ if (is_dir($path)) {
+ return true;
+ }
+ $parentDir = dirname($path);
+ while (!is_dir($parentDir)) {
+ $this->mkdirRecursive($parentDir, $permissions);
+ }
+ $result = @mkdir($path, $permissions);
if (!$result) {
- throw new FileSystemException(
- new \Magento\Framework\Phrase(
- 'Directory "%1" cannot be created %2',
- [$path, $this->getWarningMessage()]
- )
- );
+ if (is_dir($path)) {
+ $result = true;
+ } else {
+ throw new FileSystemException(
+ new \Magento\Framework\Phrase(
+ 'Directory "%1" cannot be created %2',
+ [$path, $this->getWarningMessage()]
+ )
+ );
+ }
}
return $result;
}
diff --git a/lib/internal/Magento/Framework/Filter/Input/MaliciousCode.php b/lib/internal/Magento/Framework/Filter/Input/MaliciousCode.php
index 72d30d3373709..9de7bfe1ba66f 100644
--- a/lib/internal/Magento/Framework/Filter/Input/MaliciousCode.php
+++ b/lib/internal/Magento/Framework/Filter/Input/MaliciousCode.php
@@ -44,7 +44,11 @@ class MaliciousCode implements \Zend_Filter_Interface
*/
public function filter($value)
{
- return preg_replace($this->_expressions, '', $value);
+ $replaced = 0;
+ do {
+ $value = preg_replace($this->_expressions, '', $value, -1, $replaced);
+ } while ($replaced !== 0);
+ return $value;
}
/**
diff --git a/lib/internal/Magento/Framework/Filter/Test/Unit/Input/MaliciousCodeTest.php b/lib/internal/Magento/Framework/Filter/Test/Unit/Input/MaliciousCodeTest.php
index dfe0a755397cc..5c6e4be9d8364 100644
--- a/lib/internal/Magento/Framework/Filter/Test/Unit/Input/MaliciousCodeTest.php
+++ b/lib/internal/Magento/Framework/Filter/Test/Unit/Input/MaliciousCodeTest.php
@@ -101,6 +101,10 @@ public function filterDataProvider()
'Base64' => [
'
',
'
',
+ ],
+ 'Nested malicious tags' => [
+ 'pt>alert(1);pt>',
+ 'alert(1);',
]
];
}
diff --git a/lib/internal/Magento/Framework/Indexer/SaveHandler/Batch.php b/lib/internal/Magento/Framework/Indexer/SaveHandler/Batch.php
index 5f432356d3d1b..705c7fdf1baf6 100644
--- a/lib/internal/Magento/Framework/Indexer/SaveHandler/Batch.php
+++ b/lib/internal/Magento/Framework/Indexer/SaveHandler/Batch.php
@@ -10,23 +10,27 @@ class Batch
/**
* @param \Traversable $documents
* @param int $size
- * @return \Generator
+ * @return array
*/
public function getItems(\Traversable $documents, $size)
{
- $i = 0;
- $batch = [];
+ if (count($documents) == 0) {
+ return [];
+ }
+ $i = 0;
+ $batch = $items = [];
foreach ($documents as $documentName => $documentValue) {
$batch[$documentName] = $documentValue;
- if ($i++ >= $size) {
- yield $batch;
+ if (++$i >= $size) {
+ $items[] = $batch;
$i = 0;
$batch = [];
}
}
if (count($batch) > 0) {
- yield $batch;
+ $items[] = $batch;
}
+ return $items;
}
}
diff --git a/lib/internal/Magento/Framework/Indexer/Test/Unit/BatchTest.php b/lib/internal/Magento/Framework/Indexer/Test/Unit/BatchTest.php
new file mode 100644
index 0000000000000..e2d681016e2bc
--- /dev/null
+++ b/lib/internal/Magento/Framework/Indexer/Test/Unit/BatchTest.php
@@ -0,0 +1,80 @@
+object = new \Magento\Framework\Indexer\SaveHandler\Batch();
+ }
+
+ /**
+ * @param array $itemsData
+ * @param int $size
+ * @param array $expected
+ *
+ * @dataProvider getItemsDataProvider
+ */
+ public function testGetItems(array $itemsData, $size, array $expected)
+ {
+ $items = new \ArrayObject($itemsData);
+ $this->assertSame($expected, $this->object->getItems($items, $size));
+ }
+
+ /**
+ * @return array
+ */
+ public function getItemsDataProvider()
+ {
+ return [
+ 'empty' => [
+ [],
+ 2,
+ [],
+ ],
+ 'even, numeric keys' => [
+ [1, 2, 3, 4],
+ 2,
+ [
+ [0 => 1, 1 => 2],
+ [2 => 3, 3 => 4],
+ ],
+ ],
+ 'odd, numeric keys' => [
+ [1, 2, 3, 4, 5],
+ 2,
+ [
+ [0 => 1, 1 => 2],
+ [2 => 3, 3 => 4],
+ [4 => 5],
+ ],
+ ],
+ 'even, string keys' => [
+ ['a' => 1, 'b' => 2, 'c' => 3, 'd' => 4],
+ 2,
+ [
+ ['a' => 1, 'b' => 2],
+ ['c' => 3, 'd' => 4],
+ ],
+ ],
+ 'odd, string keys' => [
+ ['a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5],
+ 2,
+ [
+ ['a' => 1, 'b' => 2],
+ ['c' => 3, 'd' => 4],
+ ['e' => 5],
+ ],
+ ],
+ ];
+ }
+}
diff --git a/lib/internal/Magento/Framework/Interception/ObjectManager/Config/Developer.php b/lib/internal/Magento/Framework/Interception/ObjectManager/Config/Developer.php
index ebe41d0f5b46c..28c68a771cefe 100644
--- a/lib/internal/Magento/Framework/Interception/ObjectManager/Config/Developer.php
+++ b/lib/internal/Magento/Framework/Interception/ObjectManager/Config/Developer.php
@@ -8,9 +8,31 @@
namespace Magento\Framework\Interception\ObjectManager\Config;
use Magento\Framework\Interception\ObjectManager\ConfigInterface;
+use Magento\Framework\ObjectManager\DefinitionInterface;
+use Magento\Framework\ObjectManager\RelationsInterface;
+use Magento\Framework\ObjectManager\InterceptableValidator;
class Developer extends \Magento\Framework\ObjectManager\Config\Config implements ConfigInterface
{
+ /**
+ * @var InterceptableValidator
+ */
+ private $interceptableValidator;
+
+ /**
+ * @param RelationsInterface $relations
+ * @param DefinitionInterface $definitions
+ * @param InterceptableValidator $interceptableValidator
+ */
+ public function __construct(
+ RelationsInterface $relations = null,
+ DefinitionInterface $definitions = null,
+ InterceptableValidator $interceptableValidator = null
+ ) {
+ $this->interceptableValidator = $interceptableValidator ?: new InterceptableValidator();
+ parent::__construct($relations, $definitions);
+ }
+
/**
* @var \Magento\Framework\Interception\ConfigInterface
*/
@@ -36,7 +58,9 @@ public function setInterceptionConfig(\Magento\Framework\Interception\ConfigInte
public function getInstanceType($instanceName)
{
$type = parent::getInstanceType($instanceName);
- if ($this->interceptionConfig && $this->interceptionConfig->hasPlugins($instanceName)) {
+ if ($this->interceptionConfig && $this->interceptionConfig->hasPlugins($instanceName)
+ && $this->interceptableValidator->validate($instanceName)
+ ) {
return $type . '\\Interceptor';
}
return $type;
diff --git a/lib/internal/Magento/Framework/Mview/Config/Data/Proxy.php b/lib/internal/Magento/Framework/Mview/Config/Data/Proxy.php
index 0a705796ad559..a026f2a60c82e 100644
--- a/lib/internal/Magento/Framework/Mview/Config/Data/Proxy.php
+++ b/lib/internal/Magento/Framework/Mview/Config/Data/Proxy.php
@@ -8,7 +8,8 @@
/**
* Proxy class for \Magento\Framework\Mview\Config\Data
*/
-class Proxy extends \Magento\Framework\Mview\Config\Data
+class Proxy extends \Magento\Framework\Mview\Config\Data implements
+ \Magento\Framework\ObjectManager\NoninterceptableInterface
{
/**
* Object Manager instance
diff --git a/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Proxy.php b/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Proxy.php
index 82686165132f8..c0f86fa70b2be 100644
--- a/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Proxy.php
+++ b/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Proxy.php
@@ -14,6 +14,11 @@ class Proxy extends \Magento\Framework\Code\Generator\EntityAbstract
*/
const ENTITY_TYPE = 'proxy';
+ /**
+ * Marker interface
+ */
+ const NON_INTERCEPTABLE_INTERFACE = '\Magento\Framework\ObjectManager\NoninterceptableInterface';
+
/**
* @param string $modelClassName
* @return string
@@ -131,9 +136,10 @@ protected function _generateCode()
$reflection = new \ReflectionClass($typeName);
if ($reflection->isInterface()) {
- $this->_classGenerator->setImplementedInterfaces([$typeName]);
+ $this->_classGenerator->setImplementedInterfaces([$typeName, self::NON_INTERCEPTABLE_INTERFACE]);
} else {
$this->_classGenerator->setExtendedClass($typeName);
+ $this->_classGenerator->setImplementedInterfaces([self::NON_INTERCEPTABLE_INTERFACE]);
}
return parent::_generateCode();
}
diff --git a/lib/internal/Magento/Framework/ObjectManager/InterceptableValidator.php b/lib/internal/Magento/Framework/ObjectManager/InterceptableValidator.php
new file mode 100644
index 0000000000000..bc3c17e11d765
--- /dev/null
+++ b/lib/internal/Magento/Framework/ObjectManager/InterceptableValidator.php
@@ -0,0 +1,59 @@
+isInterceptor($className) && $this->isInterceptable($className);
+ }
+
+ /**
+ *
+ * Check if instance type is interceptor
+ *
+ * @param string $instanceName
+ * @return bool
+ */
+ private function isInterceptor($instanceName)
+ {
+ return $this->endsWith($instanceName, '\Interceptor');
+ }
+
+ /**
+ *
+ * Check if instance type is interceptable
+ *
+ * @param string $instanceName
+ * @return bool
+ */
+ private function isInterceptable($instanceName)
+ {
+ return !is_subclass_of(
+ $instanceName,
+ \Magento\Framework\ObjectManager\Code\Generator\Proxy::NON_INTERCEPTABLE_INTERFACE
+ );
+ }
+
+ /**
+ * Check if a string ends with a substring
+ *
+ * @param string $haystack
+ * @param string $needle
+ * @return bool
+ */
+ private function endsWith($haystack, $needle)
+ {
+ // Search forward starting from end minus needle length characters
+ $temp = strlen($haystack) - strlen($needle);
+ return $needle === '' || ($temp >= 0 && strpos($haystack, $needle, $temp) !== false);
+ }
+}
diff --git a/lib/internal/Magento/Framework/ObjectManager/NoninterceptableInterface.php b/lib/internal/Magento/Framework/ObjectManager/NoninterceptableInterface.php
new file mode 100644
index 0000000000000..0950e27c233ce
--- /dev/null
+++ b/lib/internal/Magento/Framework/ObjectManager/NoninterceptableInterface.php
@@ -0,0 +1,13 @@
+assertFalse(
+ $interceptableValidator->validate(
+ 'Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper\Interceptor'
+ )
+ );
+ $this->assertFalse(
+ $interceptableValidator->validate(
+ 'Magento\Test\Di\Proxy'
+ )
+ );
+ }
+}
diff --git a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/_files/Proxy.php b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/_files/Proxy.php
new file mode 100644
index 0000000000000..864c00098e9e4
--- /dev/null
+++ b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/_files/Proxy.php
@@ -0,0 +1,10 @@
+getBaseConfig();
$customConfigFiles = $this->fileSource->getFiles($this->design->getDesignTheme(), self::CONFIG_FILE_NAME);
foreach ($customConfigFiles as $file) {
/** @var $fileReader \Magento\Framework\Filesystem\File\Read */
@@ -148,8 +146,8 @@ public function getConfig()
}
$fullConfig = str_replace(
- ['%function%', '%base%', '%usages%'],
- [$distributedConfig, $baseConfig],
+ ['%function%', '%usages%'],
+ [$distributedConfig],
self::FULL_CONFIG_TEMPLATE
);
diff --git a/lib/internal/Magento/Framework/RequireJs/Test/Unit/ConfigTest.php b/lib/internal/Magento/Framework/RequireJs/Test/Unit/ConfigTest.php
index 2480c753defb4..8bdb0432c7f2b 100644
--- a/lib/internal/Magento/Framework/RequireJs/Test/Unit/ConfigTest.php
+++ b/lib/internal/Magento/Framework/RequireJs/Test/Unit/ConfigTest.php
@@ -129,7 +129,6 @@ public function testGetConfig()
$expected = <<hasData('cache_key')) {
- return $this->getData('cache_key');
+ return static::CACHE_KEY_PREFIX . $this->getData('cache_key');
}
/**
* don't prevent recalculation by saving generated cache key
@@ -970,7 +975,7 @@ public function getCacheKey()
// ignore array keys
$key = implode('|', $key);
$key = sha1($key);
- return $key;
+ return static::CACHE_KEY_PREFIX . $key;
}
/**
diff --git a/lib/internal/Magento/Framework/View/Layout/Proxy.php b/lib/internal/Magento/Framework/View/Layout/Proxy.php
index 95220e34913df..b5fe92f2a6d52 100644
--- a/lib/internal/Magento/Framework/View/Layout/Proxy.php
+++ b/lib/internal/Magento/Framework/View/Layout/Proxy.php
@@ -9,7 +9,7 @@
* Proxy class for @see \Magento\Framework\View\Layout
* @SuppressWarnings(PHPMD.ExcessivePublicCount)
*/
-class Proxy extends \Magento\Framework\View\Layout
+class Proxy extends \Magento\Framework\View\Layout implements \Magento\Framework\ObjectManager\NoninterceptableInterface
{
/**
* Object Manager instance
diff --git a/lib/internal/Magento/Framework/View/Page/Config/Renderer.php b/lib/internal/Magento/Framework/View/Page/Config/Renderer.php
index 660d1d9c5aa6b..c117472325c06 100644
--- a/lib/internal/Magento/Framework/View/Page/Config/Renderer.php
+++ b/lib/internal/Magento/Framework/View/Page/Config/Renderer.php
@@ -106,7 +106,7 @@ public function renderHeadContent()
*/
public function renderTitle()
{
- return '' . $this->pageConfig->getTitle()->get() . '' . "\n";
+ return '' . $this->escaper->escapeHtml($this->pageConfig->getTitle()->get()) . '' . "\n";
}
/**
diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Element/AbstractBlockTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Element/AbstractBlockTest.php
index f187f63c647f0..802a37b1690a3 100644
--- a/lib/internal/Magento/Framework/View/Test/Unit/Element/AbstractBlockTest.php
+++ b/lib/internal/Magento/Framework/View/Test/Unit/Element/AbstractBlockTest.php
@@ -8,8 +8,30 @@
namespace Magento\Framework\View\Test\Unit\Element;
+use Magento\Framework\View\Element\AbstractBlock;
+use Magento\Framework\View\Element\Context;
+use Magento\Framework\Config\View;
+use Magento\Framework\View\ConfigInterface;
+
class AbstractBlockTest extends \PHPUnit_Framework_TestCase
{
+ /**
+ * @var AbstractBlock
+ */
+ protected $block;
+
+ /**
+ * @return void
+ */
+ protected function setUp()
+ {
+ $contextMock = $this->getMock(Context::class, [], [], '', false);
+ $this->block = $this->getMockForAbstractClass(
+ AbstractBlock::class,
+ ['context' => $contextMock]
+ );
+ }
+
/**
* @param string $expectedResult
* @param string $nameInLayout
@@ -18,11 +40,8 @@ class AbstractBlockTest extends \PHPUnit_Framework_TestCase
*/
public function testGetUiId($expectedResult, $nameInLayout, $methodArguments)
{
- /** @var $block \Magento\Framework\View\Element\AbstractBlock|\PHPUnit_Framework_MockObject_MockObject */
- $block = $this->getMockForAbstractClass('Magento\Framework\View\Element\AbstractBlock', [], '', false);
- $block->setNameInLayout($nameInLayout);
-
- $this->assertEquals($expectedResult, call_user_func_array([$block, 'getUiId'], $methodArguments));
+ $this->block->setNameInLayout($nameInLayout);
+ $this->assertEquals($expectedResult, call_user_func_array([$this->block, 'getUiId'], $methodArguments));
}
/**
@@ -57,46 +76,63 @@ public function getUiIdDataProvider()
];
}
+ /**
+ * @return void
+ */
public function testGetVar()
{
- $this->markTestIncomplete('MAGETWO-11727');
- $config = $this->getMock('Magento\Framework\Config\View', ['getVarValue'], [], '', false);
+ $config = $this->getMock(View::class, ['getVarValue'], [], '', false);
$module = uniqid();
- $config->expects(
- $this->at(0)
- )->method(
- 'getVarValue'
- )->with(
- 'Magento_Theme',
- 'v1'
- )->will(
- $this->returnValue('one')
- );
- $config->expects($this->at(1))->method('getVarValue')->with($module, 'v2')->will($this->returnValue('two'));
- $configManager = $this->getMock('Magento\Framework\View\ConfigInterface', [], [], '', false);
- $configManager->expects($this->exactly(2))->method('getViewConfig')->will($this->returnValue($config));
+ $config->expects($this->any())
+ ->method('getVarValue')
+ ->willReturnMap([
+ ['Magento_Theme', 'v1', 'one'],
+ [$module, 'v2', 'two']
+ ]);
+
+ $configManager = $this->getMock(ConfigInterface::class, [], [], '', false);
+ $configManager->expects($this->exactly(2))->method('getViewConfig')->willReturn($config);
- /** @var $block \Magento\Framework\View\Element\AbstractBlock|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var $block AbstractBlock|\PHPUnit_Framework_MockObject_MockObject */
$params = ['viewConfig' => $configManager];
$helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
$block = $this->getMockForAbstractClass(
- 'Magento\Framework\View\Element\AbstractBlock',
- $helper->getConstructArguments('Magento\Framework\View\Element\AbstractBlock', $params),
- uniqid('Magento\\Theme\\Block\\AbstractBlock\\')
+ AbstractBlock::class,
+ $helper->getConstructArguments(AbstractBlock::class, $params)
);
+ $block->setData('module_name', 'Magento_Theme');
$this->assertEquals('one', $block->getVar('v1'));
$this->assertEquals('two', $block->getVar('v2', $module));
}
+ /**
+ * @return void
+ */
public function testIsScopePrivate()
{
- $contextMock = $this->getMock('Magento\Framework\View\Element\Context', [], [], '', false);
- $block = $this->getMockForAbstractClass(
- 'Magento\Framework\View\Element\AbstractBlock',
- ['context' => $contextMock]
- );
- $this->assertEquals(false, $block->isScopePrivate());
+ $this->assertFalse($this->block->isScopePrivate());
+ }
+
+ /**
+ * @return void
+ */
+ public function testGetCacheKey()
+ {
+ $cacheKey = 'testKey';
+ $this->block->setData('cache_key', $cacheKey);
+ $this->assertEquals(AbstractBlock::CACHE_KEY_PREFIX . $cacheKey, $this->block->getCacheKey());
+ }
+
+ /**
+ * @return void
+ */
+ public function testGetCacheKeyByName()
+ {
+ $nameInLayout = 'testBlock';
+ $this->block->setNameInLayout($nameInLayout);
+ $cacheKey = sha1($nameInLayout);
+ $this->assertEquals(AbstractBlock::CACHE_KEY_PREFIX . $cacheKey, $this->block->getCacheKey());
}
}
diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/RendererTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/RendererTest.php
index 62c52b45cc818..8164bd3bb18a2 100644
--- a/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/RendererTest.php
+++ b/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/RendererTest.php
@@ -179,11 +179,15 @@ public function testRenderTitle()
$this->pageConfigMock->expects($this->any())
->method('getTitle')
- ->will($this->returnValue($this->titleMock));
+ ->willReturn($this->titleMock);
$this->titleMock->expects($this->once())
->method('get')
- ->will($this->returnValue($title));
+ ->willReturn($title);
+
+ $this->escaperMock->expects($this->once())
+ ->method('escapeHtml')
+ ->willReturnArgument(0);
$this->assertEquals($expected, $this->renderer->renderTitle());
}
diff --git a/lib/internal/Magento/Framework/composer.json b/lib/internal/Magento/Framework/composer.json
index 4a68865462c7b..5a1f5205c84ef 100644
--- a/lib/internal/Magento/Framework/composer.json
+++ b/lib/internal/Magento/Framework/composer.json
@@ -2,7 +2,7 @@
"name": "magento/framework",
"description": "N/A",
"type": "magento2-library",
- "version": "100.0.2",
+ "version": "100.0.4",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php b/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php
index 8843fb66c2111..b9dbc3aebbda2 100644
--- a/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php
+++ b/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php
@@ -161,15 +161,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
'application' => $excludedModulePaths,
'framework' => $excludedLibraryPaths
];
- $dataAttributesIncludePattern = [
- 'extension_attributes' => '/\/etc\/([a-zA-Z_]*\/extension_attributes|extension_attributes)\.xml$/'
- ];
$this->configureObjectManager($output);
- $operations = $this->getOperationsConfiguration(
- $compiledPathsList,
- $dataAttributesIncludePattern
- );
+ $operations = $this->getOperationsConfiguration($compiledPathsList);
try {
$this->cleanupFilesystem(
@@ -286,12 +280,10 @@ private function configureObjectManager(OutputInterface $output)
* Returns operations configuration
*
* @param array $compiledPathsList
- * @param array $dataAttributesIncludePattern
* @return array
*/
private function getOperationsConfiguration(
- array $compiledPathsList,
- array $dataAttributesIncludePattern
+ array $compiledPathsList
) {
$excludePatterns = [];
foreach ($this->excludedPathsList as $excludedPaths) {
@@ -299,20 +291,11 @@ private function getOperationsConfiguration(
}
$operations = [
- OperationFactory::PROXY_GENERATOR => [
- 'paths' => $compiledPathsList['application'],
- 'filePatterns' => ['di' => '/\/etc\/([a-zA-Z_]*\/di|di)\.xml$/'],
- 'excludePatterns' => $excludePatterns,
- ],
+ OperationFactory::PROXY_GENERATOR => [],
OperationFactory::REPOSITORY_GENERATOR => [
'paths' => $compiledPathsList['application'],
- 'filePatterns' => ['di' => '/\/etc\/([a-zA-Z_]*\/di|di)\.xml$/'],
- 'excludePatterns' => $excludePatterns,
- ],
- OperationFactory::DATA_ATTRIBUTES_GENERATOR => [
- 'paths' => $compiledPathsList['application'],
- 'filePatterns' => $dataAttributesIncludePattern
],
+ OperationFactory::DATA_ATTRIBUTES_GENERATOR => [],
OperationFactory::APPLICATION_CODE_GENERATOR => [
'paths' => [
$compiledPathsList['application'],
diff --git a/setup/src/Magento/Setup/Console/Command/DiCompileMultiTenantCommand.php b/setup/src/Magento/Setup/Console/Command/DiCompileMultiTenantCommand.php
index ea56ed13dbd4d..fc5eb973944b5 100644
--- a/setup/src/Magento/Setup/Console/Command/DiCompileMultiTenantCommand.php
+++ b/setup/src/Magento/Setup/Console/Command/DiCompileMultiTenantCommand.php
@@ -260,6 +260,9 @@ public function generateCode($generationDir, $fileExcludePatterns, $input)
$directoryScanner->scan($codeScanDir, $filePatterns, $fileExcludePatterns)
);
}
+ $this->files['di'][] = $this->directoryList->getPath(
+ \Magento\Framework\App\Filesystem\DirectoryList::CONFIG
+ ) . '/di.xml';
$this->files['additional'] = [$input->getOption(self::INPUT_KEY_EXTRA_CLASSES_FILE)];
$repositoryScanner = new Scanner\RepositoryScanner();
$repositories = $repositoryScanner->collectEntities($this->files['di']);
@@ -374,7 +377,9 @@ private function compileCode($generationDir, $fileExcludePatterns, $input)
$directoryInstancesNamesList->getList($path);
}
}
- $inheritanceScanner = new Scanner\InheritanceInterceptorScanner();
+ $inheritanceScanner = new Scanner\InheritanceInterceptorScanner(
+ new \Magento\Framework\ObjectManager\InterceptableValidator()
+ );
$this->entities['interceptors'] = $inheritanceScanner->collectEntities(
get_declared_classes(),
$this->entities['interceptors']
diff --git a/setup/src/Magento/Setup/Module/Di/App/Task/Operation/ProxyGenerator.php b/setup/src/Magento/Setup/Module/Di/App/Task/Operation/ProxyGenerator.php
index ebfec0635b8bb..f5c79fec02f2e 100644
--- a/setup/src/Magento/Setup/Module/Di/App/Task/Operation/ProxyGenerator.php
+++ b/setup/src/Magento/Setup/Module/Di/App/Task/Operation/ProxyGenerator.php
@@ -11,11 +11,6 @@
class ProxyGenerator implements OperationInterface
{
- /**
- * @var Scanner\DirectoryScanner
- */
- private $directoryScanner;
-
/**
* @var Scanner\XmlScanner
*/
@@ -27,18 +22,23 @@ class ProxyGenerator implements OperationInterface
private $data;
/**
- * @param Scanner\DirectoryScanner $directoryScanner
+ * @var Scanner\ConfigurationScanner
+ */
+ private $configurationScanner;
+
+ /**
* @param Scanner\XmlScanner $proxyScanner
+ * @param Scanner\ConfigurationScanner $configurationScanner
* @param array $data
*/
public function __construct(
- Scanner\DirectoryScanner $directoryScanner,
Scanner\XmlScanner $proxyScanner,
+ \Magento\Setup\Module\Di\Code\Scanner\ConfigurationScanner $configurationScanner,
$data = []
) {
- $this->directoryScanner = $directoryScanner;
$this->proxyScanner = $proxyScanner;
$this->data = $data;
+ $this->configurationScanner = $configurationScanner;
}
/**
@@ -48,19 +48,8 @@ public function __construct(
*/
public function doOperation()
{
- if (array_diff(array_keys($this->data), ['filePatterns', 'paths', 'excludePatterns'])
- !== array_diff(['filePatterns', 'paths', 'excludePatterns'], array_keys($this->data))) {
- return;
- }
-
- $files = [];
- foreach ($this->data['paths'] as $path) {
- $files = array_merge_recursive(
- $files,
- $this->directoryScanner->scan($path, $this->data['filePatterns'], $this->data['excludePatterns'])
- );
- }
- $proxies = $this->proxyScanner->collectEntities($files['di']);
+ $files = $this->configurationScanner->scan('di.xml');
+ $proxies = $this->proxyScanner->collectEntities($files);
foreach ($proxies as $entityName) {
class_exists($entityName);
}
diff --git a/setup/src/Magento/Setup/Module/Di/App/Task/Operation/RepositoryGenerator.php b/setup/src/Magento/Setup/Module/Di/App/Task/Operation/RepositoryGenerator.php
index 60d1159661528..2f51b34a11187 100644
--- a/setup/src/Magento/Setup/Module/Di/App/Task/Operation/RepositoryGenerator.php
+++ b/setup/src/Magento/Setup/Module/Di/App/Task/Operation/RepositoryGenerator.php
@@ -12,11 +12,6 @@
class RepositoryGenerator implements OperationInterface
{
- /**
- * @var Scanner\DirectoryScanner
- */
- private $directoryScanner;
-
/**
* @var Scanner\RepositoryScanner
*/
@@ -33,21 +28,26 @@ class RepositoryGenerator implements OperationInterface
private $classesScanner;
/**
- * @param Scanner\DirectoryScanner $directoryScanner
+ * @var Scanner\ConfigurationScanner
+ */
+ private $configurationScanner;
+
+ /**
* @param ClassesScanner $classesScanner
* @param Scanner\RepositoryScanner $repositoryScanner
+ * @param Scanner\ConfigurationScanner $configurationScanner
* @param array $data
*/
public function __construct(
- Scanner\DirectoryScanner $directoryScanner,
ClassesScanner $classesScanner,
Scanner\RepositoryScanner $repositoryScanner,
+ \Magento\Setup\Module\Di\Code\Scanner\ConfigurationScanner $configurationScanner,
$data = []
) {
- $this->directoryScanner = $directoryScanner;
$this->repositoryScanner = $repositoryScanner;
$this->data = $data;
$this->classesScanner = $classesScanner;
+ $this->configurationScanner = $configurationScanner;
}
/**
@@ -57,23 +57,12 @@ public function __construct(
*/
public function doOperation()
{
- if (array_diff(array_keys($this->data), ['filePatterns', 'paths', 'excludePatterns'])
- !== array_diff(['filePatterns', 'paths', 'excludePatterns'], array_keys($this->data))) {
- return;
- }
-
foreach ($this->data['paths'] as $path) {
$this->classesScanner->getList($path);
}
$this->repositoryScanner->setUseAutoload(false);
- $files = [];
- foreach ($this->data['paths'] as $path) {
- $files = array_merge_recursive(
- $files,
- $this->directoryScanner->scan($path, $this->data['filePatterns'], $this->data['excludePatterns'])
- );
- }
- $repositories = $this->repositoryScanner->collectEntities($files['di']);
+ $files = $this->configurationScanner->scan('di.xml');
+ $repositories = $this->repositoryScanner->collectEntities($files);
foreach ($repositories as $entityName) {
class_exists($entityName);
}
diff --git a/setup/src/Magento/Setup/Module/Di/App/Task/Operation/ServiceDataAttributesGenerator.php b/setup/src/Magento/Setup/Module/Di/App/Task/Operation/ServiceDataAttributesGenerator.php
index 0a28df86d27fc..2f80abd296d06 100644
--- a/setup/src/Magento/Setup/Module/Di/App/Task/Operation/ServiceDataAttributesGenerator.php
+++ b/setup/src/Magento/Setup/Module/Di/App/Task/Operation/ServiceDataAttributesGenerator.php
@@ -16,11 +16,6 @@
*/
class ServiceDataAttributesGenerator implements OperationInterface
{
- /**
- * @var Scanner\DirectoryScanner
- */
- private $directoryScanner;
-
/**
* @var Scanner\ServiceDataAttributesScanner
*/
@@ -32,18 +27,23 @@ class ServiceDataAttributesGenerator implements OperationInterface
private $data;
/**
- * @param Scanner\DirectoryScanner $directoryScanner
- * @param Scanner\ServiceDataAttributesScanner $repositoryScanner
+ * @var Scanner\ConfigurationScanner
+ */
+ private $configurationScanner;
+
+ /**
+ * @param Scanner\ServiceDataAttributesScanner $serviceDataAttributesScanner
+ * @param Scanner\ConfigurationScanner $configurationScanner
* @param array $data
*/
public function __construct(
- Scanner\DirectoryScanner $directoryScanner,
- Scanner\ServiceDataAttributesScanner $repositoryScanner,
+ Scanner\ServiceDataAttributesScanner $serviceDataAttributesScanner,
+ \Magento\Setup\Module\Di\Code\Scanner\ConfigurationScanner $configurationScanner,
$data = []
) {
- $this->directoryScanner = $directoryScanner;
- $this->serviceDataAttributesScanner = $repositoryScanner;
+ $this->serviceDataAttributesScanner = $serviceDataAttributesScanner;
$this->data = $data;
+ $this->configurationScanner = $configurationScanner;
}
/**
@@ -53,15 +53,8 @@ public function __construct(
*/
public function doOperation()
{
- if (array_diff(array_keys($this->data), ['filePatterns', 'paths'])
- !== array_diff(['filePatterns', 'paths'], array_keys($this->data))) {
- return;
- }
- $files = [];
- foreach ($this->data['paths'] as $path) {
- $files = array_merge_recursive($files, $this->directoryScanner->scan($path, $this->data['filePatterns']));
- }
- $repositories = $this->serviceDataAttributesScanner->collectEntities($files['extension_attributes']);
+ $files = $this->configurationScanner->scan('extension_attributes.xml');
+ $repositories = $this->serviceDataAttributesScanner->collectEntities($files);
foreach ($repositories as $entityName) {
class_exists($entityName);
}
diff --git a/setup/src/Magento/Setup/Module/Di/Code/Generator/InterceptionConfigurationBuilder.php b/setup/src/Magento/Setup/Module/Di/Code/Generator/InterceptionConfigurationBuilder.php
index 5935e77fa8e71..e929ca2e04a25 100644
--- a/setup/src/Magento/Setup/Module/Di/Code/Generator/InterceptionConfigurationBuilder.php
+++ b/setup/src/Magento/Setup/Module/Di/Code/Generator/InterceptionConfigurationBuilder.php
@@ -12,6 +12,7 @@
use Magento\Framework\App\Interception\Cache\CompiledConfig;
use Magento\Framework\Interception\Config\Config as InterceptionConfig;
use Magento\Setup\Module\Di\Code\Reader\Type;
+use Magento\Framework\ObjectManager\InterceptableValidator;
class InterceptionConfigurationBuilder
{
@@ -42,22 +43,30 @@ class InterceptionConfigurationBuilder
*/
private $cacheManager;
+ /**
+ * @var InterceptableValidator
+ */
+ private $interceptableValidator;
+
/**
* @param InterceptionConfig $interceptionConfig
* @param PluginList $pluginList
* @param Type $typeReader
* @param Manager $cacheManager
+ * @param InterceptableValidator $interceptableValidator
*/
public function __construct(
InterceptionConfig $interceptionConfig,
PluginList $pluginList,
Type $typeReader,
- Manager $cacheManager
+ Manager $cacheManager,
+ InterceptableValidator $interceptableValidator
) {
$this->interceptionConfig = $interceptionConfig;
$this->pluginList = $pluginList;
$this->typeReader = $typeReader;
$this->cacheManager = $cacheManager;
+ $this->interceptableValidator = $interceptableValidator;
}
/**
@@ -99,7 +108,9 @@ private function getInterceptedClasses($definedClasses)
{
$intercepted = [];
foreach ($definedClasses as $definedClass) {
- if ($this->interceptionConfig->hasPlugins($definedClass) && $this->typeReader->isConcrete($definedClass)) {
+ if ($this->interceptionConfig->hasPlugins($definedClass) && $this->typeReader->isConcrete($definedClass)
+ && $this->interceptableValidator->validate($definedClass)
+ ) {
$intercepted[] = $definedClass;
}
}
diff --git a/setup/src/Magento/Setup/Module/Di/Code/Scanner/ConfigurationScanner.php b/setup/src/Magento/Setup/Module/Di/Code/Scanner/ConfigurationScanner.php
new file mode 100644
index 0000000000000..90aed20512528
--- /dev/null
+++ b/setup/src/Magento/Setup/Module/Di/Code/Scanner/ConfigurationScanner.php
@@ -0,0 +1,48 @@
+fileResolver = $fileResolver;
+ $this->areaList = $areaList;
+ }
+
+ /**
+ * Scan configuration files
+ *
+ * @param string $fileName
+ *
+ * @return array array of paths to the configuration files
+ */
+ public function scan($fileName)
+ {
+ $files = [];
+ $areaCodes = array_merge(
+ ['primary', Area::AREA_GLOBAL],
+ $this->areaList->getCodes()
+ );
+ foreach ($areaCodes as $area) {
+ $files = array_merge_recursive(
+ $files,
+ $this->fileResolver->get($fileName, $area)->toArray()
+ );
+ }
+ return array_keys($files);
+ }
+}
diff --git a/setup/src/Magento/Setup/Module/Di/Code/Scanner/InheritanceInterceptorScanner.php b/setup/src/Magento/Setup/Module/Di/Code/Scanner/InheritanceInterceptorScanner.php
index 39904e2e20802..733ee606fecf2 100644
--- a/setup/src/Magento/Setup/Module/Di/Code/Scanner/InheritanceInterceptorScanner.php
+++ b/setup/src/Magento/Setup/Module/Di/Code/Scanner/InheritanceInterceptorScanner.php
@@ -5,8 +5,23 @@
*/
namespace Magento\Setup\Module\Di\Code\Scanner;
+use Magento\Framework\ObjectManager\InterceptableValidator;
+
class InheritanceInterceptorScanner implements ScannerInterface
{
+ /**
+ * @var InterceptableValidator
+ */
+ private $interceptableValidator;
+
+ /**
+ * @param InterceptableValidator $interceptableValidator
+ */
+ public function __construct(InterceptableValidator $interceptableValidator)
+ {
+ $this->interceptableValidator = $interceptableValidator;
+ }
+
/**
* Get intercepted class names
*
@@ -20,9 +35,7 @@ public function collectEntities(array $classes, array $interceptedEntities = [])
foreach ($classes as $class) {
foreach ($interceptedEntities as $interceptorClass) {
$interceptedEntity = substr($interceptorClass, 0, -12);
- if (is_subclass_of($class, $interceptedEntity)
- && !$this->endsWith($class, 'RepositoryInterface\\Proxy')
- && !$this->endsWith($class, '\\Interceptor')) {
+ if (is_subclass_of($class, $interceptedEntity) && $this->interceptableValidator->validate($class)) {
$reflectionClass = new \ReflectionClass($class);
if (!$reflectionClass->isAbstract() && !$reflectionClass->isFinal()) {
$output[] = $class . '\\Interceptor';
@@ -53,18 +66,4 @@ private function filterOutAbstractClasses($interceptedEntities)
}
return $interceptedEntitiesFiltered;
}
-
- /**
- * Check if a string ends with a substring
- *
- * @param string $haystack
- * @param string $needle
- * @return bool
- */
- private function endsWith($haystack, $needle)
- {
- // search forward starting from end minus needle length characters
- return $needle === ""
- || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== false);
- }
}
diff --git a/setup/src/Magento/Setup/Module/I18n/Dictionary/Phrase.php b/setup/src/Magento/Setup/Module/I18n/Dictionary/Phrase.php
index 55d060c895f8c..582ca2fcc2919 100644
--- a/setup/src/Magento/Setup/Module/I18n/Dictionary/Phrase.php
+++ b/setup/src/Magento/Setup/Module/I18n/Dictionary/Phrase.php
@@ -93,7 +93,7 @@ public function setPhrase($phrase)
}
/**
- * Get quote type
+ * Get phrase
*
* @return string
*/
@@ -116,7 +116,7 @@ public function setQuote($quote)
}
/**
- * Get phrase
+ * Get quote type
*
* @return string
*/
@@ -269,7 +269,11 @@ public function getCompiledTranslation()
private function getCompiledString($string)
{
$encloseQuote = $this->getQuote() == Phrase::QUOTE_DOUBLE ? Phrase::QUOTE_DOUBLE : Phrase::QUOTE_SINGLE;
-
+ //find all occurrences of ' and ", with no \ before it.
+ preg_match_all('/(?maintenanceMode = $this->getMock('Magento\Framework\App\MaintenanceMode', [], [], '', false);
$this->controller = new Maintenance($this->maintenanceMode);
+
+ $request = $this->getMock('\Zend\Http\PhpEnvironment\Request', [], [], '', false);
+ $response = $this->getMock('\Zend\Http\PhpEnvironment\Response', [], [], '', false);
+ $routeMatch = $this->getMock('\Zend\Mvc\Router\RouteMatch', [], [], '', false);
+
+ $mvcEvent = $this->getMock('\Zend\Mvc\MvcEvent', [], [], '', false);
+ $mvcEvent->expects($this->any())->method('setRequest')->with($request)->willReturn($mvcEvent);
+ $mvcEvent->expects($this->any())->method('setResponse')->with($response)->willReturn($mvcEvent);
+ $mvcEvent->expects($this->any())->method('setTarget')->with($this->controller)->willReturn($mvcEvent);
+ $mvcEvent->expects($this->any())->method('getRouteMatch')->willReturn($routeMatch);
+ $contentArray = '{"disable":false}';
+ $request->expects($this->any())->method('getContent')->willReturn($contentArray);
+
+ $this->controller->setEvent($mvcEvent);
+ $this->controller->dispatch($request, $response);
}
public function testIndexAction()
diff --git a/setup/src/Magento/Setup/Test/Unit/Model/PhpReadinessCheckTest.php b/setup/src/Magento/Setup/Test/Unit/Model/PhpReadinessCheckTest.php
index 29b559a0f6276..3c24f18df7735 100644
--- a/setup/src/Magento/Setup/Test/Unit/Model/PhpReadinessCheckTest.php
+++ b/setup/src/Magento/Setup/Test/Unit/Model/PhpReadinessCheckTest.php
@@ -193,7 +193,6 @@ public function testCheckPhpSettings()
50
);
- $this->setUpNoPrettyVersionParser();
$rawPostMessage = sprintf(
'Your PHP Version is %s, but always_populate_raw_post_data = -1.
$HTTP_RAW_POST_DATA is deprecated from PHP 5.6 onwards and will be removed in PHP 7.0.
@@ -209,13 +208,16 @@ public function testCheckPhpSettings()
'message' => $xdebugMessage,
'error' => false,
],
- 'always_populate_raw_post_data' => [
- 'message' => $rawPostMessage,
- 'helpUrl' => 'http://php.net/manual/en/ini.core.php#ini.always-populate-settings-data',
- 'error' => false
- ]
]
];
+ if (!$this->isPhp7OrHhvm()) {
+ $this->setUpNoPrettyVersionParser();
+ $expected['data']['always_populate_raw_post_data'] = [
+ 'message' => $rawPostMessage,
+ 'helpUrl' => 'http://php.net/manual/en/ini.core.php#ini.always-populate-settings-data',
+ 'error' => false
+ ];
+ }
$this->assertEquals($expected, $this->phpReadinessCheck->checkPhpSettings());
}
@@ -231,7 +233,6 @@ public function testCheckPhpSettingsFailed()
200
);
- $this->setUpNoPrettyVersionParser();
$rawPostMessage = sprintf(
'Your PHP Version is %s, but always_populate_raw_post_data = -1.
$HTTP_RAW_POST_DATA is deprecated from PHP 5.6 onwards and will be removed in PHP 7.0.
@@ -246,14 +247,17 @@ public function testCheckPhpSettingsFailed()
'xdebug_max_nesting_level' => [
'message' => $xdebugMessage,
'error' => true,
- ],
- 'always_populate_raw_post_data' => [
- 'message' => $rawPostMessage,
- 'helpUrl' => 'http://php.net/manual/en/ini.core.php#ini.always-populate-settings-data',
- 'error' => false
]
]
];
+ if (!$this->isPhp7OrHhvm()) {
+ $this->setUpNoPrettyVersionParser();
+ $expected['data']['always_populate_raw_post_data'] = [
+ 'message' => $rawPostMessage,
+ 'helpUrl' => 'http://php.net/manual/en/ini.core.php#ini.always-populate-settings-data',
+ 'error' => false
+ ];
+ }
$this->assertEquals($expected, $this->phpReadinessCheck->checkPhpSettings());
}
@@ -261,7 +265,6 @@ public function testCheckPhpSettingsNoXDebug()
{
$this->phpInfo->expects($this->once())->method('getCurrent')->willReturn([]);
- $this->setUpNoPrettyVersionParser();
$rawPostMessage = sprintf(
'Your PHP Version is %s, but always_populate_raw_post_data = -1.
$HTTP_RAW_POST_DATA is deprecated from PHP 5.6 onwards and will be removed in PHP 7.0.
@@ -272,14 +275,18 @@ public function testCheckPhpSettingsNoXDebug()
);
$expected = [
'responseType' => ResponseTypeInterface::RESPONSE_TYPE_SUCCESS,
- 'data' => [
+ 'data' => []
+ ];
+ if (!$this->isPhp7OrHhvm()) {
+ $this->setUpNoPrettyVersionParser();
+ $expected['data'] = [
'always_populate_raw_post_data' => [
'message' => $rawPostMessage,
'helpUrl' => 'http://php.net/manual/en/ini.core.php#ini.always-populate-settings-data',
'error' => false
]
- ]
- ];
+ ];
+ }
$this->assertEquals($expected, $this->phpReadinessCheck->checkPhpSettings());
}
@@ -333,6 +340,14 @@ public function testCheckPhpExtensionsFailed()
];
$this->assertEquals($expected, $this->phpReadinessCheck->checkPhpExtensions());
}
+
+ /**
+ * @return bool
+ */
+ protected function isPhp7OrHhvm()
+ {
+ return version_compare(PHP_VERSION, '7.0.0-beta') >= 0 || defined('HHVM_VERSION');
+ }
}
namespace Magento\Setup\Model;
diff --git a/setup/src/Magento/Setup/Test/Unit/Module/Di/App/Task/ProxyGeneratorTest.php b/setup/src/Magento/Setup/Test/Unit/Module/Di/App/Task/ProxyGeneratorTest.php
index c721973f615ef..1a1382b87a65d 100644
--- a/setup/src/Magento/Setup/Test/Unit/Module/Di/App/Task/ProxyGeneratorTest.php
+++ b/setup/src/Magento/Setup/Test/Unit/Module/Di/App/Task/ProxyGeneratorTest.php
@@ -13,83 +13,53 @@
class ProxyGeneratorTest extends \PHPUnit_Framework_TestCase
{
/**
- * @var Scanner\DirectoryScanner | \PHPUnit_Framework_MockObject_MockObject
+ * @var Scanner\XmlScanner | \PHPUnit_Framework_MockObject_MockObject
*/
- private $directoryScannerMock;
+ private $proxyScannerMock;
/**
- * @var Scanner\XmlScanner | \PHPUnit_Framework_MockObject_MockObject
+ * @var \Magento\Setup\Module\Di\Code\Scanner\ConfigurationScanner | \PHPUnit_Framework_MockObject_MockObject
*/
- private $proxyScannerMock;
+ private $configurationScannerMock;
+
+ /**
+ * @var \Magento\Setup\Module\Di\App\Task\Operation\ProxyGenerator
+ */
+ private $model;
protected function setUp()
{
- $this->directoryScannerMock = $this->getMockBuilder('Magento\Setup\Module\Di\Code\Scanner\DirectoryScanner')
- ->disableOriginalConstructor()
- ->getMock();
$this->proxyScannerMock = $this->getMockBuilder('Magento\Setup\Module\Di\Code\Scanner\XmlScanner')
->disableOriginalConstructor()
->getMock();
- }
-
- /**
- * @param array $data
- *
- * @dataProvider doOperationWrongDataDataProvider
- */
- public function testDoOperationWrongData($data)
- {
- $model = new ProxyGenerator(
- $this->directoryScannerMock,
- $this->proxyScannerMock,
- $data
- );
- $this->directoryScannerMock->expects($this->never())
- ->method('scan');
- $this->proxyScannerMock->expects($this->never())
- ->method('collectEntities');
-
- $this->assertEmpty($model->doOperation());
- }
+ $this->configurationScannerMock = $this->getMockBuilder(
+ 'Magento\Setup\Module\Di\Code\Scanner\ConfigurationScanner'
+ )->disableOriginalConstructor()
+ ->getMock();
- /**
- * @return array
- */
- public function doOperationWrongDataDataProvider()
- {
- return [
- [[]],
- [['filePatterns' => ['php' => '*.php']]],
- [['path' => 'path']],
- ];
+ $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
+ $this->model = $objectManagerHelper->getObject(
+ 'Magento\Setup\Module\Di\App\Task\Operation\ProxyGenerator',
+ [
+ 'proxyScanner' => $this->proxyScannerMock,
+ 'configurationScanner' => $this->configurationScannerMock,
+ ]
+ );
}
public function testDoOperation()
{
- $data = [
- 'paths' => ['path/to/app'],
- 'filePatterns' => ['di' => 'di.xml'],
- 'excludePatterns' => ['/\/Test\//'],
- ];
- $files = ['di' => []];
- $model = new ProxyGenerator(
- $this->directoryScannerMock,
- $this->proxyScannerMock,
- $data
- );
-
- $this->directoryScannerMock->expects($this->once())
+ $files = ['file1', 'file2'];
+ $this->configurationScannerMock->expects($this->once())
->method('scan')
- ->with(
- $data['paths'][0],
- $data['filePatterns']
- )->willReturn($files);
+ ->with('di.xml')
+ ->willReturn($files);
$this->proxyScannerMock->expects($this->once())
->method('collectEntities')
- ->with($files['di'])
+ ->with($files)
->willReturn([]);
- $this->assertEmpty($model->doOperation());
+ $this->model->doOperation();
}
}
diff --git a/setup/src/Magento/Setup/Test/Unit/Module/Di/App/Task/RepositoryGeneratorTest.php b/setup/src/Magento/Setup/Test/Unit/Module/Di/App/Task/RepositoryGeneratorTest.php
index 626ccfbe71346..cf8ab935db943 100644
--- a/setup/src/Magento/Setup/Test/Unit/Module/Di/App/Task/RepositoryGeneratorTest.php
+++ b/setup/src/Magento/Setup/Test/Unit/Module/Di/App/Task/RepositoryGeneratorTest.php
@@ -12,11 +12,6 @@
class RepositoryGeneratorTest extends \PHPUnit_Framework_TestCase
{
- /**
- * @var Scanner\DirectoryScanner | \PHPUnit_Framework_MockObject_MockObject
- */
- private $directoryScannerMock;
-
/**
* @var Scanner\RepositoryScanner | \PHPUnit_Framework_MockObject_MockObject
*/
@@ -27,81 +22,59 @@ class RepositoryGeneratorTest extends \PHPUnit_Framework_TestCase
*/
private $classesScannerMock;
+
+ /**
+ * @var \Magento\Setup\Module\Di\Code\Scanner\ConfigurationScanner | \PHPUnit_Framework_MockObject_MockObject
+ */
+ private $configurationScannerMock;
+
+ /**
+ * @var \Magento\Setup\Module\Di\App\Task\Operation\RepositoryGenerator
+ */
+ private $model;
+
protected function setUp()
{
- $this->directoryScannerMock = $this->getMockBuilder('Magento\Setup\Module\Di\Code\Scanner\DirectoryScanner')
- ->setMethods([])
- ->disableOriginalConstructor()
- ->getMock();
$this->repositoryScannerMock = $this->getMockBuilder('Magento\Setup\Module\Di\Code\Scanner\RepositoryScanner')
- ->setMethods([])
->disableOriginalConstructor()
->getMock();
$this->classesScannerMock = $this->getMockBuilder('Magento\Setup\Module\Di\Code\Reader\ClassesScanner')
- ->setMethods([])
->disableOriginalConstructor()
->getMock();
- }
-
- /**
- * @dataProvider wrongDataDataProvider
- */
- public function testDoOperationEmptyData($wrongData)
- {
- $model = new RepositoryGenerator(
- $this->directoryScannerMock,
- $this->classesScannerMock,
- $this->repositoryScannerMock,
- $wrongData
+ $this->configurationScannerMock = $this->getMockBuilder(
+ 'Magento\Setup\Module\Di\Code\Scanner\ConfigurationScanner'
+ )->disableOriginalConstructor()
+ ->getMock();
+ $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
+ $this->model = $objectManagerHelper->getObject(
+ 'Magento\Setup\Module\Di\App\Task\Operation\RepositoryGenerator',
+ [
+ 'repositoryScanner' => $this->repositoryScannerMock,
+ 'classesScanner' => $this->classesScannerMock,
+ 'configurationScanner' => $this->configurationScannerMock,
+ 'data' => ['paths' => ['path/to/app']]
+ ]
);
-
- $this->assertNull($model->doOperation());
- }
-
- /**
- * @return array
- */
- public function wrongDataDataProvider()
- {
- return [
- [[]],
- [['filePatterns' => ['php' => '*.php']]],
- [['path' => 'path']]
- ];
}
- public function testDoOperationEmptyRepositories()
+ public function testDoOperation()
{
- $data = [
- 'paths' => ['path/to/app'],
- 'filePatterns' => ['di' => 'di.xml'],
- 'excludePatterns' => ['/\/Test\//'],
- ];
- $files = ['di' => []];
- $model = new RepositoryGenerator(
- $this->directoryScannerMock,
- $this->classesScannerMock,
- $this->repositoryScannerMock,
- $data
- );
-
$this->classesScannerMock->expects($this->once())
->method('getList')
- ->with($data['paths'][0]);
- $this->directoryScannerMock->expects($this->once())
- ->method('scan')
- ->with(
- $data['paths'][0],
- $data['filePatterns']
- )->willReturn($files);
+ ->with('path/to/app');
$this->repositoryScannerMock->expects($this->once())
->method('setUseAutoload')
->with(false);
+ $files = ['file1', 'file2'];
+ $this->configurationScannerMock->expects($this->once())
+ ->method('scan')
+ ->with('di.xml')
+ ->willReturn($files);
$this->repositoryScannerMock->expects($this->once())
->method('collectEntities')
- ->with($files['di'])
+ ->with($files)
->willReturn([]);
- $this->assertEmpty($model->doOperation());
+ $this->model->doOperation();
}
}
diff --git a/setup/src/Magento/Setup/Test/Unit/Module/Di/App/Task/ServiceDataAttributesGeneratorTest.php b/setup/src/Magento/Setup/Test/Unit/Module/Di/App/Task/ServiceDataAttributesGeneratorTest.php
index b1b01608ea21d..3d97c1083927f 100644
--- a/setup/src/Magento/Setup/Test/Unit/Module/Di/App/Task/ServiceDataAttributesGeneratorTest.php
+++ b/setup/src/Magento/Setup/Test/Unit/Module/Di/App/Task/ServiceDataAttributesGeneratorTest.php
@@ -6,7 +6,6 @@
namespace Magento\Setup\Test\Unit\Module\Di\App\Task;
-use Magento\Setup\Module\Di\App\Task\Operation\ServiceDataAttributesGenerator;
use Magento\Setup\Module\Di\Code\Scanner;
/**
@@ -15,85 +14,52 @@
class ServiceDataAttributesGeneratorTest extends \PHPUnit_Framework_TestCase
{
/**
- * @var \Magento\Setup\Module\Di\Code\Scanner\DirectoryScanner|\PHPUnit_Framework_MockObject_MockObject
+ * @var \Magento\Setup\Module\Di\Code\Scanner\ConfigurationScanner | \PHPUnit_Framework_MockObject_MockObject
*/
- private $directoryScannerMock;
-
+ private $configurationScannerMock;
+
/**
* @var \Magento\Setup\Module\Di\Code\Scanner\ServiceDataAttributesScanner|\PHPUnit_Framework_MockObject_MockObject
*/
private $serviceDataAttributesScannerMock;
- protected function setUp()
- {
- $this->directoryScannerMock = $this->getMock(
- 'Magento\Setup\Module\Di\Code\Scanner\DirectoryScanner',
- [],
- [],
- '',
- false
- );
- $this->serviceDataAttributesScannerMock = $this->getMock(
- 'Magento\Setup\Module\Di\Code\Scanner\ServiceDataAttributesScanner',
- [],
- [],
- '',
- false
- );
- }
-
/**
- * @param $data array
- * @dataProvider doOperationDataProvider
+ * @var \Magento\Setup\Module\Di\App\Task\Operation\ServiceDataAttributesGenerator
*/
- public function testDoOperationEmptyData($data)
- {
- $model = new ServiceDataAttributesGenerator(
- $this->directoryScannerMock,
- $this->serviceDataAttributesScannerMock,
- $data
- );
- $this->directoryScannerMock->expects($this->never())->method('scan');
+ private $model;
- $model->doOperation();
- }
-
- /**
- * @return array
- */
- public function doOperationDataProvider()
+ protected function setUp()
{
- return [
- [[]],
- [['filePatterns' => ['php' => '*.php']]],
- [['path' => 'path']]
- ];
+ $this->configurationScannerMock = $this->getMockBuilder(
+ 'Magento\Setup\Module\Di\Code\Scanner\ConfigurationScanner'
+ )->disableOriginalConstructor()
+ ->getMock();
+ $this->serviceDataAttributesScannerMock = $this->getMockBuilder(
+ 'Magento\Setup\Module\Di\Code\Scanner\ServiceDataAttributesScanner'
+ )->disableOriginalConstructor()
+ ->getMock();
+ $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
+ $this->model = $objectManagerHelper->getObject(
+ 'Magento\Setup\Module\Di\App\Task\Operation\ServiceDataAttributesGenerator',
+ [
+ 'serviceDataAttributesScanner' => $this->serviceDataAttributesScannerMock,
+ 'configurationScanner' => $this->configurationScannerMock,
+ ]
+ );
}
public function testDoOperation()
{
- $data = [
- 'paths' => ['path/to/app'],
- 'filePatterns' => ['di' => 'di.xml'],
- ];
- $files = ['extension_attributes' => []];
- $model = new ServiceDataAttributesGenerator(
- $this->directoryScannerMock,
- $this->serviceDataAttributesScannerMock,
- $data
- );
-
- $this->directoryScannerMock->expects($this->once())
+ $files = ['file1', 'file2'];
+ $this->configurationScannerMock->expects($this->once())
->method('scan')
- ->with(
- $data['paths'][0],
- $data['filePatterns']
- )->willReturn($files);
+ ->with('extension_attributes.xml')
+ ->willReturn($files);
$this->serviceDataAttributesScannerMock->expects($this->once())
->method('collectEntities')
- ->with($files['extension_attributes'])
+ ->with($files)
->willReturn([]);
- $model->doOperation();
+ $this->model->doOperation();
}
}
diff --git a/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Generator/InterceptionConfigurationBuilderTest.php b/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Generator/InterceptionConfigurationBuilderTest.php
index 928afe76a0685..1c41ccd774018 100644
--- a/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Generator/InterceptionConfigurationBuilderTest.php
+++ b/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Generator/InterceptionConfigurationBuilderTest.php
@@ -33,6 +33,11 @@ class InterceptionConfigurationBuilderTest extends \PHPUnit_Framework_TestCase
*/
private $cacheManager;
+ /**
+ * @var \Magento\Framework\ObjectManager\InterceptableValidator|\PHPUnit_Framework_MockObject_MockObject
+ */
+ private $interceptableValidator;
+
protected function setUp()
{
$this->interceptionConfig = $this->getMock(
@@ -56,13 +61,21 @@ protected function setUp()
'',
false
);
+ $this->interceptableValidator = $this->getMock(
+ 'Magento\Framework\ObjectManager\InterceptableValidator',
+ [],
+ [],
+ '',
+ false
+ );
$this->typeReader = $this->getMock('Magento\Setup\Module\Di\Code\Reader\Type', ['isConcrete'], [], '', false);
$this->model = new \Magento\Setup\Module\Di\Code\Generator\InterceptionConfigurationBuilder(
$this->interceptionConfig,
$this->pluginList,
$this->typeReader,
- $this->cacheManager
+ $this->cacheManager,
+ $this->interceptableValidator
);
}
@@ -82,6 +95,11 @@ public function testGetInterceptionConfiguration($plugins)
['Class1', true],
['instance', true],
]);
+ $this->interceptableValidator->expects($this->any())
+ ->method('validate')
+ ->with('Class1')
+ ->willReturn(true);
+
$this->cacheManager->expects($this->once())
->method('setEnabled')
->with([CompiledConfig::TYPE_IDENTIFIER], true);
diff --git a/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Scanner/ConfigurationScannerTest.php b/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Scanner/ConfigurationScannerTest.php
new file mode 100644
index 0000000000000..32e0398890464
--- /dev/null
+++ b/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Scanner/ConfigurationScannerTest.php
@@ -0,0 +1,64 @@
+fileResolverMock = $this->getMockBuilder('Magento\Framework\App\Config\FileResolver')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->areaListMock = $this->getMockBuilder('Magento\Framework\App\AreaList')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
+ $this->model = $objectManagerHelper->getObject(
+ 'Magento\Setup\Module\Di\Code\Scanner\ConfigurationScanner',
+ [
+ 'fileResolver' => $this->fileResolverMock,
+ 'areaList' => $this->areaListMock,
+ ]
+ );
+ }
+
+ public function testScan()
+ {
+ $codes = ['code1', 'code2'];
+ $iteratorMock = $this->getMockBuilder('Magento\Framework\Config\FileIterator')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->areaListMock->expects($this->once())
+ ->method('getCodes')
+ ->willReturn($codes);
+ $counts = count($codes) + 2;
+ $this->fileResolverMock->expects($this->exactly($counts))
+ ->method('get')
+ ->willReturn($iteratorMock);
+ $files = ['file1' => 'onefile', 'file2' => 'anotherfile'];
+ $iteratorMock->expects($this->exactly($counts))
+ ->method('toArray')
+ ->willReturn($files);
+ $this->assertEquals(array_keys($files), $this->model->scan('di.xml'));
+ }
+}