[a-z0-9]+)/i', strtolower($rawExtensions), $matches);
+ if (!empty($matches)) {
+ $extensions = implode(', ', array_unique($matches['extensions']));
+ }
+ $this->setFileExtension($extensions);
+ }
+
//@codeCoverageIgnoreEnd
}
diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Category/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Category/Collection.php
index 325d8ceee0d39..38831ed9138f1 100644
--- a/app/code/Magento/Catalog/Model/ResourceModel/Category/Collection.php
+++ b/app/code/Magento/Catalog/Model/ResourceModel/Category/Collection.php
@@ -311,7 +311,7 @@ public function joinUrlRewrite()
['request_path'],
sprintf(
'{{table}}.is_autogenerated = 1 AND {{table}}.store_id = %d AND {{table}}.entity_type = \'%s\'',
- $this->_storeManager->getStore()->getId(),
+ $this->getStoreId(),
CategoryUrlRewriteGenerator::ENTITY_TYPE
),
'left'
diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Collection/AbstractCollection.php b/app/code/Magento/Catalog/Model/ResourceModel/Collection/AbstractCollection.php
index d329ca6f51572..188167b7c609f 100644
--- a/app/code/Magento/Catalog/Model/ResourceModel/Collection/AbstractCollection.php
+++ b/app/code/Magento/Catalog/Model/ResourceModel/Collection/AbstractCollection.php
@@ -137,7 +137,7 @@ public function getDefaultStoreId()
*
* @param string $table
* @param array|int $attributeIds
- * @return \Magento\Eav\Model\Entity\Collection\AbstractCollection
+ * @return \Magento\Framework\DB\Select
*/
protected function _getLoadAttributesSelect($table, $attributeIds = [])
{
diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php
index 406bd595401ca..886466c3ffd09 100644
--- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php
+++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php
@@ -1535,7 +1535,7 @@ protected function getEntityPkName(\Magento\Eav\Model\Entity\AbstractEntity $ent
}
/**
- * Add requere tax percent flag for product collection
+ * Add require tax percent flag for product collection
*
* @return $this
*/
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Category/Attribute/Backend/ImageTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Category/Attribute/Backend/ImageTest.php
index 88ab0f5a1ce63..247a124a7af1d 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/Category/Attribute/Backend/ImageTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/Category/Attribute/Backend/ImageTest.php
@@ -164,8 +164,7 @@ public function testAfterSave()
$object = new \Magento\Framework\DataObject(
[
- 'test_attribute' => 'test1234.jpg',
- '_additional_data_test_attribute' => [['name' => 'test1234.jpg', 'tmp_name' => 'test-test-1234']]
+ 'test_attribute' => 'test1234.jpg'
]
);
$model->afterSave($object);
@@ -208,7 +207,7 @@ public function testAfterSaveWithExceptions()
->with($this->equalTo($exception));
$object = new \Magento\Framework\DataObject(
[
- '_additional_data_test_attribute' => [['name' => 'test1234.jpg', 'tmp_name' => 'test-test-1234']]
+ 'test_attribute' => 'test1234.jpg'
]
);
$model->afterSave($object);
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/CategoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/CategoryTest.php
index 41dd17ac203b4..c8ee0fc13758d 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/CategoryTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/CategoryTest.php
@@ -655,4 +655,22 @@ public function testGetIdentities()
$category->setId(42);
$this->assertNotEmpty($category->getIdentities());
}
+
+ /**
+ * @return void
+ */
+ public function testGetIdentitiesWithAffectedCategories()
+ {
+ $category = $this->getCategoryModel();
+ $expectedIdentities = [
+ 'catalog_category_1',
+ 'catalog_category_2',
+ 'catalog_category_3',
+ 'catalog_category_product_1',
+ ];
+ $category->setId(1);
+ $category->setAffectedCategoryIds([1,2,3]);
+
+ $this->assertEquals($expectedIdentities, $category->getIdentities());
+ }
}
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/OptionTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/OptionTest.php
index 36aac944953cf..a61cc2889fbf9 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/Product/OptionTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/OptionTest.php
@@ -8,6 +8,9 @@
use \Magento\Catalog\Model\Product\Option;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
+/**
+ * Tests \Magento\Catalog\Model\Product\Option.
+ */
class OptionTest extends \PHPUnit_Framework_TestCase
{
/**
@@ -22,9 +25,9 @@ class OptionTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
+ $this->productMock = $this->getMock(\Magento\Catalog\Model\Product::class, [], [], '', false);
$objectManager = new ObjectManager($this);
- $this->model = $objectManager->getObject('Magento\Catalog\Model\Product\Option');
+ $this->model = $objectManager->getObject(\Magento\Catalog\Model\Product\Option::class);
$this->model->setProduct($this->productMock);
}
@@ -38,7 +41,7 @@ public function testGetProductSku()
public function testGetRegularPrice()
{
$priceInfoMock = $this->getMockForAbstractClass(
- 'Magento\Framework\Pricing\PriceInfoInterface',
+ \Magento\Framework\Pricing\PriceInfoInterface::class,
[],
'',
false,
@@ -47,7 +50,7 @@ public function testGetRegularPrice()
['getAmount', 'getPrice']
);
$priceInfoMock->expects($this->once())->method('getPrice')->willReturnSelf();
- $amountMock = $this->getMockForAbstractClass('Magento\Framework\Pricing\Amount\AmountInterface');
+ $amountMock = $this->getMockForAbstractClass(\Magento\Framework\Pricing\Amount\AmountInterface::class);
$priceInfoMock->expects($this->once())->method('getAmount')->willReturn($amountMock);
$this->productMock->expects($this->once())->method('getPriceInfo')->willReturn($priceInfoMock);
@@ -59,4 +62,41 @@ public function testGetRegularPrice()
$this->model->setPriceType(null);
$this->assertEquals(50, $this->model->getRegularPrice());
}
+
+ /**
+ * Tests removing ineligible characters from file_extension.
+ *
+ * @param string $rawExtensions
+ * @param string $expectedExtensions
+ * @dataProvider beforeSaveFileOptionDataProvider
+ */
+ public function testBeforeSaveFileOption($rawExtensions, $expectedExtensions)
+ {
+ $this->model->setType(Option::OPTION_GROUP_FILE);
+ $this->model->setFileExtension($rawExtensions);
+ $this->model->beforeSave();
+ $actualExtensions = $this->model->getFileExtension();
+ $this->assertEquals(
+ $expectedExtensions,
+ $actualExtensions
+ );
+ }
+
+ /**
+ * Data provider for testBeforeSaveFileOption.
+ *
+ * @return array
+ */
+ public function beforeSaveFileOptionDataProvider()
+ {
+ return [
+ ['JPG, PNG, GIF', 'jpg, png, gif'],
+ ['jpg, jpg, jpg', 'jpg'],
+ ['jpg, png, gif', 'jpg, png, gif'],
+ ['jpg png gif', 'jpg, png, gif'],
+ ['!jpg@png#gif%', 'jpg, png, gif'],
+ ['jpg, png, 123', 'jpg, png, 123'],
+ ['', ''],
+ ];
+ }
}
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Category/Collection/UrlRewriteTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Category/Collection/UrlRewriteTest.php
new file mode 100644
index 0000000000000..d3b3ce05ee4b8
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Category/Collection/UrlRewriteTest.php
@@ -0,0 +1,39 @@
+_model = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Category\Collection::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['joinTable'])
+ ->getMock();
+ }
+
+ public function testStoreIdUsedByUrlRewrite()
+ {
+ $cond = '{{table}}.is_autogenerated = 1 AND {{table}}.store_id = 100 AND {{table}}.entity_type = \'category\'';
+ $this->_model->expects($this->once())
+ ->method('joinTable')
+ ->with(
+ $this->anything(),
+ $this->anything(),
+ $this->anything(),
+ $this->equalTo($cond),
+ $this->anything()
+ );
+ $this->_model->setStoreId(100);
+ $this->_model->joinUrlRewrite();
+ }
+}
diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/CustomOptions.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/CustomOptions.php
index 0b2972d83cde7..9f87d831a4ea6 100755
--- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/CustomOptions.php
+++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/CustomOptions.php
@@ -991,6 +991,7 @@ protected function getFileExtensionFieldConfig($sortOrder)
'data' => [
'config' => [
'label' => __('Compatible File Extensions'),
+ 'notice' => __('Enter separated extensions, like: png, jpg, gif.'),
'componentType' => Field::NAME,
'formElement' => Input::NAME,
'dataScope' => static::FIELD_FILE_EXTENSION_NAME,
diff --git a/app/code/Magento/Catalog/composer.json b/app/code/Magento/Catalog/composer.json
index 4a8d90ea7a5ff..5f0f089030160 100644
--- a/app/code/Magento/Catalog/composer.json
+++ b/app/code/Magento/Catalog/composer.json
@@ -33,7 +33,7 @@
"magento/module-catalog-sample-data": "Sample Data version:100.1.*"
},
"type": "magento2-module",
- "version": "101.0.11",
+ "version": "101.0.13",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml
index 0f17b026774b7..ce1e023712f0f 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml
@@ -266,7 +266,7 @@
}
var newNode = new Ext.tree.TreeNode({
- text : group_name,
+ text : group_name.escapeHTML(),
cls : 'folder',
allowDrop : true,
allowDrag : true
@@ -295,9 +295,10 @@
validateGroupName : function(name, exceptNodeId) {
var textNode;
- var result = true;
+ result = true;
name = name.strip();
+ name = name.escapeHTML();
if (name === '') {
result = false;
}
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/file.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/file.phtml
index 86fdd8705931d..6f6ff90d38030 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/file.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/file.phtml
@@ -41,6 +41,7 @@
+
x %2 px. ',
' ',
diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml
index cd0b2ca1f03ce..1789d83970948 100644
--- a/app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml
@@ -183,6 +183,7 @@
- false
- false
- false
+ - true
- ui/form/field
- category
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/import-handler.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/import-handler.js
index b8109129436df..06b670df8a38b 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/import-handler.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/import-handler.js
@@ -141,6 +141,7 @@ define([
// strip tags
tmpElement = document.createElement('div');
+ str = str.replace(/(<([^>]+)>)/ig, '');
tmpElement.innerHTML = str;
str = tmpElement.textContent || tmpElement.innerText || '';
diff --git a/app/code/Magento/Catalog/view/base/templates/product/price/amount/default.phtml b/app/code/Magento/Catalog/view/base/templates/product/price/amount/default.phtml
index ef6b1cd15c7c9..18c951f51df09 100644
--- a/app/code/Magento/Catalog/view/base/templates/product/price/amount/default.phtml
+++ b/app/code/Magento/Catalog/view/base/templates/product/price/amount/default.phtml
@@ -19,18 +19,15 @@
getPriceDisplayLabel()) ? 'data-label="' . $block->getPriceDisplayLabel() . $block->getPriceDisplayInclExclTaxes() . '"' : '' ?>
data-price-amount="getDisplayValue(); ?>"
data-price-type="getPriceType(); ?>"
- class="price-wrapper getPriceWrapperCss(); ?>">
- formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer()) ?>
+ class="price-wrapper getPriceWrapperCss(); ?>"
+ getSchema() ? ' itemprop="price"' : '' ?>>
+ formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer()) ?>
- getSchema()): ?>
-
- getDisplayValue() ?>
-
-
hasAdjustmentsHtml()): ?>
getAdjustmentsHtml() ?>
getSchema()): ?>
+
diff --git a/app/code/Magento/Catalog/view/base/web/js/price-options.js b/app/code/Magento/Catalog/view/base/web/js/price-options.js
index cbd8ab95618c1..d66c9593c806c 100644
--- a/app/code/Magento/Catalog/view/base/web/js/price-options.js
+++ b/app/code/Magento/Catalog/view/base/web/js/price-options.js
@@ -19,8 +19,10 @@ define([
optionConfig: {},
optionHandlers: {},
optionTemplate: '<%= data.label %>' +
- '<% if (data.finalPrice.value) { %>' +
+ '<% if (data.finalPrice.value > 0) { %>' +
' +<%- data.finalPrice.formatted %>' +
+ '<% } else if (data.finalPrice.value < 0) { %>' +
+ ' <%- data.finalPrice.formatted %>' +
'<% } %>',
controlContainer: 'dd'
};
diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml
index a8f9487058eda..6037704570dae 100644
--- a/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml
+++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml
@@ -40,22 +40,10 @@
-isRedirectToCartEnabled()) : ?>
-
-
-
-
diff --git a/app/code/Magento/CatalogImportExport/composer.json b/app/code/Magento/CatalogImportExport/composer.json
index 59412887bfaaf..920bf0941cd47 100644
--- a/app/code/Magento/CatalogImportExport/composer.json
+++ b/app/code/Magento/CatalogImportExport/composer.json
@@ -16,7 +16,7 @@
"ext-ctype": "*"
},
"type": "magento2-module",
- "version": "100.1.8",
+ "version": "100.1.9",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/CatalogInventory/composer.json b/app/code/Magento/CatalogInventory/composer.json
index 536d9a0b7ebc0..61ace08b645ec 100644
--- a/app/code/Magento/CatalogInventory/composer.json
+++ b/app/code/Magento/CatalogInventory/composer.json
@@ -13,7 +13,7 @@
"magento/module-ui": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.7",
+ "version": "100.1.8",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/CatalogInventory/i18n/en_US.csv b/app/code/Magento/CatalogInventory/i18n/en_US.csv
index 6dbbf9a2d2b7a..14379ec76f542 100644
--- a/app/code/Magento/CatalogInventory/i18n/en_US.csv
+++ b/app/code/Magento/CatalogInventory/i18n/en_US.csv
@@ -48,11 +48,7 @@ Inventory,Inventory
"Only X left Threshold","Only X left Threshold"
"Display Products Availability in Stock on Storefront","Display Products Availability in Stock on Storefront"
"Product Stock Options","Product Stock Options"
-"
- Please note that these settings apply to individual items in the cart, not to the entire cart.
- ","
- Please note that these settings apply to individual items in the cart, not to the entire cart.
- "
+"Please note that these settings apply to individual items in the cart, not to the entire cart.","Please note that these settings apply to individual items in the cart, not to the entire cart."
"Manage Stock","Manage Stock"
Backorders,Backorders
"Maximum Qty Allowed in Shopping Cart","Maximum Qty Allowed in Shopping Cart"
diff --git a/app/code/Magento/CatalogRule/composer.json b/app/code/Magento/CatalogRule/composer.json
index b9d25a29e7f65..8c33932e08cdb 100644
--- a/app/code/Magento/CatalogRule/composer.json
+++ b/app/code/Magento/CatalogRule/composer.json
@@ -17,7 +17,7 @@
"magento/module-catalog-rule-sample-data": "Sample Data version:100.1.*"
},
"type": "magento2-module",
- "version": "100.1.5",
+ "version": "100.1.6",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_edit.xml b/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_edit.xml
index 505557b8950b2..1a3227a4d79b2 100644
--- a/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_edit.xml
+++ b/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_edit.xml
@@ -5,7 +5,7 @@
* See COPYING.txt for license details.
*/
-->
-
+
diff --git a/app/code/Magento/CatalogRuleConfigurable/composer.json b/app/code/Magento/CatalogRuleConfigurable/composer.json
index 2f01e9617e449..db6548145966d 100644
--- a/app/code/Magento/CatalogRuleConfigurable/composer.json
+++ b/app/code/Magento/CatalogRuleConfigurable/composer.json
@@ -14,7 +14,7 @@
"magento/module-catalog-rule": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.3",
+ "version": "100.1.4",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/CatalogSearch/Block/Advanced/Form.php b/app/code/Magento/CatalogSearch/Block/Advanced/Form.php
index baa4f75d185a6..d205c5d937a3d 100644
--- a/app/code/Magento/CatalogSearch/Block/Advanced/Form.php
+++ b/app/code/Magento/CatalogSearch/Block/Advanced/Form.php
@@ -197,16 +197,16 @@ public function getCurrency($attribute)
public function getAttributeInputType($attribute)
{
$dataType = $attribute->getBackend()->getType();
- $imputType = $attribute->getFrontend()->getInputType();
- if ($imputType == 'select' || $imputType == 'multiselect') {
+ $inputType = $attribute->getFrontend()->getInputType();
+ if ($inputType == 'select' || $inputType == 'multiselect') {
return 'select';
}
- if ($imputType == 'boolean') {
+ if ($inputType == 'boolean') {
return 'yesno';
}
- if ($imputType == 'price') {
+ if ($inputType == 'price') {
return 'price';
}
diff --git a/app/code/Magento/CatalogSearch/composer.json b/app/code/Magento/CatalogSearch/composer.json
index 0990dc8b01349..281db72dfcd16 100644
--- a/app/code/Magento/CatalogSearch/composer.json
+++ b/app/code/Magento/CatalogSearch/composer.json
@@ -15,7 +15,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.8",
+ "version": "100.1.9",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/CatalogUrlRewrite/composer.json b/app/code/Magento/CatalogUrlRewrite/composer.json
index 5bbccfc4b77ae..c0abedfa012cc 100644
--- a/app/code/Magento/CatalogUrlRewrite/composer.json
+++ b/app/code/Magento/CatalogUrlRewrite/composer.json
@@ -14,7 +14,7 @@
"magento/module-ui": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.5",
+ "version": "100.1.6",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/CatalogWidget/composer.json b/app/code/Magento/CatalogWidget/composer.json
index 734be1c11523e..29c38a350fe3b 100644
--- a/app/code/Magento/CatalogWidget/composer.json
+++ b/app/code/Magento/CatalogWidget/composer.json
@@ -14,7 +14,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.4",
+ "version": "100.1.5",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Checkout/Block/Cart/Shipping.php b/app/code/Magento/Checkout/Block/Cart/Shipping.php
index b3a9e8d02201f..7e193237a9715 100644
--- a/app/code/Magento/Checkout/Block/Cart/Shipping.php
+++ b/app/code/Magento/Checkout/Block/Cart/Shipping.php
@@ -64,7 +64,7 @@ public function getJsLayout()
foreach ($this->layoutProcessors as $processor) {
$this->jsLayout = $processor->process($this->jsLayout);
}
- return \Zend_Json::encode($this->jsLayout);
+ return json_encode($this->jsLayout, JSON_HEX_TAG);
}
/**
diff --git a/app/code/Magento/Checkout/Block/Cart/Totals.php b/app/code/Magento/Checkout/Block/Cart/Totals.php
index 7861080d5d4b5..3392367008e2d 100644
--- a/app/code/Magento/Checkout/Block/Cart/Totals.php
+++ b/app/code/Magento/Checkout/Block/Cart/Totals.php
@@ -66,7 +66,7 @@ public function getJsLayout()
foreach ($this->layoutProcessors as $processor) {
$this->jsLayout = $processor->process($this->jsLayout);
}
- return parent::getJsLayout();
+ return json_encode($this->jsLayout, JSON_HEX_TAG);
}
/**
diff --git a/app/code/Magento/Checkout/Block/Onepage.php b/app/code/Magento/Checkout/Block/Onepage.php
index ebb5797f2ac03..b232425f95b40 100644
--- a/app/code/Magento/Checkout/Block/Onepage.php
+++ b/app/code/Magento/Checkout/Block/Onepage.php
@@ -66,7 +66,7 @@ public function getJsLayout()
foreach ($this->layoutProcessors as $processor) {
$this->jsLayout = $processor->process($this->jsLayout);
}
- return \Zend_Json::encode($this->jsLayout);
+ return json_encode($this->jsLayout, JSON_HEX_TAG);
}
/**
diff --git a/app/code/Magento/Checkout/CustomerData/DefaultItem.php b/app/code/Magento/Checkout/CustomerData/DefaultItem.php
index 6e917366c9cd2..9351685405a60 100644
--- a/app/code/Magento/Checkout/CustomerData/DefaultItem.php
+++ b/app/code/Magento/Checkout/CustomerData/DefaultItem.php
@@ -6,6 +6,8 @@
namespace Magento\Checkout\CustomerData;
+use Magento\Framework\App\ObjectManager;
+
/**
* Default item
*/
@@ -36,12 +38,20 @@ class DefaultItem extends AbstractItem
*/
protected $checkoutHelper;
+ /**
+ * Escaper
+ *
+ * @var \Magento\Framework\Escaper
+ */
+ private $escaper;
+
/**
* @param \Magento\Catalog\Helper\Image $imageHelper
* @param \Magento\Msrp\Helper\Data $msrpHelper
* @param \Magento\Framework\UrlInterface $urlBuilder
* @param \Magento\Catalog\Helper\Product\ConfigurationPool $configurationPool
* @param \Magento\Checkout\Helper\Data $checkoutHelper
+ * @param \Magento\Framework\Escaper|null $escaper
* @codeCoverageIgnore
*/
public function __construct(
@@ -49,13 +59,15 @@ public function __construct(
\Magento\Msrp\Helper\Data $msrpHelper,
\Magento\Framework\UrlInterface $urlBuilder,
\Magento\Catalog\Helper\Product\ConfigurationPool $configurationPool,
- \Magento\Checkout\Helper\Data $checkoutHelper
+ \Magento\Checkout\Helper\Data $checkoutHelper,
+ \Magento\Framework\Escaper $escaper = null
) {
$this->configurationPool = $configurationPool;
$this->imageHelper = $imageHelper;
$this->msrpHelper = $msrpHelper;
$this->urlBuilder = $urlBuilder;
$this->checkoutHelper = $checkoutHelper;
+ $this->escaper = $escaper ?: ObjectManager::getInstance()->get(\Magento\Framework\Escaper::class);
}
/**
@@ -64,6 +76,8 @@ public function __construct(
protected function doGetItemData()
{
$imageHelper = $this->imageHelper->init($this->getProductForThumbnail(), 'mini_cart_product_thumbnail');
+ $productName = $this->escaper->escapeHtml($this->item->getProduct()->getName());
+
return [
'options' => $this->getOptionList(),
'qty' => $this->item->getQty() * 1,
@@ -71,7 +85,7 @@ protected function doGetItemData()
'configure_url' => $this->getConfigureUrl(),
'is_visible_in_site_visibility' => $this->item->getProduct()->isVisibleInSiteVisibility(),
'product_id' => $this->item->getProduct()->getId(),
- 'product_name' => $this->item->getProduct()->getName(),
+ 'product_name' => $productName,
'product_sku' => $this->item->getProduct()->getSku(),
'product_url' => $this->getProductUrl(),
'product_has_url' => $this->hasProductUrl(),
diff --git a/app/code/Magento/Checkout/composer.json b/app/code/Magento/Checkout/composer.json
index 3b309c2dc8eef..041e9c4aa50bd 100644
--- a/app/code/Magento/Checkout/composer.json
+++ b/app/code/Magento/Checkout/composer.json
@@ -26,7 +26,7 @@
"magento/module-cookie": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.10",
+ "version": "100.1.12",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/item/configure/updatecart.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/item/configure/updatecart.phtml
index a402f0f9d99b7..ddbc32d9012e4 100644
--- a/app/code/Magento/Checkout/view/frontend/templates/cart/item/configure/updatecart.phtml
+++ b/app/code/Magento/Checkout/view/frontend/templates/cart/item/configure/updatecart.phtml
@@ -19,7 +19,7 @@
+ class="input-text qty" data-validate="= $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>"/>
diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml
index f51acf56cfd33..9e44f8f4b48aa 100644
--- a/app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml
+++ b/app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml
@@ -90,7 +90,7 @@ $canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinima
getIsNeedToDisplaySideBar()): ?>
-
-
+
diff --git a/app/code/Magento/CheckoutAgreements/composer.json b/app/code/Magento/CheckoutAgreements/composer.json
index 82032daa092e8..0306f6b14e64e 100644
--- a/app/code/Magento/CheckoutAgreements/composer.json
+++ b/app/code/Magento/CheckoutAgreements/composer.json
@@ -10,7 +10,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.3",
+ "version": "100.1.4",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFiles.php b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFiles.php
index 9a2749469feff..d781b87555981 100644
--- a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFiles.php
+++ b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFiles.php
@@ -5,8 +5,11 @@
*/
namespace Magento\Cms\Controller\Adminhtml\Wysiwyg\Images;
-use Magento\Framework\App\Filesystem\DirectoryList;
+use \Magento\Framework\App\Filesystem\DirectoryList;
+/**
+ * Delete image files.
+ */
class DeleteFiles extends \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images
{
/**
@@ -23,27 +26,39 @@ class DeleteFiles extends \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images
*/
protected $resultRawFactory;
+ /**
+ * @var \Magento\Framework\App\Filesystem\DirectoryResolver
+ */
+ private $directoryResolver;
+
/**
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\Framework\Registry $coreRegistry
* @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
* @param \Magento\Framework\Controller\Result\RawFactory $resultRawFactory
+ * @param \Magento\Framework\App\Filesystem\DirectoryResolver|null $directoryResolver
*/
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\Framework\Registry $coreRegistry,
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory,
- \Magento\Framework\Controller\Result\RawFactory $resultRawFactory
+ \Magento\Framework\Controller\Result\RawFactory $resultRawFactory,
+ \Magento\Framework\App\Filesystem\DirectoryResolver $directoryResolver = null
) {
+ parent::__construct($context, $coreRegistry);
+
$this->resultRawFactory = $resultRawFactory;
$this->resultJsonFactory = $resultJsonFactory;
- parent::__construct($context, $coreRegistry);
+ $this->directoryResolver = $directoryResolver
+ ?: $this->_objectManager->get(\Magento\Framework\App\Filesystem\DirectoryResolver::class);
+
}
/**
* Delete file from media storage.
*
* @return \Magento\Framework\Controller\ResultInterface
+ * @throws \Magento\Framework\Exception\LocalizedException
*/
public function execute()
{
@@ -56,6 +71,11 @@ public function execute()
/** @var $helper \Magento\Cms\Helper\Wysiwyg\Images */
$helper = $this->_objectManager->get(\Magento\Cms\Helper\Wysiwyg\Images::class);
$path = $this->getStorage()->getSession()->getCurrentPath();
+ if (!$this->directoryResolver->validatePath($path, DirectoryList::MEDIA)) {
+ throw new \Magento\Framework\Exception\LocalizedException(
+ __('Directory %1 is not under storage root path.', $path)
+ );
+ }
foreach ($files as $file) {
$file = $helper->idDecode($file);
/** @var \Magento\Framework\Filesystem $filesystem */
diff --git a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFolder.php b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFolder.php
index 8a89de87a6f85..1e8288fb00141 100644
--- a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFolder.php
+++ b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFolder.php
@@ -6,6 +6,11 @@
*/
namespace Magento\Cms\Controller\Adminhtml\Wysiwyg\Images;
+use \Magento\Framework\App\Filesystem\DirectoryList;
+
+/**
+ * Delete image folder.
+ */
class DeleteFolder extends \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images
{
/**
@@ -18,32 +23,48 @@ class DeleteFolder extends \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images
*/
protected $resultRawFactory;
+ /**
+ * @var \Magento\Framework\App\Filesystem\DirectoryResolver
+ */
+ private $directoryResolver;
+
/**
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\Framework\Registry $coreRegistry
* @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
* @param \Magento\Framework\Controller\Result\RawFactory $resultRawFactory
+ * @param \Magento\Framework\App\Filesystem\DirectoryResolver|null $directoryResolver
*/
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\Framework\Registry $coreRegistry,
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory,
- \Magento\Framework\Controller\Result\RawFactory $resultRawFactory
+ \Magento\Framework\Controller\Result\RawFactory $resultRawFactory,
+ \Magento\Framework\App\Filesystem\DirectoryResolver $directoryResolver = null
) {
+ parent::__construct($context, $coreRegistry);
+
$this->resultRawFactory = $resultRawFactory;
$this->resultJsonFactory = $resultJsonFactory;
- parent::__construct($context, $coreRegistry);
+ $this->directoryResolver = $directoryResolver
+ ?: $this->_objectManager->get(\Magento\Framework\App\Filesystem\DirectoryResolver::class);
}
/**
* Delete folder action
*
* @return \Magento\Framework\Controller\ResultInterface
+ * @throws \Magento\Framework\Exception\LocalizedException
*/
public function execute()
{
try {
$path = $this->getStorage()->getCmsWysiwygImages()->getCurrentPath();
+ if (!$this->directoryResolver->validatePath($path, DirectoryList::MEDIA)) {
+ throw new \Magento\Framework\Exception\LocalizedException(
+ __('Directory %1 is not under storage root path.', $path)
+ );
+ }
$this->getStorage()->deleteDirectory($path);
return $this->resultRawFactory->create();
} catch (\Exception $e) {
diff --git a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/NewFolder.php b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/NewFolder.php
index 2124bdabe6009..0f00b03ff6da5 100644
--- a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/NewFolder.php
+++ b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/NewFolder.php
@@ -6,6 +6,11 @@
*/
namespace Magento\Cms\Controller\Adminhtml\Wysiwyg\Images;
+use \Magento\Framework\App\Filesystem\DirectoryList;
+
+/**
+ * Creates new folder.
+ */
class NewFolder extends \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images
{
/**
@@ -13,24 +18,35 @@ class NewFolder extends \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images
*/
protected $resultJsonFactory;
+ /**
+ * @var \Magento\Framework\App\Filesystem\DirectoryResolver
+ */
+ private $directoryResolver;
+
/**
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\Framework\Registry $coreRegistry
* @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
+ * @param \Magento\Framework\App\Filesystem\DirectoryResolver|null $directoryResolver
*/
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\Framework\Registry $coreRegistry,
- \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
+ \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory,
+ \Magento\Framework\App\Filesystem\DirectoryResolver $directoryResolver = null
) {
- $this->resultJsonFactory = $resultJsonFactory;
parent::__construct($context, $coreRegistry);
+
+ $this->resultJsonFactory = $resultJsonFactory;
+ $this->directoryResolver = $directoryResolver
+ ?: $this->_objectManager->get(\Magento\Framework\App\Filesystem\DirectoryResolver::class);
}
/**
* New folder action
*
* @return \Magento\Framework\Controller\ResultInterface
+ * @throws \Magento\Framework\Exception\LocalizedException
*/
public function execute()
{
@@ -38,6 +54,11 @@ public function execute()
$this->_initAction();
$name = $this->getRequest()->getPost('name');
$path = $this->getStorage()->getSession()->getCurrentPath();
+ if (!$this->directoryResolver->validatePath($path, DirectoryList::MEDIA)) {
+ throw new \Magento\Framework\Exception\LocalizedException(
+ __('Directory %1 is not under storage root path.', $path)
+ );
+ }
$result = $this->getStorage()->createDirectory($name, $path);
} catch (\Exception $e) {
$result = ['error' => true, 'message' => $e->getMessage()];
diff --git a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/Upload.php b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/Upload.php
index 7a94c4ab6aa12..b5cbfddcf7db9 100644
--- a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/Upload.php
+++ b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/Upload.php
@@ -6,6 +6,11 @@
*/
namespace Magento\Cms\Controller\Adminhtml\Wysiwyg\Images;
+use \Magento\Framework\App\Filesystem\DirectoryList;
+
+/**
+ * Upload image.
+ */
class Upload extends \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images
{
/**
@@ -13,31 +18,48 @@ class Upload extends \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images
*/
protected $resultJsonFactory;
+ /**
+ * @var \Magento\Framework\App\Filesystem\DirectoryResolver
+ */
+ private $directoryResolver;
+
/**
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\Framework\Registry $coreRegistry
* @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
+ * @param \Magento\Framework\App\Filesystem\DirectoryResolver|null $directoryResolver
+ * @throws \RuntimeException
*/
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\Framework\Registry $coreRegistry,
- \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
+ \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory,
+ \Magento\Framework\App\Filesystem\DirectoryResolver $directoryResolver = null
) {
- $this->resultJsonFactory = $resultJsonFactory;
parent::__construct($context, $coreRegistry);
+
+ $this->resultJsonFactory = $resultJsonFactory;
+ $this->directoryResolver = $directoryResolver
+ ?: $this->_objectManager->get(\Magento\Framework\App\Filesystem\DirectoryResolver::class);
}
/**
* Files upload processing
*
* @return \Magento\Framework\Controller\ResultInterface
+ * @throws \Magento\Framework\Exception\LocalizedException
*/
public function execute()
{
try {
$this->_initAction();
- $targetPath = $this->getStorage()->getSession()->getCurrentPath();
- $result = $this->getStorage()->uploadFile($targetPath, $this->getRequest()->getParam('type'));
+ $path = $this->getStorage()->getSession()->getCurrentPath();
+ if (!$this->directoryResolver->validatePath($path, DirectoryList::MEDIA)) {
+ throw new \Magento\Framework\Exception\LocalizedException(
+ __('Directory %1 is not under storage root path.', $path)
+ );
+ }
+ $result = $this->getStorage()->uploadFile($path, $this->getRequest()->getParam('type'));
} catch (\Exception $e) {
$result = ['error' => $e->getMessage(), 'errorcode' => $e->getCode()];
}
diff --git a/app/code/Magento/Cms/Helper/Wysiwyg/Images.php b/app/code/Magento/Cms/Helper/Wysiwyg/Images.php
index a557e045c5ef2..a94127eafdae1 100644
--- a/app/code/Magento/Cms/Helper/Wysiwyg/Images.php
+++ b/app/code/Magento/Cms/Helper/Wysiwyg/Images.php
@@ -9,6 +9,8 @@
/**
* Wysiwyg Images Helper
+ *
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Images extends \Magento\Framework\App\Helper\AbstractHelper
{
@@ -127,17 +129,23 @@ public function convertPathToId($path)
}
/**
- * Decode HTML element id
+ * Decode HTML element id.
*
* @param string $id
* @return string
+ * @throws \InvalidArgumentException When path contains restricted symbols.
*/
public function convertIdToPath($id)
{
if ($id === \Magento\Theme\Helper\Storage::NODE_ROOT) {
return $this->getStorageRoot();
} else {
- return $this->getStorageRoot() . $this->idDecode($id);
+ $path = $this->getStorageRoot() . $this->idDecode($id);
+ if (strpos($path, DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR) !== false) {
+ throw new \InvalidArgumentException('Path is invalid');
+ }
+
+ return $path;
}
}
@@ -253,7 +261,7 @@ public function idEncode($string)
}
/**
- * Revert opration to idEncode
+ * Revert operation to idEncode
*
* @param string $string
* @return string
diff --git a/app/code/Magento/Cms/Model/PageRepository.php b/app/code/Magento/Cms/Model/PageRepository.php
index 1b20f0551f2b5..4c2468913abd8 100644
--- a/app/code/Magento/Cms/Model/PageRepository.php
+++ b/app/code/Magento/Cms/Model/PageRepository.php
@@ -102,7 +102,7 @@ public function __construct(
*/
public function save(\Magento\Cms\Api\Data\PageInterface $page)
{
- if (empty($page->getStoreId())) {
+ if ($page->getStoreId() === null) {
$storeId = $this->storeManager->getStore()->getId();
$page->setStoreId($storeId);
}
diff --git a/app/code/Magento/Cms/Model/ResourceModel/Block/Grid/Collection.php b/app/code/Magento/Cms/Model/ResourceModel/Block/Grid/Collection.php
index 7924f8039b2c2..bfd56d85b4cb2 100644
--- a/app/code/Magento/Cms/Model/ResourceModel/Block/Grid/Collection.php
+++ b/app/code/Magento/Cms/Model/ResourceModel/Block/Grid/Collection.php
@@ -6,7 +6,7 @@
namespace Magento\Cms\Model\ResourceModel\Block\Grid;
use Magento\Framework\Api\Search\SearchResultInterface;
-use Magento\Framework\Search\AggregationInterface;
+use Magento\Framework\Api\Search\AggregationInterface;
use Magento\Cms\Model\ResourceModel\Block\Collection as BlockCollection;
/**
@@ -82,6 +82,7 @@ public function getAggregations()
public function setAggregations($aggregations)
{
$this->aggregations = $aggregations;
+ return $this;
}
/**
diff --git a/app/code/Magento/Cms/Model/ResourceModel/Page/Grid/Collection.php b/app/code/Magento/Cms/Model/ResourceModel/Page/Grid/Collection.php
index 01a1f83b83db9..63f5e1c83df46 100644
--- a/app/code/Magento/Cms/Model/ResourceModel/Page/Grid/Collection.php
+++ b/app/code/Magento/Cms/Model/ResourceModel/Page/Grid/Collection.php
@@ -83,6 +83,7 @@ public function getAggregations()
public function setAggregations($aggregations)
{
$this->aggregations = $aggregations;
+ return $this;
}
/**
diff --git a/app/code/Magento/Cms/Test/Unit/Helper/Wysiwyg/ImagesTest.php b/app/code/Magento/Cms/Test/Unit/Helper/Wysiwyg/ImagesTest.php
index 21ccdea360ccc..bf7ba8932f5c6 100644
--- a/app/code/Magento/Cms/Test/Unit/Helper/Wysiwyg/ImagesTest.php
+++ b/app/code/Magento/Cms/Test/Unit/Helper/Wysiwyg/ImagesTest.php
@@ -77,15 +77,15 @@ protected function setUp()
$this->path = 'PATH/';
$this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
- $this->eventManagerMock = $this->getMock('Magento\Framework\Event\ManagerInterface', [], [], '', false);
+ $this->eventManagerMock = $this->getMock(\Magento\Framework\Event\ManagerInterface::class, [], [], '', false);
- $this->requestMock = $this->getMock('Magento\Framework\App\RequestInterface', [], [], '', false);
+ $this->requestMock = $this->getMock(\Magento\Framework\App\RequestInterface::class, [], [], '', false);
- $this->urlEncoderMock = $this->getMock('Magento\Framework\Url\EncoderInterface', [], [], '', false);
+ $this->urlEncoderMock = $this->getMock(\Magento\Framework\Url\EncoderInterface::class, [], [], '', false);
- $this->backendDataMock = $this->getMock('Magento\Backend\Helper\Data', [], [], '', false);
+ $this->backendDataMock = $this->getMock(\Magento\Backend\Helper\Data::class, [], [], '', false);
- $this->contextMock = $this->getMock('Magento\Framework\App\Helper\Context', [], [], '', false);
+ $this->contextMock = $this->getMock(\Magento\Framework\App\Helper\Context::class, [], [], '', false);
$this->contextMock->expects($this->any())
->method('getEventManager')
->willReturn($this->eventManagerMock);
@@ -97,7 +97,7 @@ protected function setUp()
->willReturn($this->urlEncoderMock);
$this->directoryWriteMock = $this->getMock(
- '\Magento\Framework\Filesystem\Directory\Write',
+ \Magento\Framework\Filesystem\Directory\Write::class,
[],
['path' => $this->path],
'',
@@ -112,12 +112,12 @@ protected function setUp()
]
);
- $this->filesystemMock = $this->getMock('Magento\Framework\Filesystem', [], [], '', false);
+ $this->filesystemMock = $this->getMock(\Magento\Framework\Filesystem::class, [], [], '', false);
$this->filesystemMock->expects($this->once())
->method('getDirectoryWrite')
->willReturn($this->directoryWriteMock);
- $this->storeManagerMock = $this->getMockBuilder('Magento\Store\Model\StoreManagerInterface')
+ $this->storeManagerMock = $this->getMockBuilder(\Magento\Store\Model\StoreManagerInterface::class)
->setMethods(
[
'clearWebsiteCache', 'getDefaultStoreView', 'getGroup', 'getGroups',
@@ -128,10 +128,10 @@ protected function setUp()
->disableOriginalConstructor()
->getMock();
- $this->storeMock = $this->getMock('Magento\Store\Model\Store', [], [], '', false);
+ $this->storeMock = $this->getMock(\Magento\Store\Model\Store::class, [], [], '', false);
$this->imagesHelper = $this->objectManager->getObject(
- 'Magento\Cms\Helper\Wysiwyg\Images',
+ \Magento\Cms\Helper\Wysiwyg\Images::class,
[
'context' => $this->contextMock,
'filesystem' => $this->filesystemMock,
@@ -233,6 +233,15 @@ public function testConvertIdToPathNodeRoot()
$this->assertEquals($this->imagesHelper->getStorageRoot(), $this->imagesHelper->convertIdToPath($pathId));
}
+ /**
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessage Path is invalid
+ */
+ public function testConvertIdToPathInvalid()
+ {
+ $this->imagesHelper->convertIdToPath('Ly4uLy4uLy4uLy4uLy4uL3dvcms-');
+ }
+
/**
* @param string $fileName
* @param int $maxLength
@@ -360,7 +369,7 @@ public function testGetCurrentPath($pathId, $expectedPath, $isExist)
public function testGetCurrentPathThrowException()
{
$this->setExpectedException(
- '\Magento\Framework\Exception\LocalizedException',
+ \Magento\Framework\Exception\LocalizedException::class,
'The directory PATH/wysiwyg is not writable by server.'
);
diff --git a/app/code/Magento/Cms/Test/Unit/Model/Wysiwyg/Images/StorageTest.php b/app/code/Magento/Cms/Test/Unit/Model/Wysiwyg/Images/StorageTest.php
index 9c894cbd4b529..6efd13716925e 100644
--- a/app/code/Magento/Cms/Test/Unit/Model/Wysiwyg/Images/StorageTest.php
+++ b/app/code/Magento/Cms/Test/Unit/Model/Wysiwyg/Images/StorageTest.php
@@ -113,9 +113,9 @@ class StorageTest extends \PHPUnit_Framework_TestCase
*/
protected function setUp()
{
- $this->filesystemMock = $this->getMock('Magento\Framework\Filesystem', [], [], '', false);
+ $this->filesystemMock = $this->getMock(\Magento\Framework\Filesystem::class, [], [], '', false);
$this->driverMock = $this->getMockForAbstractClass(
- 'Magento\Framework\Filesystem\DriverInterface',
+ \Magento\Framework\Filesystem\DriverInterface::class,
[],
'',
false,
@@ -123,114 +123,103 @@ protected function setUp()
true,
['getRealPath']
);
- $this->driverMock->expects($this->any())->method('getRealPath')->will($this->returnArgument(0));
+ $this->driverMock->expects($this->any())->method('getRealPath')->willReturnArgument(0);
$this->directoryMock = $this->getMock(
- 'Magento\Framework\Filesystem\Directory\Write',
+ \Magento\Framework\Filesystem\Directory\Write::class,
['delete', 'getDriver', 'create'],
[],
'',
false
);
- $this->directoryMock->expects(
- $this->any()
- )->method(
- 'getDriver'
- )->will(
- $this->returnValue($this->driverMock)
- );
+ $this->directoryMock->expects($this->any())
+ ->method('getDriver')
+ ->willReturn($this->driverMock);
$this->filesystemMock = $this->getMock(
- 'Magento\Framework\Filesystem',
+ \Magento\Framework\Filesystem::class,
['getDirectoryWrite'],
[],
'',
false
);
- $this->filesystemMock->expects(
- $this->any()
- )->method(
- 'getDirectoryWrite'
- )->with(
- DirectoryList::MEDIA
- )->will(
- $this->returnValue($this->directoryMock)
- );
+ $this->filesystemMock->expects($this->any())
+ ->method('getDirectoryWrite')
+ ->with(DirectoryList::MEDIA)
+ ->willReturn($this->directoryMock);
$this->adapterFactoryMock = $this->getMock(
- 'Magento\Framework\Image\AdapterFactory',
+ \Magento\Framework\Image\AdapterFactory::class,
[],
[],
'',
false
);
$this->imageHelperMock = $this->getMock(
- 'Magento\Cms\Helper\Wysiwyg\Images',
+ \Magento\Cms\Helper\Wysiwyg\Images::class,
['getStorageRoot'],
[],
'',
false
);
- $this->imageHelperMock->expects(
- $this->any()
- )->method(
- 'getStorageRoot'
- )->will(
- $this->returnValue(self::STORAGE_ROOT_DIR)
- );
+ $this->imageHelperMock->expects($this->any())
+ ->method('getStorageRoot')
+ ->willReturn(self::STORAGE_ROOT_DIR);
$this->resizeParameters = ['width' => 100, 'height' => 50];
$this->storageCollectionFactoryMock = $this->getMock(
- 'Magento\Cms\Model\Wysiwyg\Images\Storage\CollectionFactory',
+ \Magento\Cms\Model\Wysiwyg\Images\Storage\CollectionFactory::class,
['create'],
[],
'',
false
);
$this->storageFileFactoryMock = $this->getMock(
- 'Magento\MediaStorage\Model\File\Storage\FileFactory',
+ \Magento\MediaStorage\Model\File\Storage\FileFactory::class,
[],
[],
'',
false
);
$this->storageDatabaseFactoryMock = $this->getMock(
- 'Magento\MediaStorage\Model\File\Storage\DatabaseFactory',
+ \Magento\MediaStorage\Model\File\Storage\DatabaseFactory::class,
[],
[],
'',
false
);
$this->directoryDatabaseFactoryMock = $this->getMock(
- 'Magento\MediaStorage\Model\File\Storage\Directory\DatabaseFactory',
+ \Magento\MediaStorage\Model\File\Storage\Directory\DatabaseFactory::class,
['create'],
[],
'',
false
);
$this->directoryCollectionMock = $this->getMock(
- 'Magento\MediaStorage\Model\File\Storage\Directory\Database',
+ \Magento\MediaStorage\Model\File\Storage\Directory\Database::class,
[],
[],
'',
false
);
- $this->uploaderFactoryMock = $this->getMockBuilder('Magento\MediaStorage\Model\File\UploaderFactory')
+ $this->uploaderFactoryMock = $this->getMockBuilder(\Magento\MediaStorage\Model\File\UploaderFactory::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->sessionMock = $this->getMockBuilder(\Magento\Backend\Model\Session::class)
->disableOriginalConstructor()
->getMock();
- $this->sessionMock = $this->getMock('Magento\Backend\Model\Session', [], [], '', false);
- $this->backendUrlMock = $this->getMock('Magento\Backend\Model\Url', [], [], '', false);
+ $this->backendUrlMock = $this->getMock(\Magento\Backend\Model\Url::class, [], [], '', false);
- $this->coreFileStorageMock = $this->getMockBuilder('Magento\MediaStorage\Helper\File\Storage\Database')
+ $this->coreFileStorageMock = $this->getMockBuilder(\Magento\MediaStorage\Helper\File\Storage\Database::class)
->disableOriginalConstructor()
->getMock();
$this->objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
$this->imagesStorage = $this->objectManagerHelper->getObject(
- 'Magento\Cms\Model\Wysiwyg\Images\Storage',
+ \Magento\Cms\Model\Wysiwyg\Images\Storage::class,
[
'session' => $this->sessionMock,
'backendUrl' => $this->backendUrlMock,
@@ -238,7 +227,7 @@ protected function setUp()
'coreFileStorageDb' => $this->coreFileStorageMock,
'filesystem' => $this->filesystemMock,
'imageFactory' => $this->adapterFactoryMock,
- 'assetRepo' => $this->getMock('Magento\Framework\View\Asset\Repository', [], [], '', false),
+ 'assetRepo' => $this->getMock(\Magento\Framework\View\Asset\Repository::class, [], [], '', false),
'storageCollectionFactory' => $this->storageCollectionFactoryMock,
'storageFileFactory' => $this->storageFileFactoryMock,
'storageDatabaseFactory' => $this->storageDatabaseFactoryMock,
@@ -247,8 +236,8 @@ protected function setUp()
'resizeParameters' => $this->resizeParameters,
'dirs' => [
'exclude' => [],
- 'include' => []
- ]
+ 'include' => [],
+ ],
]
);
}
@@ -275,7 +264,7 @@ public function testGetResizeHeight()
public function testDeleteDirectoryOverRoot()
{
$this->setExpectedException(
- '\Magento\Framework\Exception\LocalizedException',
+ \Magento\Framework\Exception\LocalizedException::class,
sprintf('Directory %s is not under storage root path.', self::INVALID_DIRECTORY_OVER_ROOT)
);
$this->imagesStorage->deleteDirectory(self::INVALID_DIRECTORY_OVER_ROOT);
@@ -287,7 +276,7 @@ public function testDeleteDirectoryOverRoot()
public function testDeleteRootDirectory()
{
$this->setExpectedException(
- '\Magento\Framework\Exception\LocalizedException',
+ \Magento\Framework\Exception\LocalizedException::class,
sprintf('We can\'t delete root directory %s right now.', self::STORAGE_ROOT_DIR)
);
$this->imagesStorage->deleteDirectory(self::STORAGE_ROOT_DIR);
@@ -324,10 +313,10 @@ public function testGetDirsCollectionCreateSubDirectories()
* @param array $expectedRemoveKeys
* @dataProvider dirsCollectionDataProvider
*/
- public function testGetDirsCollection($exclude, $include, $fileNames, $expectedRemoveKeys)
+ public function testGetDirsCollection(array $exclude, array $include, array $fileNames, array $expectedRemoveKeys)
{
$this->imagesStorage = $this->objectManagerHelper->getObject(
- 'Magento\Cms\Model\Wysiwyg\Images\Storage',
+ \Magento\Cms\Model\Wysiwyg\Images\Storage::class,
[
'session' => $this->sessionMock,
'backendUrl' => $this->backendUrlMock,
@@ -335,7 +324,7 @@ public function testGetDirsCollection($exclude, $include, $fileNames, $expectedR
'coreFileStorageDb' => $this->coreFileStorageMock,
'filesystem' => $this->filesystemMock,
'imageFactory' => $this->adapterFactoryMock,
- 'assetRepo' => $this->getMock('Magento\Framework\View\Asset\Repository', [], [], '', false),
+ 'assetRepo' => $this->getMock(\Magento\Framework\View\Asset\Repository::class, [], [], '', false),
'storageCollectionFactory' => $this->storageCollectionFactoryMock,
'storageFileFactory' => $this->storageFileFactoryMock,
'storageDatabaseFactory' => $this->storageDatabaseFactoryMock,
@@ -344,15 +333,15 @@ public function testGetDirsCollection($exclude, $include, $fileNames, $expectedR
'resizeParameters' => $this->resizeParameters,
'dirs' => [
'exclude' => $exclude,
- 'include' => $include
- ]
+ 'include' => $include,
+ ],
]
);
$collection = [];
foreach ($fileNames as $filename) {
/** @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject $objectMock */
- $objectMock = $this->getMock('Magento\Framework\DataObject', ['getFilename'], [], '', false);
+ $objectMock = $this->getMock(\Magento\Framework\DataObject::class, ['getFilename'], [], '', false);
$objectMock->expects($this->any())
->method('getFilename')
->willReturn(self::STORAGE_ROOT_DIR . $filename);
@@ -370,11 +359,11 @@ public function dirsCollectionDataProvider()
return [
[
'exclude' => [
- ['name' => 'dress']
+ ['name' => 'dress'],
],
'include' => [],
'filenames' => [],
- 'expectRemoveKeys' => []
+ 'expectRemoveKeys' => [],
],
[
'exclude' => [],
@@ -382,36 +371,36 @@ public function dirsCollectionDataProvider()
'filenames' => [
'/dress',
],
- 'expectRemoveKeys' => []
+ 'expectRemoveKeys' => [],
],
[
'exclude' => [
- ['name' => 'dress']
+ ['name' => 'dress'],
],
'include' => [],
'filenames' => [
'/collection',
],
- 'expectRemoveKeys' => []
+ 'expectRemoveKeys' => [],
],
[
'exclude' => [
['name' => 'gear', 'regexp' => 1],
['name' => 'home', 'regexp' => 1],
['name' => 'collection'],
- ['name' => 'dress']
+ ['name' => 'dress'],
],
'include' => [
['name' => 'home', 'regexp' => 1],
- ['name' => 'collection']
+ ['name' => 'collection'],
],
'filenames' => [
'/dress',
'/collection',
'/gear'
],
- 'expectRemoveKeys' => [[0], [2]]
- ]
+ 'expectRemoveKeys' => [[0], [2]],
+ ],
];
}
@@ -422,10 +411,10 @@ public function dirsCollectionDataProvider()
* @param array $collectionArray
* @param array $expectedRemoveKeys
*/
- protected function generalTestGetDirsCollection($path, $collectionArray = [], $expectedRemoveKeys = [])
+ protected function generalTestGetDirsCollection($path, array $collectionArray = [], array $expectedRemoveKeys = [])
{
/** @var StorageCollection|\PHPUnit_Framework_MockObject_MockObject $storageCollectionMock */
- $storageCollectionMock = $this->getMockBuilder('Magento\Cms\Model\Wysiwyg\Images\Storage\Collection')
+ $storageCollectionMock = $this->getMockBuilder(\Magento\Cms\Model\Wysiwyg\Images\Storage\Collection::class)
->disableOriginalConstructor()
->getMock();
$storageCollectionMock->expects($this->once())
diff --git a/app/code/Magento/Cms/composer.json b/app/code/Magento/Cms/composer.json
index 64b88d212a834..c9f2365548fbd 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.1.*"
},
"type": "magento2-module",
- "version": "101.0.9",
+ "version": "101.0.11",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/CmsUrlRewrite/composer.json b/app/code/Magento/CmsUrlRewrite/composer.json
index b3a85874a3faf..fdc0a52cac714 100644
--- a/app/code/Magento/CmsUrlRewrite/composer.json
+++ b/app/code/Magento/CmsUrlRewrite/composer.json
@@ -9,7 +9,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.3",
+ "version": "100.1.4",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Config/composer.json b/app/code/Magento/Config/composer.json
index 238e0c80a38ce..c996a6d97d47a 100644
--- a/app/code/Magento/Config/composer.json
+++ b/app/code/Magento/Config/composer.json
@@ -15,7 +15,7 @@
"magento/module-deploy": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.7",
+ "version": "100.1.8",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml b/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml
index 0c2045cbe5232..6ba13ad68e6ca 100644
--- a/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml
+++ b/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml
@@ -21,7 +21,7 @@ $_colspan = $block->isAddAfter() ? 2 : 1;
getColumns() as $columnName => $column): ?>
- Action
+
diff --git a/app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php b/app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php
index 38cca1bee6a6a..e895a739b1736 100644
--- a/app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php
+++ b/app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php
@@ -246,9 +246,8 @@ protected function _getSuperAttributeId($productId, $attributeId)
{
if (isset($this->_productSuperAttrs["{$productId}_{$attributeId}"])) {
return $this->_productSuperAttrs["{$productId}_{$attributeId}"];
- } else {
- return null;
}
+ return null;
}
/**
diff --git a/app/code/Magento/ConfigurableImportExport/composer.json b/app/code/Magento/ConfigurableImportExport/composer.json
index 542981da181fd..d4c32b905ed11 100644
--- a/app/code/Magento/ConfigurableImportExport/composer.json
+++ b/app/code/Magento/ConfigurableImportExport/composer.json
@@ -11,7 +11,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.3",
+ "version": "100.1.4",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/ConfigurableProduct/CustomerData/ConfigurableItem.php b/app/code/Magento/ConfigurableProduct/CustomerData/ConfigurableItem.php
index 0a4fc20578ed9..3a9ed653305c5 100644
--- a/app/code/Magento/ConfigurableProduct/CustomerData/ConfigurableItem.php
+++ b/app/code/Magento/ConfigurableProduct/CustomerData/ConfigurableItem.php
@@ -26,6 +26,7 @@ class ConfigurableItem extends DefaultItem
* @param \Magento\Catalog\Helper\Product\ConfigurationPool $configurationPool
* @param \Magento\Checkout\Helper\Data $checkoutHelper
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
+ * @param \Magento\Framework\Escaper|null $escaper
*/
public function __construct(
\Magento\Catalog\Helper\Image $imageHelper,
@@ -33,14 +34,16 @@ public function __construct(
\Magento\Framework\UrlInterface $urlBuilder,
\Magento\Catalog\Helper\Product\ConfigurationPool $configurationPool,
\Magento\Checkout\Helper\Data $checkoutHelper,
- \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
+ \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
+ \Magento\Framework\Escaper $escaper = null
) {
parent::__construct(
$imageHelper,
$msrpHelper,
$urlBuilder,
$configurationPool,
- $checkoutHelper
+ $checkoutHelper,
+ $escaper
);
$this->_scopeConfig = $scopeConfig;
}
diff --git a/app/code/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider.php b/app/code/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider.php
index f96c943e3dc4a..f32dd43508783 100644
--- a/app/code/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider.php
+++ b/app/code/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider.php
@@ -9,6 +9,8 @@
use Magento\Catalog\Model\ResourceModel\Product\LinkedProductSelectBuilderInterface;
use Magento\Framework\App\ResourceConnection;
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
+use Magento\Store\Model\StoreManagerInterface;
+use Magento\Framework\App\ObjectManager;
/**
* Retrieve list of products where each product contains lower price than others at least for one possible price type
@@ -31,7 +33,12 @@ class LowestPriceOptionsProvider implements LowestPriceOptionsProviderInterface
private $collectionFactory;
/**
- * Key is product id. Value is prepared product collection
+ * @var StoreManagerInterface
+ */
+ private $storeManager;
+
+ /**
+ * Key is product id and store id. Value is array of prepared linked products
*
* @var array
*/
@@ -41,15 +48,19 @@ class LowestPriceOptionsProvider implements LowestPriceOptionsProviderInterface
* @param ResourceConnection $resourceConnection
* @param LinkedProductSelectBuilderInterface $linkedProductSelectBuilder
* @param CollectionFactory $collectionFactory
+ * @param StoreManagerInterface $storeManager
*/
public function __construct(
ResourceConnection $resourceConnection,
LinkedProductSelectBuilderInterface $linkedProductSelectBuilder,
- CollectionFactory $collectionFactory
+ CollectionFactory $collectionFactory,
+ StoreManagerInterface $storeManager = null
) {
$this->resource = $resourceConnection;
$this->linkedProductSelectBuilder = $linkedProductSelectBuilder;
$this->collectionFactory = $collectionFactory;
+ $this->storeManager = $storeManager
+ ?: ObjectManager::getInstance()->get(StoreManagerInterface::class);
}
/**
@@ -57,16 +68,19 @@ public function __construct(
*/
public function getProducts(ProductInterface $product)
{
- if (!isset($this->productsMap[$product->getId()])) {
+ $key = $this->storeManager->getStore()->getId() . '-' . $product->getId();
+ if (!isset($this->productsMap[$key])) {
$productIds = $this->resource->getConnection()->fetchCol(
'(' . implode(') UNION (', $this->linkedProductSelectBuilder->build($product->getId())) . ')'
);
- $this->productsMap[$product->getId()] = $this->collectionFactory->create()
- ->addAttributeToSelect(['price', 'special_price'])
+ $this->productsMap[$key] = $this->collectionFactory->create()
+ ->addAttributeToSelect(
+ ['price', 'special_price', 'special_from_date', 'special_to_date', 'tax_class_id']
+ )
->addIdFilter($productIds)
->getItems();
}
- return $this->productsMap[$product->getId()];
+ return $this->productsMap[$key];
}
}
diff --git a/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/Data/AssociatedProducts.php b/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/Data/AssociatedProducts.php
index 530a554eb4a5d..637e30348a88f 100644
--- a/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/Data/AssociatedProducts.php
+++ b/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/Data/AssociatedProducts.php
@@ -17,6 +17,8 @@
use Magento\Framework\Locale\CurrencyInterface;
use Magento\Framework\Json\Helper\Data as JsonHelper;
use Magento\Catalog\Helper\Image as ImageHelper;
+use Magento\Framework\App\ObjectManager;
+use Magento\Framework\Escaper;
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -83,6 +85,11 @@ class AssociatedProducts
*/
protected $imageHelper;
+ /**
+ * @var Escaper
+ */
+ private $escaper;
+
/**
* @param LocatorInterface $locator
* @param UrlInterface $urlBuilder
@@ -93,6 +100,8 @@ class AssociatedProducts
* @param CurrencyInterface $localeCurrency
* @param JsonHelper $jsonHelper
* @param ImageHelper $imageHelper
+ * @param Escaper $escaper
+ * @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
LocatorInterface $locator,
@@ -103,7 +112,8 @@ public function __construct(
VariationMatrix $variationMatrix,
CurrencyInterface $localeCurrency,
JsonHelper $jsonHelper,
- ImageHelper $imageHelper
+ ImageHelper $imageHelper,
+ Escaper $escaper = null
) {
$this->locator = $locator;
$this->urlBuilder = $urlBuilder;
@@ -114,6 +124,7 @@ public function __construct(
$this->localeCurrency = $localeCurrency;
$this->jsonHelper = $jsonHelper;
$this->imageHelper = $imageHelper;
+ $this->escaper = $escaper ?: ObjectManager::getInstance()->get(Escaper::class);
}
/**
@@ -280,9 +291,9 @@ protected function prepareVariations()
'product_link' => '' . $product->getName() . ' ',
- 'sku' => $product->getSku(),
- 'name' => $product->getName(),
+ ) . '" target="_blank">' . $this->escaper->escapeHtml($product->getName()) . '',
+ 'sku' => $this->escaper->escapeHtml($product->getSku()),
+ 'name' => $this->escaper->escapeHtml($product->getName()),
'qty' => $this->getProductStockQty($product),
'price' => $currency->toCurrency(sprintf("%f", $price), ['display' => false]),
'price_string' => $currency->toCurrency(sprintf("%f", $price)),
diff --git a/app/code/Magento/ConfigurableProduct/composer.json b/app/code/Magento/ConfigurableProduct/composer.json
index 5d544a29485a2..1e771034969d3 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.1.*"
},
"type": "magento2-module",
- "version": "100.1.11",
+ "version": "100.1.13",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Contact/composer.json b/app/code/Magento/Contact/composer.json
index 401451d1f3977..628681ee2912a 100644
--- a/app/code/Magento/Contact/composer.json
+++ b/app/code/Magento/Contact/composer.json
@@ -10,7 +10,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.3",
+ "version": "100.1.4",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Cookie/composer.json b/app/code/Magento/Cookie/composer.json
index 0af97399a3e3e..3e8e4706324f6 100644
--- a/app/code/Magento/Cookie/composer.json
+++ b/app/code/Magento/Cookie/composer.json
@@ -10,7 +10,7 @@
"magento/module-backend": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.3",
+ "version": "100.1.4",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Cron/Observer/ProcessCronQueueObserver.php b/app/code/Magento/Cron/Observer/ProcessCronQueueObserver.php
index 6fb10a9b765d1..08c7a80c7639d 100644
--- a/app/code/Magento/Cron/Observer/ProcessCronQueueObserver.php
+++ b/app/code/Magento/Cron/Observer/ProcessCronQueueObserver.php
@@ -9,7 +9,7 @@
*/
namespace Magento\Cron\Observer;
-use Magento\Framework\Console\CLI;
+use Magento\Framework\Console\Cli;
use Magento\Framework\Event\ObserverInterface;
use \Magento\Cron\Model\Schedule;
@@ -454,7 +454,6 @@ protected function saveSchedule($jobCode, $cronExpression, $timeInterval, $exist
if ($schedule->trySchedule()) {
// time matches cron expression
$schedule->save();
- return;
}
}
}
diff --git a/app/code/Magento/Cron/Test/Unit/Observer/ProcessCronQueueObserverTest.php b/app/code/Magento/Cron/Test/Unit/Observer/ProcessCronQueueObserverTest.php
index 43b1cf2269504..d89ada3b9fb12 100644
--- a/app/code/Magento/Cron/Test/Unit/Observer/ProcessCronQueueObserverTest.php
+++ b/app/code/Magento/Cron/Test/Unit/Observer/ProcessCronQueueObserverTest.php
@@ -530,11 +530,9 @@ public function testDispatchGenerate()
{
$jobConfig = [
'test_group' => [
- 'default' => [
- 'test_job1' => [
- 'instance' => 'CronJob',
- 'method' => 'execute',
- ],
+ 'test_job1' => [
+ 'instance' => 'CronJob',
+ 'method' => 'execute',
],
],
];
@@ -542,11 +540,9 @@ public function testDispatchGenerate()
$this->_config->expects($this->at(0))->method('getJobs')->will($this->returnValue($jobConfig));
$jobs = [
'test_group' => [
- 'default' => [
- 'job1' => ['config_path' => 'test/path'],
- 'job2' => ['schedule' => ''],
- 'job3' => ['schedule' => '* * * * *'],
- ],
+ 'job1' => ['config_path' => 'test/path'],
+ 'job2' => ['schedule' => ''],
+ 'job3' => ['schedule' => '* * * * *'],
],
];
$this->_config->expects($this->at(1))->method('getJobs')->will($this->returnValue($jobs));
@@ -570,32 +566,40 @@ public function testDispatchGenerate()
$this->returnValue(time() + 10000000)
);
- $this->_scopeConfig->expects($this->at(0))->method('getValue')->will($this->returnValue(0));
+ $this->_scopeConfig->expects($this->any())->method('getValue')->willReturnMap(
+ [
+ [
+ 'system/cron/test_group/schedule_generate_every',
+ \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
+ null,
+ 0
+ ],
+ [
+ 'system/cron/test_group/schedule_ahead_for',
+ \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
+ null,
+ 2
+ ]
+ ]
+ );
- $scheduleMethods = ['getJobCode', 'getScheduledAt', 'trySchedule', 'unsScheduleId', 'save', '__wakeup'];
$schedule = $this->getMockBuilder(
'Magento\Cron\Model\Schedule'
)->setMethods(
- $scheduleMethods
+ ['getJobCode', 'getScheduledAt', 'trySchedule', 'unsScheduleId', 'save', '__wakeup', 'getCollection']
)->disableOriginalConstructor()->getMock();
$schedule->expects($this->any())->method('getJobCode')->will($this->returnValue('job_code1'));
$schedule->expects($this->once())->method('getScheduledAt')->will($this->returnValue('* * * * *'));
$schedule->expects($this->any())->method('unsScheduleId')->will($this->returnSelf());
$schedule->expects($this->any())->method('trySchedule')->will($this->returnSelf());
+ $schedule->expects($this->any())->method('getCollection')->willReturn($this->_collection);
+ $schedule->expects($this->atLeastOnce())->method('save')->willReturnSelf();
$this->_collection->addItem(new \Magento\Framework\DataObject());
$this->_collection->addItem($schedule);
$this->_cache->expects($this->any())->method('save');
- $scheduleMock = $this->getMockBuilder(
- 'Magento\Cron\Model\Schedule'
- )->disableOriginalConstructor()->setMethods(
- ['getCollection', '__wakeup']
- )->getMock();
- $scheduleMock->expects($this->any())->method('getCollection')->will($this->returnValue($this->_collection));
- $this->_scheduleFactory->expects($this->any())->method('create')->will($this->returnValue($scheduleMock));
-
$this->_scheduleFactory->expects($this->any())->method('create')->will($this->returnValue($schedule));
$this->_observer->execute($this->observer);
diff --git a/app/code/Magento/Cron/composer.json b/app/code/Magento/Cron/composer.json
index e6a3d74dd06d3..72ea22c1abf56 100644
--- a/app/code/Magento/Cron/composer.json
+++ b/app/code/Magento/Cron/composer.json
@@ -10,7 +10,7 @@
"magento/module-config": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.4",
+ "version": "100.1.5",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/CurrencySymbol/composer.json b/app/code/Magento/CurrencySymbol/composer.json
index b49a56e4baa8b..29d3ce3a25392 100644
--- a/app/code/Magento/CurrencySymbol/composer.json
+++ b/app/code/Magento/CurrencySymbol/composer.json
@@ -11,7 +11,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.3",
+ "version": "100.1.4",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Customer/Controller/Account/Index.php b/app/code/Magento/Customer/Controller/Account/Index.php
index f734660fc3a77..2ecf79d35b11f 100644
--- a/app/code/Magento/Customer/Controller/Account/Index.php
+++ b/app/code/Magento/Customer/Controller/Account/Index.php
@@ -35,9 +35,6 @@ public function __construct(
*/
public function execute()
{
- /** @var \Magento\Framework\View\Result\Page $resultPage */
- $resultPage = $this->resultPageFactory->create();
- $resultPage->getConfig()->getTitle()->set(__('My Account'));
- return $resultPage;
+ return $this->resultPageFactory->create();
}
}
diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index/Viewfile.php b/app/code/Magento/Customer/Controller/Adminhtml/Index/Viewfile.php
index 0722bb6c2a957..3c1610f7f1a26 100644
--- a/app/code/Magento/Customer/Controller/Adminhtml/Index/Viewfile.php
+++ b/app/code/Magento/Customer/Controller/Adminhtml/Index/Viewfile.php
@@ -132,30 +132,18 @@ public function __construct(
*/
public function execute()
{
- $file = null;
- $plain = false;
- if ($this->getRequest()->getParam('file')) {
- // download file
- $file = $this->urlDecoder->decode(
- $this->getRequest()->getParam('file')
- );
- } elseif ($this->getRequest()->getParam('image')) {
- // show plain image
- $file = $this->urlDecoder->decode(
- $this->getRequest()->getParam('image')
- );
- $plain = true;
- } else {
- throw new NotFoundException(__('Page not found.'));
- }
+ list($file, $plain) = $this->getFileParams();
/** @var \Magento\Framework\Filesystem $filesystem */
- $filesystem = $this->_objectManager->get('Magento\Framework\Filesystem');
+ $filesystem = $this->_objectManager->get(\Magento\Framework\Filesystem::class);
$directory = $filesystem->getDirectoryRead(DirectoryList::MEDIA);
$fileName = CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER . '/' . ltrim($file, '/');
$path = $directory->getAbsolutePath($fileName);
- if (!$directory->isFile($fileName)
- && !$this->_objectManager->get('Magento\MediaStorage\Helper\File\Storage')->processStorageFile($path)
+ if (mb_strpos($path, '..') !== false
+ || (!$directory->isFile($fileName)
+ && !$this->_objectManager->get(
+ \Magento\MediaStorage\Helper\File\Storage::class
+ )->processStorageFile($path))
) {
throw new NotFoundException(__('Page not found.'));
}
@@ -198,4 +186,29 @@ public function execute()
);
}
}
+
+ /**
+ * Get parameters from request.
+ *
+ * @return array
+ * @throws NotFoundException
+ */
+ private function getFileParams()
+ {
+ if ($this->getRequest()->getParam('file')) {
+ // download file
+ $file = $this->urlDecoder->decode(
+ $this->getRequest()->getParam('file')
+ );
+ return [$file, false];
+ } elseif ($this->getRequest()->getParam('image')) {
+ // show plain image
+ $file = $this->urlDecoder->decode(
+ $this->getRequest()->getParam('image')
+ );
+ return [$file, true];
+ } else {
+ throw new NotFoundException(__('Page not found.'));
+ }
+ }
}
diff --git a/app/code/Magento/Customer/Model/AccountManagement.php b/app/code/Magento/Customer/Model/AccountManagement.php
index a13a224ec8695..1b309635e329d 100644
--- a/app/code/Magento/Customer/Model/AccountManagement.php
+++ b/app/code/Magento/Customer/Model/AccountManagement.php
@@ -46,6 +46,9 @@
use Magento\Store\Model\ScopeInterface;
use Magento\Store\Model\StoreManagerInterface;
use Psr\Log\LoggerInterface as PsrLogger;
+use Magento\Framework\Session\SessionManagerInterface;
+use Magento\Framework\Session\SaveHandlerInterface;
+use Magento\Customer\Model\ResourceModel\Visitor\CollectionFactory;
/**
* Handle various customer account actions
@@ -237,6 +240,21 @@ class AccountManagement implements AccountManagementInterface
*/
private $transportBuilder;
+ /**
+ * @var SessionManagerInterface
+ */
+ private $sessionManager;
+
+ /**
+ * @var SaveHandlerInterface
+ */
+ private $saveHandler;
+
+ /**
+ * @var CollectionFactory
+ */
+ private $visitorCollectionFactory;
+
/**
* @var DataObjectProcessor
*/
@@ -317,6 +335,9 @@ class AccountManagement implements AccountManagementInterface
* @param ObjectFactory $objectFactory
* @param ExtensibleDataObjectConverter $extensibleDataObjectConverter
* @param DateTimeFactory $dateTimeFactory
+ * @param SessionManagerInterface|null $sessionManager
+ * @param SaveHandlerInterface|null $saveHandler
+ * @param CollectionFactory|null $visitorCollectionFactory
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
@@ -343,7 +364,10 @@ public function __construct(
CustomerModel $customerModel,
ObjectFactory $objectFactory,
ExtensibleDataObjectConverter $extensibleDataObjectConverter,
- DateTimeFactory $dateTimeFactory = null
+ DateTimeFactory $dateTimeFactory = null,
+ SessionManagerInterface $sessionManager = null,
+ SaveHandlerInterface $saveHandler = null,
+ CollectionFactory $visitorCollectionFactory = null
) {
$this->customerFactory = $customerFactory;
$this->eventManager = $eventManager;
@@ -369,6 +393,12 @@ public function __construct(
$this->objectFactory = $objectFactory;
$this->extensibleDataObjectConverter = $extensibleDataObjectConverter;
$this->dateTimeFactory = $dateTimeFactory ?: ObjectManager::getInstance()->get(DateTimeFactory::class);
+ $this->sessionManager = $sessionManager
+ ?: ObjectManager::getInstance()->get(SessionManagerInterface::class);
+ $this->saveHandler = $saveHandler
+ ?: ObjectManager::getInstance()->get(SaveHandlerInterface::class);
+ $this->visitorCollectionFactory = $visitorCollectionFactory
+ ?: ObjectManager::getInstance()->get(CollectionFactory::class);
}
/**
@@ -523,7 +553,8 @@ public function initiatePasswordReset($email, $template, $websiteId = null)
default:
throw new InputException(
__(
- 'Invalid value of "%value" provided for the %fieldName field. Possible values are %template1 or %template2.',
+ 'Invalid value of "%value" provided for the %fieldName field. ' .
+ 'Possible values are %template1 or %template2.',
[
'value' => $template,
'fieldName' => 'template',
@@ -555,7 +586,10 @@ public function resetPassword($email, $resetToken, $newPassword)
$customerSecure->setRpToken(null);
$customerSecure->setRpTokenCreatedAt(null);
$customerSecure->setPasswordHash($this->createPasswordHash($newPassword));
+ $this->sessionManager->destroy();
+ $this->destroyCustomerSessions($customer->getId());
$this->customerRepository->save($customer);
+
return true;
}
@@ -842,7 +876,9 @@ private function changePasswordForCustomer($customer, $currentPassword, $newPass
$customerSecure->setRpTokenCreatedAt(null);
$this->checkPasswordStrength($newPassword);
$customerSecure->setPasswordHash($this->createPasswordHash($newPassword));
+ $this->destroyCustomerSessions($customer->getId());
$this->customerRepository->save($customer);
+
return true;
}
@@ -1301,7 +1337,7 @@ protected function getFullCustomerObject($customer)
// object passed for events
$mergedCustomerData = $this->customerRegistry->retrieveSecureData($customer->getId());
$customerData =
- $this->dataProcessor->buildOutputDataArray($customer, '\Magento\Customer\Api\Data\CustomerInterface');
+ $this->dataProcessor->buildOutputDataArray($customer, \Magento\Customer\Api\Data\CustomerInterface::class);
$mergedCustomerData->addData($customerData);
$mergedCustomerData->setData('name', $this->customerViewHelper->getCustomerName($customer));
return $mergedCustomerData;
@@ -1334,4 +1370,35 @@ private function getEmailNotification()
return $this->emailNotification;
}
}
+
+ /**
+ * Destroy all active customer sessions by customer id (current session will not be destroyed).
+ * Customer sessions which should be deleted are collecting from the "customer_visitor" table considering
+ * configured session lifetime.
+ *
+ * @param string|int $customerId
+ * @return void
+ */
+ private function destroyCustomerSessions($customerId)
+ {
+ $sessionLifetime = $this->scopeConfig->getValue(
+ \Magento\Framework\Session\Config::XML_PATH_COOKIE_LIFETIME,
+ \Magento\Store\Model\ScopeInterface::SCOPE_STORE
+ );
+ $dateTime = $this->dateTimeFactory->create();
+ $activeSessionsTime = $dateTime->setTimestamp($dateTime->getTimestamp() - $sessionLifetime)
+ ->format(DateTime::DATETIME_PHP_FORMAT);
+ /** @var \Magento\Customer\Model\ResourceModel\Visitor\Collection $visitorCollection */
+ $visitorCollection = $this->visitorCollectionFactory->create();
+ $visitorCollection->addFieldToFilter('customer_id', $customerId);
+ $visitorCollection->addFieldToFilter('last_visit_at', ['from' => $activeSessionsTime]);
+ $visitorCollection->addFieldToFilter('session_id', ['neq' => $this->sessionManager->getSessionId()]);
+ /** @var \Magento\Customer\Model\Visitor $visitor */
+ foreach ($visitorCollection->getItems() as $visitor) {
+ $sessionId = $visitor->getSessionId();
+ $this->sessionManager->start();
+ $this->saveHandler->destroy($sessionId);
+ $this->sessionManager->writeClose();
+ }
+ }
}
diff --git a/app/code/Magento/Customer/Model/Address/AbstractAddress.php b/app/code/Magento/Customer/Model/Address/AbstractAddress.php
index 6c568148c9f1c..352d2a803cd18 100644
--- a/app/code/Magento/Customer/Model/Address/AbstractAddress.php
+++ b/app/code/Magento/Customer/Model/Address/AbstractAddress.php
@@ -263,7 +263,7 @@ public function setData($key, $value = null)
{
if (is_array($key)) {
$key = $this->_implodeArrayField($key);
- } elseif (is_array($value) && !empty($value) && $this->isAddressMultilineAttribute($key)) {
+ } elseif (is_array($value) && $this->isAddressMultilineAttribute($key)) {
$value = $this->_implodeArrayValues($value);
}
return parent::setData($key, $value);
@@ -303,7 +303,11 @@ protected function _implodeArrayField(array $data)
*/
protected function _implodeArrayValues($value)
{
- if (is_array($value) && count($value)) {
+ if (is_array($value)) {
+ if (!count($value)) {
+ return '';
+ }
+
$isScalar = false;
foreach ($value as $val) {
if (is_scalar($val)) {
diff --git a/app/code/Magento/Customer/Model/ResourceModel/AddressRepository.php b/app/code/Magento/Customer/Model/ResourceModel/AddressRepository.php
index 4137ec3740ded..b1c54a1f01260 100644
--- a/app/code/Magento/Customer/Model/ResourceModel/AddressRepository.php
+++ b/app/code/Magento/Customer/Model/ResourceModel/AddressRepository.php
@@ -84,7 +84,7 @@ public function __construct(
$this->addressFactory = $addressFactory;
$this->addressRegistry = $addressRegistry;
$this->customerRegistry = $customerRegistry;
- $this->addressResource = $addressResourceModel;
+ $this->addressResourceModel = $addressResourceModel;
$this->directoryData = $directoryData;
$this->addressSearchResultsFactory = $addressSearchResultsFactory;
$this->addressCollectionFactory = $addressCollectionFactory;
@@ -219,7 +219,7 @@ public function delete(\Magento\Customer\Api\Data\AddressInterface $address)
$address = $this->addressRegistry->retrieve($addressId);
$customerModel = $this->customerRegistry->retrieve($address->getCustomerId());
$customerModel->getAddressesCollection()->clear();
- $this->addressResource->delete($address);
+ $this->addressResourceModel->delete($address);
$this->addressRegistry->remove($addressId);
return true;
}
@@ -237,7 +237,7 @@ public function deleteById($addressId)
$address = $this->addressRegistry->retrieve($addressId);
$customerModel = $this->customerRegistry->retrieve($address->getCustomerId());
$customerModel->getAddressesCollection()->clear();
- $this->addressResource->delete($address);
+ $this->addressResourceModel->delete($address);
$this->addressRegistry->remove($addressId);
return true;
}
@@ -285,24 +285,53 @@ private function _validate(CustomerAddressModel $customerAddressModel)
$exception->addError(__('%fieldName is a required field.', ['fieldName' => 'postcode']));
}
- if (!\Zend_Validate::is($customerAddressModel->getCountryId(), 'NotEmpty')) {
+ $countryId = (string)$customerAddressModel->getCountryId();
+ if (!\Zend_Validate::is($countryId, 'NotEmpty')) {
$exception->addError(__('%fieldName is a required field.', ['fieldName' => 'countryId']));
- }
+ } else {
+ //Checking if such country exists.
+ if (!in_array($countryId, $this->directoryData->getCountryCollection()->getAllIds(), true)) {
+ $exception->addError(
+ __(
+ 'Invalid value of "%value" provided for the %fieldName field.',
+ [
+ 'fieldName' => 'countryId',
+ 'value' => htmlspecialchars($countryId)
+ ]
+ )
+ );
+ } else {
+ //If country is valid then validating selected region ID.
+ $countryModel = $customerAddressModel->getCountryModel();
+ $regionCollection = $countryModel->getRegionCollection();
+ $region = $customerAddressModel->getRegion();
+ $regionId = (string)$customerAddressModel->getRegionId();
+ $allowedRegions = $regionCollection->getAllIds();
+ $isRegionRequired = $this->directoryData->isRegionRequired($countryId);
- if ($this->directoryData->isRegionRequired($customerAddressModel->getCountryId())) {
- $regionCollection = $customerAddressModel->getCountryModel()->getRegionCollection();
- if (!$regionCollection->count() && empty($customerAddressModel->getRegion())) {
- $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'region']));
- } elseif (
- $regionCollection->count()
- && !in_array(
- $customerAddressModel->getRegionId(),
- array_column($regionCollection->getData(), 'region_id')
- )
- ) {
- $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'regionId']));
+ if ($isRegionRequired && empty($allowedRegions) && !\Zend_Validate::is($region, 'NotEmpty')) {
+ //If region is required for country and country doesn't provide regions list
+ //region must be provided.
+ $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'region']));
+ } elseif ($isRegionRequired && $allowedRegions && !\Zend_Validate::is($regionId, 'NotEmpty')) {
+ //If country actually has regions and requires you to
+ //select one then it must be selected.
+ $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'regionId']));
+ } elseif ($regionId && !in_array($regionId, $allowedRegions, true)) {
+ //If a region is selected then checking if it exists.
+ $exception->addError(
+ __(
+ 'Invalid value of "%value" provided for the %fieldName field.',
+ [
+ 'fieldName' => 'regionId',
+ 'value' => htmlspecialchars($regionId)
+ ]
+ )
+ );
+ }
}
}
+
return $exception;
}
}
diff --git a/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php b/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php
index 3a7ec4fbecef6..b3f18ee2b2a9c 100644
--- a/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php
+++ b/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php
@@ -186,6 +186,13 @@ public function save(\Magento\Customer\Api\Data\CustomerInterface $customer, $pa
$customerModel->setRpTokenCreatedAt(null);
}
+ // Set group id to current stored id if no group id passed.
+ if (!($prevCustomerData === null) && $prevCustomerData->getGroupId() && $customer->getGroupId() === null) {
+ $customerModel->setGroupId(
+ $prevCustomerData->getGroupId()
+ );
+ }
+
$this->setDefaultBilling($customerArr, $prevCustomerDataArr, $customerModel);
$this->setDefaultShipping($customerArr, $prevCustomerDataArr, $customerModel);
diff --git a/app/code/Magento/Customer/Model/Visitor.php b/app/code/Magento/Customer/Model/Visitor.php
index ba5d09881b911..5898ae112d445 100644
--- a/app/code/Magento/Customer/Model/Visitor.php
+++ b/app/code/Magento/Customer/Model/Visitor.php
@@ -151,6 +151,9 @@ public function initByRequest($observer)
if ($this->session->getVisitorData()) {
$this->setData($this->session->getVisitorData());
+ if ($this->getSessionId() != $this->session->getSessionId()) {
+ $this->setSessionId($this->session->getSessionId());
+ }
}
$this->setLastVisitAt((new \DateTime())->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT));
diff --git a/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/ViewfileTest.php b/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/ViewfileTest.php
index a985928f590bc..0da57e0031a12 100644
--- a/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/ViewfileTest.php
+++ b/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/ViewfileTest.php
@@ -69,29 +69,29 @@ class ViewfileTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
- $this->requestMock = $this->getMock('Magento\Framework\App\RequestInterface', [], [], '', false);
- $this->responseMock = $this->getMock('Magento\Framework\App\ResponseInterface', [], [], '', false);
+ $this->requestMock = $this->getMock(\Magento\Framework\App\RequestInterface::class, [], [], '', false);
+ $this->responseMock = $this->getMock(\Magento\Framework\App\ResponseInterface::class, [], [], '', false);
$this->directoryMock = $this->getMock(
- 'Magento\Framework\Filesystem\Directory\ReadInterface',
+ \Magento\Framework\Filesystem\Directory\ReadInterface::class,
[],
[],
'',
false
);
- $this->fileSystemMock = $this->getMock('Magento\Framework\Filesystem', [], [], '', false);
- $this->storage = $this->getMock('Magento\MediaStorage\Helper\File\Storage', [], [], '', false);
- $this->objectManagerMock = $this->getMock('Magento\Framework\ObjectManagerInterface', [], [], '', false);
+ $this->fileSystemMock = $this->getMock(\Magento\Framework\Filesystem::class, [], [], '', false);
+ $this->storage = $this->getMock(\Magento\MediaStorage\Helper\File\Storage::class, [], [], '', false);
+ $this->objectManagerMock = $this->getMock(\Magento\Framework\ObjectManagerInterface::class, [], [], '', false);
- $this->contextMock = $this->getMock('Magento\Backend\App\Action\Context', [], [], '', false);
+ $this->contextMock = $this->getMock(\Magento\Backend\App\Action\Context::class, [], [], '', false);
$this->contextMock->expects($this->any())->method('getRequest')->willReturn($this->requestMock);
$this->contextMock->expects($this->any())->method('getResponse')->willReturn($this->responseMock);
$this->contextMock->expects($this->any())->method('getObjectManager')->willReturn($this->objectManagerMock);
- $this->urlDecoderMock = $this->getMock('Magento\Framework\Url\DecoderInterface', [], [], '', false);
- $this->resultRawMock = $this->getMock('Magento\Framework\Controller\Result\Raw', [], [], '', false);
+ $this->urlDecoderMock = $this->getMock(\Magento\Framework\Url\DecoderInterface::class, [], [], '', false);
+ $this->resultRawMock = $this->getMock(\Magento\Framework\Controller\Result\Raw::class, [], [], '', false);
$this->resultRawFactoryMock = $this->getMock(
- 'Magento\Framework\Controller\Result\RawFactory',
+ \Magento\Framework\Controller\Result\RawFactory::class,
['create'],
[],
'',
@@ -106,7 +106,50 @@ protected function setUp()
public function testExecuteNoParamsShouldThrowException()
{
/** @var \Magento\Customer\Controller\Adminhtml\Index\Viewfile $controller */
- $controller = $this->objectManager->getObject('Magento\Customer\Controller\Adminhtml\Index\Viewfile');
+ $controller = $this->objectManager->getObject(\Magento\Customer\Controller\Adminhtml\Index\Viewfile::class);
+ $controller->execute();
+ }
+
+ /**
+ * @expectedException \Magento\Framework\Exception\NotFoundException
+ * @expectedExceptionMessage Page not found.
+ */
+ public function testExecuteInvaliFile()
+ {
+ $file = '../../../app/etc/env.php';
+ $decodedFile = base64_encode($file);
+ $fileName = 'customer/' . $file;
+ $path = 'path';
+
+ $this->requestMock->expects($this->atLeastOnce())->method('getParam')->with('file')->willReturn($decodedFile);
+
+ $this->directoryMock->expects($this->once())->method('getAbsolutePath')->with($fileName)->willReturn($path);
+
+ $this->fileSystemMock->expects($this->once())->method('getDirectoryRead')
+ ->with(\Magento\Framework\App\Filesystem\DirectoryList::MEDIA)
+ ->willReturn($this->directoryMock);
+
+ $this->storage->expects($this->once())->method('processStorageFile')->with($path)->willReturn(false);
+
+ $this->objectManagerMock->expects($this->any())->method('get')
+ ->willReturnMap(
+ [
+ [\Magento\Framework\Filesystem::class, $this->fileSystemMock],
+ [\Magento\MediaStorage\Helper\File\Storage::class, $this->storage],
+ ]
+ );
+
+ $this->urlDecoderMock->expects($this->once())->method('decode')->with($decodedFile)->willReturn($file);
+ $fileFactoryMock = $this->getMock(\Magento\Framework\App\Response\Http\FileFactory::class, [], [], '', false);
+
+ $controller = $this->objectManager->getObject(
+ \Magento\Customer\Controller\Adminhtml\Index\Viewfile::class,
+ [
+ 'context' => $this->contextMock,
+ 'urlDecoder' => $this->urlDecoderMock,
+ 'fileFactory' => $fileFactoryMock,
+ ]
+ );
$controller->execute();
}
@@ -130,15 +173,15 @@ public function testExecuteParamFile()
$this->objectManagerMock->expects($this->any())->method('get')
->willReturnMap(
[
- ['Magento\Framework\Filesystem', $this->fileSystemMock],
- ['Magento\MediaStorage\Helper\File\Storage', $this->storage]
+ [\Magento\Framework\Filesystem::class, $this->fileSystemMock],
+ [\Magento\MediaStorage\Helper\File\Storage::class, $this->storage],
]
);
$this->urlDecoderMock->expects($this->once())->method('decode')->with($decodedFile)->willReturn($file);
- $fileResponse = $this->getMock('Magento\Framework\App\ResponseInterface', [], [], '', false);
- $fileFactoryMock = $this->getMock('Magento\Framework\App\Response\Http\FileFactory', [], [], '', false);
+ $fileResponse = $this->getMock(\Magento\Framework\App\ResponseInterface::class, [], [], '', false);
+ $fileFactoryMock = $this->getMock(\Magento\Framework\App\Response\Http\FileFactory::class, [], [], '', false);
$fileFactoryMock->expects($this->once())->method('create')->with(
$path,
['type' => 'filename', 'value' => $fileName],
@@ -147,11 +190,11 @@ public function testExecuteParamFile()
/** @var \Magento\Customer\Controller\Adminhtml\Index\Viewfile $controller */
$controller = $this->objectManager->getObject(
- 'Magento\Customer\Controller\Adminhtml\Index\Viewfile',
+ \Magento\Customer\Controller\Adminhtml\Index\Viewfile::class,
[
'context' => $this->contextMock,
'urlDecoder' => $this->urlDecoderMock,
- 'fileFactory' => $fileFactoryMock
+ 'fileFactory' => $fileFactoryMock,
]
);
$controller->execute();
@@ -180,8 +223,8 @@ public function testExecuteGetParamImage()
$this->objectManagerMock->expects($this->any())->method('get')
->willReturnMap(
[
- ['Magento\Framework\Filesystem', $this->fileSystemMock],
- ['Magento\MediaStorage\Helper\File\Storage', $this->storage]
+ [\Magento\Framework\Filesystem::class, $this->fileSystemMock],
+ [\Magento\MediaStorage\Helper\File\Storage::class, $this->storage],
]
);
@@ -199,7 +242,7 @@ public function testExecuteGetParamImage()
);
$this->resultRawFactoryMock = $this->getMock(
- 'Magento\Framework\Controller\Result\RawFactory',
+ \Magento\Framework\Controller\Result\RawFactory::class,
['create'],
[],
'',
@@ -209,11 +252,11 @@ public function testExecuteGetParamImage()
/** @var \Magento\Customer\Controller\Adminhtml\Index\Viewfile $controller */
$controller = $this->objectManager->getObject(
- 'Magento\Customer\Controller\Adminhtml\Index\Viewfile',
+ \Magento\Customer\Controller\Adminhtml\Index\Viewfile::class,
[
'context' => $this->contextMock,
'urlDecoder' => $this->urlDecoderMock,
- 'resultRawFactory' => $this->resultRawFactoryMock
+ 'resultRawFactory' => $this->resultRawFactoryMock,
]
);
$this->assertSame($this->resultRawMock, $controller->execute());
diff --git a/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php b/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php
index 88553a1ed9af0..e977197d5e9a9 100644
--- a/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php
+++ b/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php
@@ -120,6 +120,21 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase
*/
private $dateTimeFactory;
+ /**
+ * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Session\SessionManagerInterface
+ */
+ private $sessionManager;
+
+ /**
+ * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Customer\Model\ResourceModel\Visitor\CollectionFactory
+ */
+ private $visitorCollectionFactory;
+
+ /**
+ * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Session\SaveHandlerInterface
+ */
+ private $saveHandler;
+
/**
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
@@ -150,7 +165,9 @@ protected function setUp()
$this->customerMetadata = $this->getMock(\Magento\Customer\Api\CustomerMetadataInterface::class);
$this->customerRegistry = $this->getMock(\Magento\Customer\Model\CustomerRegistry::class, [], [], '', false);
$this->logger = $this->getMock(\Psr\Log\LoggerInterface::class);
- $this->encryptor = $this->getMock(\Magento\Framework\Encryption\EncryptorInterface::class);
+ $this->encryptor = $this->getMockBuilder(\Magento\Framework\Encryption\EncryptorInterface::class)
+ ->disableOriginalConstructor()
+ ->getMockForAbstractClass();
$this->share = $this->getMock(\Magento\Customer\Model\Config\Share::class, [], [], '', false);
$this->string = $this->getMock(\Magento\Framework\Stdlib\StringUtils::class);
$this->customerRepository = $this->getMock(\Magento\Customer\Api\CustomerRepositoryInterface::class);
@@ -191,6 +208,20 @@ protected function setUp()
->getMock();
$this->customerSecure = $this->getMockBuilder(\Magento\Customer\Model\Data\CustomerSecure::class)
+ ->setMethods(['setRpToken', 'addData', 'setRpTokenCreatedAt', 'setData', 'getPasswordHash'])
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->visitorCollectionFactory = $this->getMockBuilder(
+ \Magento\Customer\Model\ResourceModel\Visitor\CollectionFactory::class
+ )
+ ->disableOriginalConstructor()
+ ->setMethods(['create'])
+ ->getMock();
+ $this->sessionManager = $this->getMockBuilder(\Magento\Framework\Session\SessionManagerInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->saveHandler = $this->getMockBuilder(\Magento\Framework\Session\SaveHandlerInterface::class)
->disableOriginalConstructor()
->getMock();
@@ -224,6 +255,9 @@ protected function setUp()
'objectFactory' => $this->objectFactory,
'extensibleDataObjectConverter' => $this->extensibleDataObjectConverter,
'dateTimeFactory' => $this->dateTimeFactory,
+ 'sessionManager' => $this->sessionManager,
+ 'saveHandler' => $this->saveHandler,
+ 'visitorCollectionFactory' => $this->visitorCollectionFactory,
]
);
$reflection = new \ReflectionClass(get_class($this->accountManagement));
@@ -753,7 +787,7 @@ public function testCreateAccountWithPasswordInputException(
);
}
- $customer = $this->getMockBuilder('Magento\Customer\Api\Data\CustomerInterface')->getMock();
+ $customer = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class)->getMock();
$this->accountManagement->createAccount($customer, $password);
}
@@ -967,7 +1001,7 @@ public function testSendPasswordReminderEmail()
$this->dataObjectProcessor->expects($this->once())
->method('buildOutputDataArray')
- ->with($customer, '\Magento\Customer\Api\Data\CustomerInterface')
+ ->with($customer, \Magento\Customer\Api\Data\CustomerInterface::class)
->willReturn($customerData);
$this->customerViewHelper->expects($this->any())
@@ -1112,7 +1146,7 @@ protected function prepareInitiatePasswordReset($email, $templateIdentifier, $se
$this->dataObjectProcessor->expects($this->any())
->method('buildOutputDataArray')
- ->with($customer, '\Magento\Customer\Api\Data\CustomerInterface')
+ ->with($customer, \Magento\Customer\Api\Data\CustomerInterface::class)
->willReturn($customerData);
$this->prepareEmailSend($email, $templateIdentifier, $sender, $storeId, $customerName);
@@ -1296,27 +1330,73 @@ private function reInitModel()
{
$this->customerSecure = $this->getMockBuilder(\Magento\Customer\Model\Data\CustomerSecure::class)
->disableOriginalConstructor()
- ->setMethods(['getRpToken', 'getRpTokenCreatedAt'])
+ ->setMethods(
+ [
+ 'getRpToken',
+ 'getRpTokenCreatedAt',
+ 'getPasswordHash',
+ 'setPasswordHash',
+ 'setRpToken',
+ 'setRpTokenCreatedAt',
+ ]
+ )
->getMock();
-
$this->customerSecure
->expects($this->any())
->method('getRpToken')
->willReturn('newStringToken');
-
$pastDateTime = '2016-10-25 00:00:00';
-
$this->customerSecure
->expects($this->any())
->method('getRpTokenCreatedAt')
->willReturn($pastDateTime);
-
$this->customer = $this->getMockBuilder(\Magento\Customer\Model\Customer::class)
->disableOriginalConstructor()
->setMethods(['getResetPasswordLinkExpirationPeriod'])
->getMock();
-
$this->prepareDateTimeFactory();
+ $this->sessionManager = $this->getMockBuilder(\Magento\Framework\Session\SessionManagerInterface::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['destroy', 'start', 'writeClose'])
+ ->getMockForAbstractClass();
+ $this->visitorCollectionFactory = $this->getMockBuilder(
+ \Magento\Customer\Model\ResourceModel\Visitor\CollectionFactory::class
+ )
+ ->disableOriginalConstructor()
+ ->setMethods(['create'])
+ ->getMock();
+ $this->saveHandler = $this->getMockBuilder(\Magento\Framework\Session\SaveHandlerInterface::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['destroy'])
+ ->getMockForAbstractClass();
+
+ $dateTime = '2017-10-25 18:57:08';
+ $timestamp = '1508983028';
+ $dateTimeMock = $this->getMockBuilder(\DateTime::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['format', 'getTimestamp', 'setTimestamp'])
+ ->getMock();
+
+ $dateTimeMock->expects($this->any())
+ ->method('format')
+ ->with(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT)
+ ->willReturn($dateTime);
+
+ $dateTimeMock
+ ->expects($this->any())
+ ->method('getTimestamp')
+ ->willReturn($timestamp);
+
+ $dateTimeMock
+ ->expects($this->any())
+ ->method('setTimestamp')
+ ->willReturnSelf();
+
+ $dateTimeFactory = $this->getMockBuilder(DateTimeFactory::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['create'])
+ ->getMock();
+ $dateTimeFactory->expects($this->any())->method('create')->willReturn($dateTimeMock);
$this->objectManagerHelper = new ObjectManagerHelper($this);
$this->accountManagement = $this->objectManagerHelper->getObject(
@@ -1326,7 +1406,16 @@ private function reInitModel()
'customerRegistry' => $this->customerRegistry,
'customerRepository' => $this->customerRepository,
'customerModel' => $this->customer,
- 'dateTimeFactory' => $this->dateTimeFactory,
+ 'dateTimeFactory' => $dateTimeFactory,
+ 'stringHelper' => $this->string,
+ 'scopeConfig' => $this->scopeConfig,
+ 'sessionManager' => $this->sessionManager,
+ 'visitorCollectionFactory' => $this->visitorCollectionFactory,
+ 'saveHandler' => $this->saveHandler,
+ 'encryptor' => $this->encryptor,
+ 'dataProcessor' => $this->dataObjectProcessor,
+ 'storeManager' => $this->storeManager,
+ 'transportBuilder' => $this->transportBuilder,
]
);
$reflection = new \ReflectionClass(get_class($this->accountManagement));
@@ -1346,6 +1435,7 @@ public function testChangePassword()
$newPassword = 'abcdefg';
$passwordHash = '1a2b3f4c';
+ $this->reInitModel();
$this->prepareDateTimeFactory();
$customer = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class)
@@ -1363,25 +1453,20 @@ public function testChangePassword()
$this->authenticationMock->expects($this->once())
->method('authenticate');
- $customerSecure = $this->getMockBuilder(\Magento\Customer\Model\Data\CustomerSecure::class)
- ->setMethods(['setRpToken', 'setRpTokenCreatedAt', 'getPasswordHash'])
- ->disableOriginalConstructor()
- ->getMock();
- $customerSecure->expects($this->once())
+ $this->customerSecure->expects($this->once())
->method('setRpToken')
->with(null);
- $customerSecure->expects($this->once())
+ $this->customerSecure->expects($this->once())
->method('setRpTokenCreatedAt')
- ->with(null)
->willReturnSelf();
- $customerSecure->expects($this->any())
+ $this->customerSecure->expects($this->any())
->method('getPasswordHash')
->willReturn($passwordHash);
$this->customerRegistry->expects($this->any())
->method('retrieveSecureData')
->with($customerId)
- ->willReturn($customerSecure);
+ ->willReturn($this->customerSecure);
$this->scopeConfig->expects($this->any())
->method('getValue')
@@ -1411,9 +1496,85 @@ public function testChangePassword()
->method('save')
->with($customer);
+ $this->sessionManager->expects($this->atLeastOnce())->method('start');
+ $this->sessionManager->expects($this->atLeastOnce())->method('writeClose');
+ $this->sessionManager->expects($this->atLeastOnce())->method('getSessionId');
+
+ $visitor = $this->getMockBuilder(\Magento\Customer\Model\Visitor::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['getSessionId'])
+ ->getMock();
+ $visitor->expects($this->at(0))->method('getSessionId')->willReturn('session_id_1');
+ $visitor->expects($this->at(1))->method('getSessionId')->willReturn('session_id_2');
+ $visitorCollection = $this->getMockBuilder(
+ \Magento\Customer\Model\ResourceModel\Visitor\CollectionFactory::class
+ )
+ ->disableOriginalConstructor()->setMethods(['addFieldToFilter', 'getItems'])->getMock();
+ $visitorCollection->expects($this->atLeastOnce())->method('addFieldToFilter')->willReturnSelf();
+ $visitorCollection->expects($this->atLeastOnce())->method('getItems')->willReturn([$visitor, $visitor]);
+ $this->visitorCollectionFactory->expects($this->atLeastOnce())->method('create')
+ ->willReturn($visitorCollection);
+ $this->saveHandler->expects($this->at(0))->method('destroy')->with('session_id_1');
+ $this->saveHandler->expects($this->at(1))->method('destroy')->with('session_id_2');
+
$this->assertTrue($this->accountManagement->changePassword($email, $currentPassword, $newPassword));
}
+ public function testResetPassword()
+ {
+ $customerEmail = 'customer@example.com';
+ $customerId = '1';
+ $resetToken = 'newStringToken';
+ $newPassword = 'new_password';
+
+ $this->reInitModel();
+ $customer = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class)->getMock();
+ $customer->expects($this->any())->method('getId')->willReturn($customerId);
+ $this->customerRepository->expects($this->atLeastOnce())->method('get')->with($customerEmail)
+ ->willReturn($customer);
+ $this->customer->expects($this->atLeastOnce())->method('getResetPasswordLinkExpirationPeriod')
+ ->willReturn(100000);
+ $this->string->expects($this->any())->method('strlen')->willReturnCallback(
+ function ($string) {
+ return strlen($string);
+ }
+ );
+ $this->customerRegistry->expects($this->atLeastOnce())->method('retrieveSecureData')
+ ->willReturn($this->customerSecure);
+
+ $this->customerSecure->expects($this->once())
+ ->method('setRpToken')
+ ->with(null);
+ $this->customerSecure->expects($this->once())
+ ->method('setRpTokenCreatedAt')
+ ->with(null);
+ $this->customerSecure->expects($this->any())
+ ->method('setPasswordHash')
+ ->willReturn(null);
+
+ $this->sessionManager->expects($this->atLeastOnce())->method('destroy');
+ $this->sessionManager->expects($this->atLeastOnce())->method('start');
+ $this->sessionManager->expects($this->atLeastOnce())->method('writeClose');
+ $this->sessionManager->expects($this->atLeastOnce())->method('getSessionId');
+ $visitor = $this->getMockBuilder(\Magento\Customer\Model\Visitor::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['getSessionId'])
+ ->getMock();
+ $visitor->expects($this->at(0))->method('getSessionId')->willReturn('session_id_1');
+ $visitor->expects($this->at(1))->method('getSessionId')->willReturn('session_id_2');
+ $visitorCollection = $this->getMockBuilder(
+ \Magento\Customer\Model\ResourceModel\Visitor\CollectionFactory::class
+ )
+ ->disableOriginalConstructor()->setMethods(['addFieldToFilter', 'getItems'])->getMock();
+ $visitorCollection->expects($this->atLeastOnce())->method('addFieldToFilter')->willReturnSelf();
+ $visitorCollection->expects($this->atLeastOnce())->method('getItems')->willReturn([$visitor, $visitor]);
+ $this->visitorCollectionFactory->expects($this->atLeastOnce())->method('create')
+ ->willReturn($visitorCollection);
+ $this->saveHandler->expects($this->at(0))->method('destroy')->with('session_id_1');
+ $this->saveHandler->expects($this->at(1))->method('destroy')->with('session_id_2');
+ $this->assertTrue($this->accountManagement->resetPassword($customerEmail, $resetToken, $newPassword));
+ }
+
/**
* @return void
*/
diff --git a/app/code/Magento/Customer/Test/Unit/Model/Customer/Attribute/Source/WebsiteTest.php b/app/code/Magento/Customer/Test/Unit/Model/Customer/Attribute/Source/WebsiteTest.php
index 1f8ce3baaa54c..aef77979acd02 100644
--- a/app/code/Magento/Customer/Test/Unit/Model/Customer/Attribute/Source/WebsiteTest.php
+++ b/app/code/Magento/Customer/Test/Unit/Model/Customer/Attribute/Source/WebsiteTest.php
@@ -7,6 +7,8 @@
use Magento\Customer\Model\Customer\Attribute\Source\Website;
use Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\CollectionFactory;
+use Magento\Framework\App\ObjectManager;
+use Magento\Framework\ObjectManagerInterface;
class WebsiteTest extends \PHPUnit_Framework_TestCase
{
@@ -22,20 +24,37 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase
/** @var \Magento\Store\Model\System\Store|\PHPUnit_Framework_MockObject_MockObject */
protected $storeMock;
+ /** @var ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject */
+ private $objectManagerMock;
+
protected function setUp()
{
$this->collectionFactoryMock =
- $this->getMockBuilder('Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\CollectionFactory')
+ $this->getMockBuilder(\Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\CollectionFactory::class)
->disableOriginalConstructor()
->getMock();
$this->optionFactoryMock =
- $this->getMockBuilder('Magento\Eav\Model\ResourceModel\Entity\Attribute\OptionFactory')
+ $this->getMockBuilder(\Magento\Eav\Model\ResourceModel\Entity\Attribute\OptionFactory::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->storeMock = $this->getMockBuilder(\Magento\Store\Model\System\Store::class)
->disableOriginalConstructor()
->getMock();
- $this->storeMock = $this->getMockBuilder('Magento\Store\Model\System\Store')
+
+ $this->objectManagerMock = $this->getMockBuilder(ObjectManagerInterface::class)
+ ->setMethods(['get'])
+ ->getMockForAbstractClass();
+
+ $escaper = $this->getMockBuilder(\Magento\Framework\Escaper::class)
->disableOriginalConstructor()
->getMock();
+ ObjectManager::setInstance($this->objectManagerMock);
+ $this->objectManagerMock->expects($this->any())
+ ->method('get')
+ ->with(\Magento\Framework\Escaper::class)
+ ->willReturn($escaper);
+
$this->model = new Website(
$this->collectionFactoryMock,
$this->optionFactoryMock,
@@ -91,4 +110,12 @@ public function testGetOptionTextWithoutOption()
$this->assertEquals(false, $this->model->getOptionText('value'));
}
+
+ protected function tearDown()
+ {
+ $property = (new \ReflectionClass(ObjectManager::class))->getProperty('_instance');
+ $property->setAccessible(true);
+ $property->setValue(null, null);
+ parent::tearDown();
+ }
}
diff --git a/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/Address/Attribute/Source/CountryWithWebsitesTest.php b/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/Address/Attribute/Source/CountryWithWebsitesTest.php
index 8d66bb406aee3..a682298378294 100644
--- a/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/Address/Attribute/Source/CountryWithWebsitesTest.php
+++ b/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/Address/Attribute/Source/CountryWithWebsitesTest.php
@@ -12,7 +12,13 @@
use Magento\Framework\Data\Collection\AbstractDb;
use Magento\Store\Api\Data\WebsiteInterface;
use Magento\Store\Model\StoreManagerInterface;
+use Magento\Framework\App\ObjectManager;
+use Magento\Framework\ObjectManagerInterface;
+/**
+ * Tests for \Magento\Customer\Model\ResourceModel\Address\Attribute\Source\CountryWithWebsites
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ */
class CountryWithWebsitesTest extends \PHPUnit_Framework_TestCase
{
/**
@@ -40,6 +46,9 @@ class CountryWithWebsitesTest extends \PHPUnit_Framework_TestCase
*/
private $shareConfigMock;
+ /** @var ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject */
+ private $objectManagerMock;
+
public function setUp()
{
$this->countriesFactoryMock =
@@ -62,6 +71,21 @@ public function setUp()
$this->shareConfigMock = $this->getMockBuilder(Share::class)
->disableOriginalConstructor()
->getMock();
+
+ $this->objectManagerMock = $this->getMockBuilder(ObjectManagerInterface::class)
+ ->setMethods(['get'])
+ ->getMockForAbstractClass();
+
+ $escaper = $this->getMockBuilder(\Magento\Framework\Escaper::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ ObjectManager::setInstance($this->objectManagerMock);
+ $this->objectManagerMock->expects($this->any())
+ ->method('get')
+ ->with(\Magento\Framework\Escaper::class)
+ ->willReturn($escaper);
+
$this->countryByWebsite = new CountryWithWebsites(
$eavCollectionFactoryMock,
$optionsFactoryMock,
@@ -117,4 +141,12 @@ public function testGetAllOptions()
['value' => 'AM', 'label' => 'UZ', 'website_ids' => [1, 2]]
], $this->countryByWebsite->getAllOptions());
}
+
+ protected function tearDown()
+ {
+ $property = (new \ReflectionClass(ObjectManager::class))->getProperty('_instance');
+ $property->setAccessible(true);
+ $property->setValue(null, null);
+ parent::tearDown();
+ }
}
diff --git a/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/AddressRepositoryTest.php b/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/AddressRepositoryTest.php
index 5a03b4b615f65..8df72f96f93c7 100644
--- a/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/AddressRepositoryTest.php
+++ b/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/AddressRepositoryTest.php
@@ -5,6 +5,15 @@
*/
namespace Magento\Customer\Test\Unit\Model\ResourceModel;
+use Magento\Customer\Api\Data\AddressInterface as AddressData;
+use Magento\Directory\Model\ResourceModel\Country\Collection as Countries;
+use Magento\Framework\Exception\InputException;
+
+/**
+ * Unit test for Magento\Customer\Model\ResourceModel\AddressRepository
+ *
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ */
class AddressRepositoryTest extends \PHPUnit_Framework_TestCase
{
/**
@@ -64,34 +73,46 @@ class AddressRepositoryTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->addressFactory = $this->getMock('Magento\Customer\Model\AddressFactory', ['create'], [], '', false);
- $this->addressRegistry = $this->getMock('Magento\Customer\Model\AddressRegistry', [], [], '', false);
- $this->customerRegistry = $this->getMock('Magento\Customer\Model\CustomerRegistry', [], [], '', false);
- $this->addressResourceModel = $this->getMock('Magento\Customer\Model\ResourceModel\Address', [], [], '', false);
- $this->directoryData = $this->getMock('Magento\Directory\Helper\Data', [], [], '', false);
+ $this->addressFactory = $this->getMock(
+ \Magento\Customer\Model\AddressFactory::class,
+ ['create'],
+ [],
+ '',
+ false
+ );
+ $this->addressRegistry = $this->getMock(\Magento\Customer\Model\AddressRegistry::class, [], [], '', false);
+ $this->customerRegistry = $this->getMock(\Magento\Customer\Model\CustomerRegistry::class, [], [], '', false);
+ $this->addressResourceModel = $this->getMock(
+ \Magento\Customer\Model\ResourceModel\Address::class,
+ [],
+ [],
+ '',
+ false
+ );
+ $this->directoryData = $this->getMock(\Magento\Directory\Helper\Data::class, [], [], '', false);
$this->addressSearchResultsFactory = $this->getMock(
- 'Magento\Customer\Api\Data\AddressSearchResultsInterfaceFactory',
+ \Magento\Customer\Api\Data\AddressSearchResultsInterfaceFactory::class,
['create'],
[],
'',
false
);
$this->addressCollectionFactory = $this->getMock(
- 'Magento\Customer\Model\ResourceModel\Address\CollectionFactory',
+ \Magento\Customer\Model\ResourceModel\Address\CollectionFactory::class,
['create'],
[],
'',
false
);
$this->extensionAttributesJoinProcessor = $this->getMockForAbstractClass(
- 'Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface',
+ \Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface::class,
[],
'',
false
);
- $this->customer = $this->getMock('Magento\Customer\Model\Customer', [], [], '', false);
+ $this->customer = $this->getMock(\Magento\Customer\Model\Customer::class, [], [], '', false);
$this->address = $this->getMock(
- 'Magento\Customer\Model\Address',
+ \Magento\Customer\Model\Address::class,
[
'getId',
'getCountryId',
@@ -109,6 +130,7 @@ protected function setUp()
'save',
'getDataModel',
'getCustomerId',
+ 'getPostcode',
],
[],
'',
@@ -131,9 +153,9 @@ public function testSave()
{
$customerId = 34;
$addressId = 53;
- $customerAddress = $this->getMockForAbstractClass('Magento\Customer\Api\Data\AddressInterface', [], '', false);
+ $customerAddress = $this->getMockForAbstractClass(AddressData::class, [], '', false);
$addressCollection =
- $this->getMock('Magento\Customer\Model\ResourceModel\Address\Collection', [], [], '', false);
+ $this->getMock(\Magento\Customer\Model\ResourceModel\Address\Collection::class, [], [], '', false);
$customerAddress->expects($this->atLeastOnce())
->method('getCustomerId')
->willReturn($customerId);
@@ -189,7 +211,7 @@ public function testSaveWithException()
{
$customerId = 34;
$addressId = 53;
- $customerAddress = $this->getMockForAbstractClass('Magento\Customer\Api\Data\AddressInterface', [], '', false);
+ $customerAddress = $this->getMockForAbstractClass(AddressData::class, [], '', false);
$customerAddress->expects($this->atLeastOnce())
->method('getCustomerId')
->willReturn($customerId);
@@ -220,7 +242,7 @@ public function testSaveWithInvalidRegion()
{
$customerId = 34;
$addressId = 53;
- $customerAddress = $this->getMockForAbstractClass('Magento\Customer\Api\Data\AddressInterface', [], '', false);
+ $customerAddress = $this->getMockForAbstractClass(AddressData::class, [], '', false);
$customerAddress->expects($this->atLeastOnce())
->method('getCustomerId')
->willReturn($customerId);
@@ -238,9 +260,9 @@ public function testSaveWithInvalidRegion()
$this->address->expects($this->once())
->method('updateData')
->with($customerAddress);
- $countryModel = $this->getMock('Magento\Directory\Model\Country', [], [], '', false);
+ $countryModel = $this->getMock(\Magento\Directory\Model\Country::class, [], [], '', false);
$regionCollection = $this->getMock(
- 'Magento\Directory\Model\ResourceModel\Region\Collection',
+ \Magento\Directory\Model\ResourceModel\Region\Collection::class,
[],
[],
'',
@@ -269,7 +291,7 @@ public function testSaveWithInvalidRegion()
$this->address->expects($this->once())
->method('getTelephone')
->willReturn('23423423423');
- $this->address->expects($this->never())
+ $this->address->expects($this->once())
->method('getRegionId')
->willReturn(null);
@@ -282,7 +304,7 @@ public function testSaveWithInvalidRegion()
$countryModel->expects($this->once())
->method('getRegionCollection')
->willReturn($regionCollection);
- $regionCollection->expects($this->once())
+ $regionCollection->expects($this->never())
->method('count')
->willReturn(0);
$this->directoryData->expects($this->once())
@@ -293,6 +315,15 @@ public function testSaveWithInvalidRegion()
->method('getRegion')
->willReturn('');
+ /** @var \PHPUnit_Framework_MockObject_MockObject $countryCollection */
+ $countryCollection = $this->getMockBuilder(Countries::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $countryCollection->expects($this->once())->method('getAllIds')->willReturn(['1', '2']);
+ $this->directoryData->expects($this->once())
+ ->method('getCountryCollection')
+ ->willReturn($countryCollection);
+
$this->repository->save($customerAddress);
}
@@ -304,7 +335,7 @@ public function testSaveWithInvalidRegionId()
{
$customerId = 34;
$addressId = 53;
- $customerAddress = $this->getMockForAbstractClass('Magento\Customer\Api\Data\AddressInterface', [], '', false);
+ $customerAddress = $this->getMockForAbstractClass(AddressData::class, [], '', false);
$customerAddress->expects($this->atLeastOnce())
->method('getCustomerId')
->willReturn($customerId);
@@ -322,9 +353,9 @@ public function testSaveWithInvalidRegionId()
$this->address->expects($this->once())
->method('updateData')
->with($customerAddress);
- $countryModel = $this->getMock('Magento\Directory\Model\Country', [], [], '', false);
+ $countryModel = $this->getMock(\Magento\Directory\Model\Country::class, [], [], '', false);
$regionCollection = $this->getMock(
- 'Magento\Directory\Model\ResourceModel\Region\Collection',
+ \Magento\Directory\Model\ResourceModel\Region\Collection::class,
[],
[],
'',
@@ -355,7 +386,7 @@ public function testSaveWithInvalidRegionId()
->willReturn('23423423423');
$this->address->expects($this->once())
->method('getRegionId')
- ->willReturn(2);
+ ->willReturn('');
$this->directoryData->expects($this->once())
->method('getCountriesWithOptionalZip')
@@ -366,28 +397,34 @@ public function testSaveWithInvalidRegionId()
$countryModel->expects($this->once())
->method('getRegionCollection')
->willReturn($regionCollection);
- $regionCollection->expects($this->atLeastOnce())
- ->method('count')
- ->willReturn(2);
$regionCollection->expects($this->once())
- ->method('getData')
+ ->method('getAllIds')
->willReturn([5, 6, 7, 8, 9]);
$this->directoryData->expects($this->once())
->method('isRegionRequired')
->with(1)
->willReturn(true);
- $this->address->expects($this->never())
+ $this->address->expects($this->once())
->method('getRegion')
->willReturn('');
+ /** @var \PHPUnit_Framework_MockObject_MockObject $countryCollection */
+ $countryCollection = $this->getMockBuilder(Countries::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $countryCollection->expects($this->once())->method('getAllIds')->willReturn(['1', '2']);
+ $this->directoryData->expects($this->once())
+ ->method('getCountryCollection')
+ ->willReturn($countryCollection);
+
$this->repository->save($customerAddress);
}
protected function prepareMocksForInvalidAddressValidation()
{
- $countryModel = $this->getMock('Magento\Directory\Model\Country', [], [], '', false);
+ $countryModel = $this->getMock(\Magento\Directory\Model\Country::class, [], [], '', false);
$regionCollection = $this->getMock(
- 'Magento\Directory\Model\ResourceModel\Region\Collection',
+ \Magento\Directory\Model\ResourceModel\Region\Collection::class,
[],
[],
'',
@@ -417,16 +454,16 @@ protected function prepareMocksForInvalidAddressValidation()
$this->directoryData->expects($this->once())
->method('getCountriesWithOptionalZip')
->willReturn([]);
- $this->address->expects($this->once())
+ $this->address->expects($this->never())
->method('getCountryModel')
->willReturn($countryModel);
- $countryModel->expects($this->once())
+ $countryModel->expects($this->never())
->method('getRegionCollection')
->willReturn($regionCollection);
- $regionCollection->expects($this->once())
+ $regionCollection->expects($this->never())
->method('count')
->willReturn(0);
- $this->directoryData->expects($this->once())
+ $this->directoryData->expects($this->never())
->method('isRegionRequired')
->with(null)
->willReturn(true);
@@ -434,7 +471,7 @@ protected function prepareMocksForInvalidAddressValidation()
public function testGetById()
{
- $customerAddress = $this->getMockForAbstractClass('Magento\Customer\Api\Data\AddressInterface', [], '', false);
+ $customerAddress = $this->getMockForAbstractClass(AddressData::class, [], '', false);
$this->addressRegistry->expects($this->once())
->method('retrieve')
->with(12)
@@ -448,99 +485,63 @@ public function testGetById()
public function testGetList()
{
- $filterGroup = $this->getMock('Magento\Framework\Api\Search\FilterGroup', [], [], '', false);
- $filter = $this->getMock('Magento\Framework\Api\Filter', [], [], '', false);
- $collection = $this->getMock('Magento\Customer\Model\ResourceModel\Address\Collection', [], [], '', false);
+ $filterGroup = $this->getMock(\Magento\Framework\Api\Search\FilterGroup::class, [], [], '', false);
+ $filter = $this->getMock(\Magento\Framework\Api\Filter::class, [], [], '', false);
+ $collection = $this->getMock(
+ \Magento\Customer\Model\ResourceModel\Address\Collection::class,
+ [],
+ [],
+ '',
+ false
+ );
$searchResults = $this->getMockForAbstractClass(
- 'Magento\Customer\Api\Data\AddressSearchResultsInterface',
+ \Magento\Customer\Api\Data\AddressSearchResultsInterface::class,
[],
'',
false
);
$searchCriteria = $this->getMockForAbstractClass(
- 'Magento\Framework\Api\SearchCriteriaInterface',
+ \Magento\Framework\Api\SearchCriteriaInterface::class,
[],
'',
false
);
- $this->addressSearchResultsFactory->expects($this->once())
- ->method('create')
- ->willReturn($searchResults);
- $this->addressCollectionFactory->expects($this->once())
- ->method('create')
- ->willReturn($collection);
+ $this->addressSearchResultsFactory->expects($this->once())->method('create')->willReturn($searchResults);
+ $this->addressCollectionFactory->expects($this->once())->method('create')->willReturn($collection);
$this->extensionAttributesJoinProcessor->expects($this->once())
->method('process')
- ->with($collection, 'Magento\Customer\Api\Data\AddressInterface');
- $searchCriteria->expects($this->once())
- ->method('getFilterGroups')
- ->willReturn([$filterGroup]);
- $filterGroup->expects($this->once())
- ->method('getFilters')
- ->willReturn([$filter]);
- $filter->expects($this->once())
- ->method('getConditionType')
- ->willReturn(false);
- $filter->expects($this->once())
- ->method('getField')
- ->willReturn('Field');
- $filter->expects($this->atLeastOnce())
- ->method('getValue')
- ->willReturn('Value');
+ ->with($collection, AddressData::class);
+ $searchCriteria->expects($this->once())->method('getFilterGroups')->willReturn([$filterGroup]);
+ $filterGroup->expects($this->once())->method('getFilters')->willReturn([$filter]);
+ $filter->expects($this->once())->method('getConditionType')->willReturn(false);
+ $filter->expects($this->once())->method('getField')->willReturn('Field');
+ $filter->expects($this->atLeastOnce())->method('getValue')->willReturn('Value');
$collection->expects($this->once())
->method('addFieldToFilter')
->with([['attribute' => 'Field', 'eq' => 'Value']], [['eq' => 'Value']]);
- $collection->expects($this->once())
- ->method('getSize')
- ->willReturn(23);
- $searchResults->expects($this->once())
- ->method('setTotalCount')
- ->with(23);
- $sortOrder = $this->getMock('Magento\Framework\Api\SortOrder', [], [], '', false);
- $searchCriteria->expects($this->once())
- ->method('getSortOrders')
- ->willReturn([$sortOrder]);
- $sortOrder->expects($this->once())
- ->method('getField')
- ->willReturn('Field');
+ $collection->expects($this->once())->method('getSize')->willReturn(23);
+ $searchResults->expects($this->once())->method('setTotalCount')->with(23);
+ $sortOrder = $this->getMock(\Magento\Framework\Api\SortOrder::class, [], [], '', false);
+ $searchCriteria->expects($this->once())->method('getSortOrders')->willReturn([$sortOrder]);
+ $sortOrder->expects($this->once())->method('getField')->willReturn('Field');
$sortOrder->expects($this->once())
->method('getDirection')
->willReturn(\Magento\Framework\Api\SortOrder::SORT_ASC);
- $collection->expects($this->once())
- ->method('addOrder')
- ->with('Field', 'ASC');
- $searchCriteria->expects($this->once())
- ->method('getCurrentPage')
- ->willReturn(1);
- $collection->expects($this->once())
- ->method('setCurPage')
- ->with(1);
- $searchCriteria->expects($this->once())
- ->method('getPageSize')
- ->willReturn(10);
- $collection->expects($this->once())
- ->method('setPageSize')
- ->with(10);
- $collection->expects($this->once())
- ->method('getItems')
- ->willReturn([$this->address]);
- $this->address->expects($this->once())
- ->method('getId')
- ->willReturn(12);
- $customerAddress = $this->getMockForAbstractClass('Magento\Customer\Api\Data\AddressInterface', [], '', false);
+ $collection->expects($this->once())->method('addOrder')->with('Field', 'ASC');
+ $searchCriteria->expects($this->once())->method('getCurrentPage')->willReturn(1);
+ $collection->expects($this->once())->method('setCurPage')->with(1);
+ $searchCriteria->expects($this->once())->method('getPageSize')->willReturn(10);
+ $collection->expects($this->once())->method('setPageSize')->with(10);
+ $collection->expects($this->once())->method('getItems')->willReturn([$this->address]);
+ $this->address->expects($this->once())->method('getId')->willReturn(12);
+ $customerAddress = $this->getMockForAbstractClass(AddressData::class, [], '', false);
$this->addressRegistry->expects($this->once())
->method('retrieve')
->with(12)
->willReturn($this->address);
- $this->address->expects($this->once())
- ->method('getDataModel')
- ->willReturn($customerAddress);
- $searchResults->expects($this->once())
- ->method('setItems')
- ->with([$customerAddress]);
- $searchResults->expects($this->once())
- ->method('setSearchCriteria')
- ->with($searchCriteria);
+ $this->address->expects($this->once())->method('getDataModel')->willReturn($customerAddress);
+ $searchResults->expects($this->once())->method('setItems')->with([$customerAddress]);
+ $searchResults->expects($this->once())->method('setSearchCriteria')->with($searchCriteria);
$this->assertSame($searchResults, $this->repository->getList($searchCriteria));
}
@@ -551,19 +552,20 @@ public function testDelete()
$customerId = 43;
$addressCollection = $this->getMock(
- 'Magento\Customer\Model\ResourceModel\Address\Collection',
+ \Magento\Customer\Model\ResourceModel\Address\Collection::class,
[],
[],
'',
false
);
- $customerAddress = $this->getMockForAbstractClass('Magento\Customer\Api\Data\AddressInterface', [], '', false);
- $customerAddress->expects($this->once())
- ->method('getId')
- ->willReturn($addressId);
- $this->address->expects($this->once())
- ->method('getCustomerId')
- ->willReturn($customerId);
+ $customerAddress = $this->getMockForAbstractClass(
+ \Magento\Customer\Api\Data\AddressInterface::class,
+ [],
+ '',
+ false
+ );
+ $customerAddress->expects($this->once())->method('getId')->willReturn($addressId);
+ $this->address->expects($this->once())->method('getCustomerId')->willReturn($customerId);
$this->addressRegistry->expects($this->once())
->method('retrieve')
@@ -574,17 +576,10 @@ public function testDelete()
->with($customerId)
->willReturn($this->customer);
- $this->customer->expects($this->once())
- ->method('getAddressesCollection')
- ->willReturn($addressCollection);
- $addressCollection->expects($this->once())
- ->method('clear');
- $this->addressResourceModel->expects($this->once())
- ->method('delete')
- ->with($this->address);
- $this->addressRegistry->expects($this->once())
- ->method('remove')
- ->with($addressId);
+ $this->customer->expects($this->once())->method('getAddressesCollection')->willReturn($addressCollection);
+ $addressCollection->expects($this->once())->method('clear');
+ $this->addressResourceModel->expects($this->once())->method('delete')->with($this->address);
+ $this->addressRegistry->expects($this->once())->method('remove')->with($addressId);
$this->assertTrue($this->repository->delete($customerAddress));
}
@@ -598,7 +593,7 @@ public function testDeleteById()
->method('getCustomerId')
->willReturn($customerId);
$addressCollection = $this->getMock(
- 'Magento\Customer\Model\ResourceModel\Address\Collection',
+ \Magento\Customer\Model\ResourceModel\Address\Collection::class,
[],
[],
'',
@@ -626,4 +621,108 @@ public function testDeleteById()
$this->assertTrue($this->repository->deleteById($addressId));
}
+
+ public function testInvalidCountryId()
+ {
+ $customerAddress = $this->prepareAddressData('InvalidId', 0);
+
+ try {
+ $this->repository->save($customerAddress);
+ $this->fail('Validation passed with invalid country ID');
+ } catch (InputException $ex) {
+ $this->assertCount(0, $ex->getErrors());
+ $this->assertEquals(
+ __(
+ 'Invalid value of "%value" provided for the %fieldName field.',
+ [
+ 'fieldName' => 'countryId',
+ 'value' => 'InvalidId'
+ ]
+ ),
+ $ex->getMessage()
+ );
+ }
+ }
+
+ public function testInvalidRegionId()
+ {
+ $customerAddress = $this->prepareAddressData(1, 'InvalidId');
+
+ try {
+ $this->repository->save($customerAddress);
+ $this->fail('Validation passed with invalid country ID');
+ } catch (InputException $ex) {
+ $this->assertCount(0, $ex->getErrors());
+ $this->assertEquals(
+ __(
+ 'Invalid value of "%value" provided for the %fieldName field.',
+ [
+ 'fieldName' => 'regionId',
+ 'value' => 'InvalidId'
+ ]
+ ),
+ $ex->getMessage()
+ );
+ }
+ }
+
+ /**
+ * Prepare address data.
+ *
+ * @param int|string $countryId
+ * @param int|string $regionId
+ * @return AddressData|\PHPUnit_Framework_MockObject_MockObject
+ */
+ private function prepareAddressData($countryId, $regionId)
+ {
+ $customerId = 34;
+ $addressId = 22;
+ $customerAddress = $this->getMockForAbstractClass(AddressData::class, [], '', false);
+ $customerAddress->expects($this->atLeastOnce())->method('getCustomerId')->willReturn($customerId);
+ $customerAddress->expects($this->atLeastOnce())->method('getId')->willReturn($addressId);
+ $this->customerRegistry->expects($this->once())
+ ->method('retrieve')
+ ->with($customerId)
+ ->willReturn($this->customer);
+ $this->addressRegistry->expects($this->once())
+ ->method('retrieve')
+ ->with($addressId)
+ ->willReturn($this->address);
+ $this->address->expects($this->once())->method('updateData')->with($customerAddress);
+ $countryModel = $this->getMock(\Magento\Directory\Model\Country::class, [], [], '', false);
+ $regionCollection = $this->getMock(
+ \Magento\Directory\Model\ResourceModel\Region\Collection::class,
+ [],
+ [],
+ '',
+ false
+ );
+
+ $this->address->expects($this->once())->method('getShouldIgnoreValidation')->willReturn(false);
+ $this->address->expects($this->atLeastOnce())->method('getCountryId')->willReturn($countryId);
+ $this->address->expects($this->once())->method('getFirstname')->willReturn('First');
+ $this->address->expects($this->once())->method('getLastname')->willReturn('Last');
+ $this->address->expects($this->once())->method('getStreetLine')->with(1)->willReturn(['Some St.']);
+ $this->address->expects($this->once())->method('getCity')->willReturn('Kyiv');
+ $this->address->expects($this->once())->method('getTelephone')->willReturn('4234236');
+ $this->address->expects($this->any())->method('getRegionId')->willReturn($regionId);
+ $this->address->expects($this->any())->method('getPostcode')->willReturn('123456');
+
+ $this->directoryData->expects($this->once())->method('getCountriesWithOptionalZip')->willReturn([1]);
+ $this->directoryData->expects($this->any())->method('isRegionRequired')->willReturn(true);
+ $this->address->expects($this->any())->method('getCountryModel')->willReturn($countryModel);
+ $countryModel->expects($this->any())->method('getRegionCollection')->willReturn($regionCollection);
+ $regionCollection->expects($this->any())->method('getAllIds')->willReturn(['3', '4']);
+
+ /** @var \PHPUnit_Framework_MockObject_MockObject $countryCollection */
+ $countryCollection = $this->getMockBuilder(Countries::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $countryCollection->expects($this->once())->method('getAllIds')->willReturn(['1', '2']);
+ $this->directoryData->expects($this->once())
+ ->method('getCountryCollection')
+ ->willReturn($countryCollection);
+
+ return $customerAddress;
+ }
}
diff --git a/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/CustomerRepositoryTest.php b/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/CustomerRepositoryTest.php
index 556f8bdbd1f18..dce065b7b4295 100644
--- a/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/CustomerRepositoryTest.php
+++ b/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/CustomerRepositoryTest.php
@@ -160,7 +160,7 @@ protected function setUp()
false
);
$this->customer = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class)
- ->setMethods(['__toArray'])
+ ->setMethods(['__toArray', 'setGroupId'])
->disableOriginalConstructor()
->getMockForAbstractClass();
$this->model = new \Magento\Customer\Model\ResourceModel\CustomerRepository(
@@ -187,6 +187,7 @@ public function testSave()
{
$customerId = 1;
$storeId = 2;
+ $groupId = 1;
$region = $this->getMockForAbstractClass(\Magento\Customer\Api\Data\RegionInterface::class, [], '', false);
$address = $this->getMockForAbstractClass(
@@ -222,6 +223,7 @@ public function testSave()
[
'getId',
'setId',
+ 'setGroupId',
'setStoreId',
'getStoreId',
'getAttributeSetId',
@@ -254,7 +256,8 @@ public function testSave()
'getEmail',
'getWebsiteId',
'getAddresses',
- 'setAddresses'
+ 'setAddresses',
+ 'getGroupId'
]
);
$customerSecureData = $this->getMock(
@@ -289,6 +292,17 @@ public function testSave()
->method('setCustomerId')
->with($customerId)
->willReturnSelf();
+
+ $this->customer->expects($this->exactly(2))
+ ->method('getGroupId')
+ ->willReturn($groupId);
+ $customerAttributesMetaData->expects($this->once())
+ ->method('getGroupId')
+ ->willReturn(null);
+ $customerModel->expects($this->once())
+ ->method('setGroupId')
+ ->with($groupId);
+
$address->expects($this->once())
->method('getRegion')
->willReturn($region);
diff --git a/app/code/Magento/Customer/Test/Unit/Model/VisitorTest.php b/app/code/Magento/Customer/Test/Unit/Model/VisitorTest.php
index 03c3902b0ec7e..babab76dd1eee 100644
--- a/app/code/Magento/Customer/Test/Unit/Model/VisitorTest.php
+++ b/app/code/Magento/Customer/Test/Unit/Model/VisitorTest.php
@@ -41,15 +41,15 @@ class VisitorTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->registry = $this->getMock('Magento\Framework\Registry');
- $this->session = $this->getMockBuilder('Magento\Customer\Model\Session')
+ $this->registry = $this->getMock(\Magento\Framework\Registry::class);
+ $this->session = $this->getMockBuilder(\Magento\Customer\Model\Session::class)
->disableOriginalConstructor()
->setMethods(['getSessionId', 'getVisitorData', 'setVisitorData'])
->getMock();
$this->objectManagerHelper = new ObjectManagerHelper($this);
- $this->resource = $this->getMockBuilder('Magento\Customer\Model\ResourceModel\Visitor')
+ $this->resource = $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Visitor::class)
->setMethods([
'beginTransaction',
'__sleep',
@@ -64,7 +64,7 @@ protected function setUp()
$this->resource->expects($this->any())->method('addCommitCallback')->will($this->returnSelf());
$arguments = $this->objectManagerHelper->getConstructArguments(
- 'Magento\Customer\Model\Visitor',
+ \Magento\Customer\Model\Visitor::class,
[
'registry' => $this->registry,
'session' => $this->session,
@@ -72,19 +72,19 @@ protected function setUp()
]
);
- $this->visitor = $this->objectManagerHelper->getObject('Magento\Customer\Model\Visitor', $arguments);
+ $this->visitor = $this->objectManagerHelper->getObject(\Magento\Customer\Model\Visitor::class, $arguments);
}
public function testInitByRequest()
{
- $this->session->expects($this->once())->method('getSessionId')
- ->will($this->returnValue('asdfhasdfjhkj2198sadf8sdf897'));
+ $oldSessionId = 'asdfhasdfjhkj2198sadf8sdf897';
+ $newSessionId = 'bsdfhasdfjhkj2198sadf8sdf897';
+ $this->session->expects($this->any())->method('getSessionId')
+ ->will($this->returnValue($newSessionId));
+ $this->session->expects($this->atLeastOnce())->method('getVisitorData')
+ ->willReturn(['session_id' => $oldSessionId]);
$this->visitor->initByRequest(null);
- $this->assertEquals('asdfhasdfjhkj2198sadf8sdf897', $this->visitor->getSessionId());
-
- $this->visitor->setData(['visitor_id' => 1]);
- $this->visitor->initByRequest(null);
- $this->assertNull($this->visitor->getSessionId());
+ $this->assertEquals($newSessionId, $this->visitor->getSessionId());
}
public function testSaveByRequest()
@@ -96,7 +96,7 @@ public function testSaveByRequest()
public function testIsModuleIgnored()
{
$this->visitor = $this->objectManagerHelper->getObject(
- 'Magento\Customer\Model\Visitor',
+ \Magento\Customer\Model\Visitor::class,
[
'registry' => $this->registry,
'session' => $this->session,
diff --git a/app/code/Magento/Customer/composer.json b/app/code/Magento/Customer/composer.json
index 6b66fea8e56aa..53c8c633bcdbb 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.1.*"
},
"type": "magento2-module",
- "version": "100.1.10",
+ "version": "100.1.12",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Customer/etc/config.xml b/app/code/Magento/Customer/etc/config.xml
index dbd7e16e19cea..729ab5d11a91b 100644
--- a/app/code/Magento/Customer/etc/config.xml
+++ b/app/code/Magento/Customer/etc/config.xml
@@ -81,17 +81,15 @@ T: {{var telephone}}
{{depend vat_id}} VAT: {{var vat_id}}{{/depend}}]]>
F: {{var fax}}{{/depend}}|
-{{depend vat_id}} VAT: {{var vat_id}}{{/depend}}|]]>
+{{depend telephone}}T: {{var telephone}}|{{/depend}}
+{{depend fax}}F: {{var fax}}|{{/depend}}|
+{{depend vat_id}}VAT: {{var vat_id}}{{/depend}}|]]>
diff --git a/app/code/Magento/Customer/etc/di.xml b/app/code/Magento/Customer/etc/di.xml
index d9b27940ad724..2435686c7c8a3 100644
--- a/app/code/Magento/Customer/etc/di.xml
+++ b/app/code/Magento/Customer/etc/di.xml
@@ -332,4 +332,9 @@
+
+
+ Magento\Framework\Session\SessionManagerInterface\Proxy
+
+
diff --git a/app/code/Magento/Customer/etc/events.xml b/app/code/Magento/Customer/etc/events.xml
index 66c9a3813892c..d841d8faa9c38 100644
--- a/app/code/Magento/Customer/etc/events.xml
+++ b/app/code/Magento/Customer/etc/events.xml
@@ -10,7 +10,7 @@
-
+
diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_account.xml b/app/code/Magento/Customer/view/frontend/layout/customer_account.xml
index 3f0a51b2c579e..dd972321f27e2 100644
--- a/app/code/Magento/Customer/view/frontend/layout/customer_account.xml
+++ b/app/code/Magento/Customer/view/frontend/layout/customer_account.xml
@@ -6,6 +6,9 @@
*/
-->
+
+ My Account
+
diff --git a/app/code/Magento/Customer/view/frontend/templates/account/dashboard/info.phtml b/app/code/Magento/Customer/view/frontend/templates/account/dashboard/info.phtml
index 465e0fc0ee132..aa4bc3a5e939d 100644
--- a/app/code/Magento/Customer/view/frontend/templates/account/dashboard/info.phtml
+++ b/app/code/Magento/Customer/view/frontend/templates/account/dashboard/info.phtml
@@ -20,6 +20,7 @@
escapeHtml($block->getName()) ?>
escapeHtml($block->getCustomer()->getEmail()) ?>
+ getChildHtml('customer.account.dashboard.info.extra'); ?>
escapeHtml(__('Edit')) ?>
diff --git a/app/code/Magento/Customer/view/frontend/web/js/action/login.js b/app/code/Magento/Customer/view/frontend/web/js/action/login.js
index 3cf6d462d5e33..7d271f601e623 100644
--- a/app/code/Magento/Customer/view/frontend/web/js/action/login.js
+++ b/app/code/Magento/Customer/view/frontend/web/js/action/login.js
@@ -8,9 +8,10 @@ define(
'jquery',
'mage/storage',
'Magento_Ui/js/model/messageList',
- 'Magento_Customer/js/customer-data'
+ 'Magento_Customer/js/customer-data',
+ 'mage/translate'
],
- function($, storage, globalMessageList, customerData) {
+ function($, storage, globalMessageList, customerData, $t) {
'use strict';
var callbacks = [],
action = function(loginData, redirectUrl, isGlobal, messageContainer) {
@@ -39,7 +40,9 @@ define(
}
}
}).fail(function () {
- messageContainer.addErrorMessage({'message': 'Could not authenticate. Please try again later'});
+ messageContainer.addErrorMessage({
+ 'message': $t('Could not authenticate. Please try again later')
+ });
callbacks.forEach(function(callback) {
callback(loginData);
});
diff --git a/app/code/Magento/CustomerImportExport/composer.json b/app/code/Magento/CustomerImportExport/composer.json
index b19596bb92aee..d6da01b001618 100644
--- a/app/code/Magento/CustomerImportExport/composer.json
+++ b/app/code/Magento/CustomerImportExport/composer.json
@@ -12,7 +12,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.5",
+ "version": "100.1.6",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Deploy/composer.json b/app/code/Magento/Deploy/composer.json
index 1455f39aaa94a..0e1fe6851b695 100644
--- a/app/code/Magento/Deploy/composer.json
+++ b/app/code/Magento/Deploy/composer.json
@@ -9,7 +9,7 @@
"magento/module-user": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.6",
+ "version": "100.1.7",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Developer/composer.json b/app/code/Magento/Developer/composer.json
index 3f074b0f08667..2db8b7b844917 100644
--- a/app/code/Magento/Developer/composer.json
+++ b/app/code/Magento/Developer/composer.json
@@ -7,7 +7,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.3",
+ "version": "100.1.4",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Dhl/composer.json b/app/code/Magento/Dhl/composer.json
index c636c41f0c479..b1d801abd94ad 100644
--- a/app/code/Magento/Dhl/composer.json
+++ b/app/code/Magento/Dhl/composer.json
@@ -19,7 +19,7 @@
"magento/module-checkout": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.3",
+ "version": "100.1.4",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Directory/Model/Country/Postcode/Config/Reader.php b/app/code/Magento/Directory/Model/Country/Postcode/Config/Reader.php
index 6b654ba44127a..c968b5f1951d3 100644
--- a/app/code/Magento/Directory/Model/Country/Postcode/Config/Reader.php
+++ b/app/code/Magento/Directory/Model/Country/Postcode/Config/Reader.php
@@ -12,7 +12,10 @@ class Reader extends \Magento\Framework\Config\Reader\Filesystem
*
* @var array
*/
- protected $_idAttributes = ['/config/zip' => 'countryCode'];
+ protected $_idAttributes = [
+ '/config/zip' => 'countryCode',
+ '/config/zip/codes/code' => 'id',
+ ];
/**
* Construct the FileSystem Reader Class
diff --git a/app/code/Magento/Directory/composer.json b/app/code/Magento/Directory/composer.json
index 814bd48cc2e42..10c2b48d747dd 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.1.5",
+ "version": "100.1.6",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Link.php b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Link.php
index c685125ff2796..2da2195376b73 100644
--- a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Link.php
+++ b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Link.php
@@ -7,6 +7,7 @@
namespace Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit;
use Magento\Downloadable\Helper\Download as DownloadHelper;
+use Magento\Framework\App\Response\Http as HttpResponse;
class Link extends \Magento\Catalog\Controller\Adminhtml\Product\Edit
{
@@ -15,7 +16,7 @@ class Link extends \Magento\Catalog\Controller\Adminhtml\Product\Edit
*/
protected function _createLink()
{
- return $this->_objectManager->create('Magento\Downloadable\Model\Link');
+ return $this->_objectManager->create(\Magento\Downloadable\Model\Link::class);
}
/**
@@ -23,7 +24,7 @@ protected function _createLink()
*/
protected function _getLink()
{
- return $this->_objectManager->get('Magento\Downloadable\Model\Link');
+ return $this->_objectManager->get(\Magento\Downloadable\Model\Link::class);
}
/**
@@ -36,13 +37,17 @@ protected function _getLink()
protected function _processDownload($resource, $resourceType)
{
/* @var $helper \Magento\Downloadable\Helper\Download */
- $helper = $this->_objectManager->get('Magento\Downloadable\Helper\Download');
+ $helper = $this->_objectManager->get(\Magento\Downloadable\Helper\Download::class);
$helper->setResource($resource, $resourceType);
$fileName = $helper->getFilename();
- $contentType = $helper->getContentType();
+ //For security reasons we're making browsers to download the file
+ //instead of opening it.
+ $contentType = 'application/octet-stream';
- $this->getResponse()->setHttpResponseCode(
+ /** @var HttpResponse $response */
+ $response = $this->getResponse();
+ $response->setHttpResponseCode(
200
)->setHeader(
'Pragma',
@@ -57,18 +62,16 @@ protected function _processDownload($resource, $resourceType)
$contentType,
true
);
-
if ($fileSize = $helper->getFileSize()) {
- $this->getResponse()->setHeader('Content-Length', $fileSize);
- }
-
- if ($contentDisposition = $helper->getContentDisposition()) {
- $this->getResponse()
- ->setHeader('Content-Disposition', $contentDisposition . '; filename=' . $fileName);
+ $response->setHeader('Content-Length', $fileSize);
}
-
- $this->getResponse()->clearBody();
- $this->getResponse()->sendHeaders();
+ $response->setHeader(
+ 'Content-Disposition',
+ 'attachment; filename=' . $fileName
+ );
+ //Rendering
+ $response->clearBody();
+ $response->sendHeaders();
$helper->output();
}
@@ -92,7 +95,7 @@ public function execute()
$resourceType = DownloadHelper::LINK_TYPE_URL;
} elseif ($link->getLinkType() == DownloadHelper::LINK_TYPE_FILE) {
$resource = $this->_objectManager->get(
- 'Magento\Downloadable\Helper\File'
+ \Magento\Downloadable\Helper\File::class
)->getFilePath(
$this->_getLink()->getBasePath(),
$link->getLinkFile()
@@ -105,7 +108,7 @@ public function execute()
$resourceType = DownloadHelper::LINK_TYPE_URL;
} elseif ($link->getSampleType() == DownloadHelper::LINK_TYPE_FILE) {
$resource = $this->_objectManager->get(
- 'Magento\Downloadable\Helper\File'
+ \Magento\Downloadable\Helper\File::class
)->getFilePath(
$this->_getLink()->getBaseSamplePath(),
$link->getSampleFile()
diff --git a/app/code/Magento/Downloadable/Controller/Download.php b/app/code/Magento/Downloadable/Controller/Download.php
index 10aecb9473039..f0bef425d4b45 100644
--- a/app/code/Magento/Downloadable/Controller/Download.php
+++ b/app/code/Magento/Downloadable/Controller/Download.php
@@ -6,6 +6,7 @@
namespace Magento\Downloadable\Controller;
use Magento\Downloadable\Helper\Download as DownloadHelper;
+use Magento\Framework\App\Response\Http as HttpResponse;
/**
* Download controller
@@ -14,6 +15,13 @@
*/
abstract class Download extends \Magento\Framework\App\Action\Action
{
+ /**
+ * @var array
+ */
+ private $disallowedContentTypes = [
+ 'text/html',
+ ];
+
/**
* Prepare response to output resource contents
*
@@ -24,13 +32,16 @@ abstract class Download extends \Magento\Framework\App\Action\Action
protected function _processDownload($path, $resourceType)
{
/* @var $helper DownloadHelper */
- $helper = $this->_objectManager->get('Magento\Downloadable\Helper\Download');
+ $helper = $this->_objectManager->get(\Magento\Downloadable\Helper\Download::class);
$helper->setResource($path, $resourceType);
$fileName = $helper->getFilename();
+
$contentType = $helper->getContentType();
- $this->getResponse()->setHttpResponseCode(
+ /** @var HttpResponse $response */
+ $response = $this->getResponse();
+ $response->setHttpResponseCode(
200
)->setHeader(
'Pragma',
@@ -47,15 +58,19 @@ protected function _processDownload($path, $resourceType)
);
if ($fileSize = $helper->getFileSize()) {
- $this->getResponse()->setHeader('Content-Length', $fileSize);
+ $response->setHeader('Content-Length', $fileSize);
}
- if ($contentDisposition = $helper->getContentDisposition()) {
- $this->getResponse()->setHeader('Content-Disposition', $contentDisposition . '; filename=' . $fileName);
+ $contentDisposition = $helper->getContentDisposition();
+ if (!$contentDisposition || in_array($contentType, $this->disallowedContentTypes)) {
+ // For security reasons we force browsers to download the file instead of opening it.
+ $contentDisposition = \Zend_Mime::DISPOSITION_ATTACHMENT;
}
- $this->getResponse()->clearBody();
- $this->getResponse()->sendHeaders();
+ $response->setHeader('Content-Disposition', $contentDisposition . '; filename=' . $fileName);
+ //Rendering
+ $response->clearBody();
+ $response->sendHeaders();
$helper->output();
}
@@ -67,6 +82,6 @@ protected function _processDownload($path, $resourceType)
*/
protected function _getLink()
{
- return $this->_objectManager->get('Magento\Downloadable\Model\Link');
+ return $this->_objectManager->get(\Magento\Downloadable\Model\Link::class);
}
}
diff --git a/app/code/Magento/Downloadable/Test/Unit/Controller/Adminhtml/Downloadable/Product/Edit/LinkTest.php b/app/code/Magento/Downloadable/Test/Unit/Controller/Adminhtml/Downloadable/Product/Edit/LinkTest.php
index cb9f17557b755..218d9156a2f72 100644
--- a/app/code/Magento/Downloadable/Test/Unit/Controller/Adminhtml/Downloadable/Product/Edit/LinkTest.php
+++ b/app/code/Magento/Downloadable/Test/Unit/Controller/Adminhtml/Downloadable/Product/Edit/LinkTest.php
@@ -22,7 +22,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase
protected $request;
/**
- * @var \Magento\Framework\App\ResponseInterface
+ * @var \Magento\Framework\App\ResponseInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $response;
@@ -50,10 +50,10 @@ protected function setUp()
{
$this->objectManagerHelper = new ObjectManagerHelper($this);
- $this->request = $this->getMockBuilder('Magento\Framework\App\Request\Http')
+ $this->request = $this->getMockBuilder(\Magento\Framework\App\Request\Http::class)
->disableOriginalConstructor()->getMock();
$this->response = $this->getMock(
- '\Magento\Framework\App\ResponseInterface',
+ \Magento\Framework\App\ResponseInterface::class,
[
'setHttpResponseCode',
'clearBody',
@@ -63,7 +63,7 @@ protected function setUp()
]
);
$this->fileHelper = $this->getMock(
- '\Magento\Downloadable\Helper\File',
+ \Magento\Downloadable\Helper\File::class,
[
'getFilePath'
],
@@ -72,7 +72,7 @@ protected function setUp()
false
);
$this->downloadHelper = $this->getMock(
- 'Magento\Downloadable\Helper\Download',
+ \Magento\Downloadable\Helper\Download::class,
[
'setResource',
'getFilename',
@@ -86,7 +86,7 @@ protected function setUp()
false
);
$this->linkModel = $this->getMock(
- '\Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit\Link',
+ \Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit\Link::class,
[
'load',
'getId',
@@ -104,7 +104,7 @@ protected function setUp()
false
);
$this->objectManager = $this->getMock(
- '\Magento\Framework\ObjectManager\ObjectManager',
+ \Magento\Framework\ObjectManager\ObjectManager::class,
[
'create',
'get'
@@ -115,7 +115,7 @@ protected function setUp()
);
$this->link = $this->objectManagerHelper->getObject(
- 'Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit\Link',
+ \Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit\Link::class,
[
'objectManager' => $this->objectManager,
'request' => $this->request,
@@ -130,6 +130,8 @@ protected function setUp()
*/
public function testExecuteFile($fileType)
{
+ $fileSize = 58493;
+ $fileName = 'link.jpg';
$this->request->expects($this->at(0))->method('getParam')->with('id', 0)
->will($this->returnValue(1));
$this->request->expects($this->at(1))->method('getParam')->with('type', 0)
@@ -138,34 +140,47 @@ public function testExecuteFile($fileType)
->will($this->returnSelf());
$this->response->expects($this->once())->method('clearBody')
->will($this->returnSelf());
- $this->response->expects($this->any())->method('setHeader')
- ->will($this->returnSelf());
+ $this->response
+ ->expects($this->any())
+ ->method('setHeader')
+ ->withConsecutive(
+ ['Pragma', 'public', true],
+ [
+ 'Cache-Control',
+ 'must-revalidate, post-check=0, pre-check=0',
+ true,
+ ],
+ ['Content-type', 'application/octet-stream'],
+ ['Content-Length', $fileSize],
+ ['Content-Disposition', 'attachment; filename=' . $fileName]
+ )
+ ->willReturnSelf();
$this->response->expects($this->once())->method('sendHeaders')
->will($this->returnSelf());
- $this->objectManager->expects($this->at(1))->method('get')->with('Magento\Downloadable\Helper\File')
+ $this->objectManager->expects($this->at(1))->method('get')->with(\Magento\Downloadable\Helper\File::class)
->will($this->returnValue($this->fileHelper));
- $this->objectManager->expects($this->at(2))->method('get')->with('Magento\Downloadable\Model\Link')
+ $this->objectManager->expects($this->at(2))->method('get')->with(\Magento\Downloadable\Model\Link::class)
->will($this->returnValue($this->linkModel));
- $this->objectManager->expects($this->at(3))->method('get')->with('Magento\Downloadable\Helper\Download')
+ $this->objectManager->expects($this->at(3))->method('get')->with(\Magento\Downloadable\Helper\Download::class)
->will($this->returnValue($this->downloadHelper));
$this->fileHelper->expects($this->once())->method('getFilePath')
->will($this->returnValue('filepath/' . $fileType . '.jpg'));
$this->downloadHelper->expects($this->once())->method('setResource')
->will($this->returnSelf());
$this->downloadHelper->expects($this->once())->method('getFilename')
- ->will($this->returnValue('link.jpg'));
- $this->downloadHelper->expects($this->once())->method('getContentType')
+ ->will($this->returnValue($fileName));
+ $this->downloadHelper->expects($this->never())->method('getContentType')
->will($this->returnSelf('file'));
$this->downloadHelper->expects($this->once())->method('getFileSize')
- ->will($this->returnValue(null));
- $this->downloadHelper->expects($this->once())->method('getContentDisposition')
+ ->will($this->returnValue($fileSize));
+ $this->downloadHelper->expects($this->never())->method('getContentDisposition')
->will($this->returnValue(null));
$this->downloadHelper->expects($this->once())->method('output')
->will($this->returnSelf());
$this->linkModel->expects($this->once())->method('load')
->will($this->returnSelf());
$this->linkModel->expects($this->once())->method('getId')
- ->will($this->returnValue('1'));
+ ->will($this->returnValue('1'));
$this->linkModel->expects($this->any())->method('get' . $fileType . 'Type')
->will($this->returnValue('file'));
$this->objectManager->expects($this->once())->method('create')
@@ -192,17 +207,17 @@ public function testExecuteUrl($fileType)
->will($this->returnSelf());
$this->response->expects($this->once())->method('sendHeaders')
->will($this->returnSelf());
- $this->objectManager->expects($this->at(1))->method('get')->with('Magento\Downloadable\Helper\Download')
+ $this->objectManager->expects($this->at(1))->method('get')->with(\Magento\Downloadable\Helper\Download::class)
->will($this->returnValue($this->downloadHelper));
$this->downloadHelper->expects($this->once())->method('setResource')
->will($this->returnSelf());
$this->downloadHelper->expects($this->once())->method('getFilename')
->will($this->returnValue('link.jpg'));
- $this->downloadHelper->expects($this->once())->method('getContentType')
+ $this->downloadHelper->expects($this->never())->method('getContentType')
->will($this->returnSelf('url'));
$this->downloadHelper->expects($this->once())->method('getFileSize')
->will($this->returnValue(null));
- $this->downloadHelper->expects($this->once())->method('getContentDisposition')
+ $this->downloadHelper->expects($this->never())->method('getContentDisposition')
->will($this->returnValue(null));
$this->downloadHelper->expects($this->once())->method('output')
->will($this->returnSelf());
diff --git a/app/code/Magento/Downloadable/Test/Unit/Controller/Adminhtml/Downloadable/Product/Edit/SampleTest.php b/app/code/Magento/Downloadable/Test/Unit/Controller/Adminhtml/Downloadable/Product/Edit/SampleTest.php
index c5214305f9194..8718f94a3b6a5 100644
--- a/app/code/Magento/Downloadable/Test/Unit/Controller/Adminhtml/Downloadable/Product/Edit/SampleTest.php
+++ b/app/code/Magento/Downloadable/Test/Unit/Controller/Adminhtml/Downloadable/Product/Edit/SampleTest.php
@@ -50,10 +50,10 @@ protected function setUp()
{
$this->objectManagerHelper = new ObjectManagerHelper($this);
- $this->request = $this->getMockBuilder('Magento\Framework\App\Request\Http')
+ $this->request = $this->getMockBuilder(\Magento\Framework\App\Request\Http::class)
->disableOriginalConstructor()->getMock();
$this->response = $this->getMock(
- '\Magento\Framework\App\ResponseInterface',
+ \Magento\Framework\App\ResponseInterface::class,
[
'setHttpResponseCode',
'clearBody',
@@ -63,7 +63,7 @@ protected function setUp()
]
);
$this->fileHelper = $this->getMock(
- '\Magento\Downloadable\Helper\File',
+ \Magento\Downloadable\Helper\File::class,
[
'getFilePath'
],
@@ -72,7 +72,7 @@ protected function setUp()
false
);
$this->downloadHelper = $this->getMock(
- 'Magento\Downloadable\Helper\Download',
+ \Magento\Downloadable\Helper\Download::class,
[
'setResource',
'getFilename',
@@ -86,7 +86,7 @@ protected function setUp()
false
);
$this->sampleModel = $this->getMock(
- '\Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit\Sample',
+ \Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit\Sample::class,
[
'load',
'getId',
@@ -101,7 +101,7 @@ protected function setUp()
false
);
$this->objectManager = $this->getMock(
- '\Magento\Framework\ObjectManager\ObjectManager',
+ \Magento\Framework\ObjectManager\ObjectManager::class,
[
'create',
'get'
@@ -111,7 +111,7 @@ protected function setUp()
false
);
$this->sample = $this->objectManagerHelper->getObject(
- 'Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit\Sample',
+ \Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit\Sample::class,
[
'objectManager' => $this->objectManager,
'request' => $this->request,
@@ -135,11 +135,11 @@ public function testExecuteFile()
->will($this->returnSelf());
$this->response->expects($this->once())->method('sendHeaders')
->will($this->returnSelf());
- $this->objectManager->expects($this->at(1))->method('get')->with('Magento\Downloadable\Helper\File')
+ $this->objectManager->expects($this->at(1))->method('get')->with(\Magento\Downloadable\Helper\File::class)
->will($this->returnValue($this->fileHelper));
- $this->objectManager->expects($this->at(2))->method('get')->with('Magento\Downloadable\Model\Sample')
+ $this->objectManager->expects($this->at(2))->method('get')->with(\Magento\Downloadable\Model\Sample::class)
->will($this->returnValue($this->sampleModel));
- $this->objectManager->expects($this->at(3))->method('get')->with('Magento\Downloadable\Helper\Download')
+ $this->objectManager->expects($this->at(3))->method('get')->with(\Magento\Downloadable\Helper\Download::class)
->will($this->returnValue($this->downloadHelper));
$this->fileHelper->expects($this->once())->method('getFilePath')
->will($this->returnValue('filepath/sample.jpg'));
@@ -147,11 +147,11 @@ public function testExecuteFile()
->will($this->returnSelf());
$this->downloadHelper->expects($this->once())->method('getFilename')
->will($this->returnValue('sample.jpg'));
- $this->downloadHelper->expects($this->once())->method('getContentType')
+ $this->downloadHelper->expects($this->never())->method('getContentType')
->will($this->returnSelf('file'));
$this->downloadHelper->expects($this->once())->method('getFileSize')
->will($this->returnValue(null));
- $this->downloadHelper->expects($this->once())->method('getContentDisposition')
+ $this->downloadHelper->expects($this->never())->method('getContentDisposition')
->will($this->returnValue(null));
$this->downloadHelper->expects($this->once())->method('output')
->will($this->returnSelf());
@@ -182,17 +182,17 @@ public function testExecuteUrl()
->will($this->returnSelf());
$this->response->expects($this->once())->method('sendHeaders')
->will($this->returnSelf());
- $this->objectManager->expects($this->at(1))->method('get')->with('Magento\Downloadable\Helper\Download')
+ $this->objectManager->expects($this->at(1))->method('get')->with(\Magento\Downloadable\Helper\Download::class)
->will($this->returnValue($this->downloadHelper));
$this->downloadHelper->expects($this->once())->method('setResource')
->will($this->returnSelf());
$this->downloadHelper->expects($this->once())->method('getFilename')
->will($this->returnValue('sample.jpg'));
- $this->downloadHelper->expects($this->once())->method('getContentType')
+ $this->downloadHelper->expects($this->never())->method('getContentType')
->will($this->returnSelf('url'));
$this->downloadHelper->expects($this->once())->method('getFileSize')
->will($this->returnValue(null));
- $this->downloadHelper->expects($this->once())->method('getContentDisposition')
+ $this->downloadHelper->expects($this->never())->method('getContentDisposition')
->will($this->returnValue(null));
$this->downloadHelper->expects($this->once())->method('output')
->will($this->returnSelf());
diff --git a/app/code/Magento/Downloadable/Test/Unit/Controller/Download/LinkTest.php b/app/code/Magento/Downloadable/Test/Unit/Controller/Download/LinkTest.php
index b7cd7eac5e8ce..b39d94036e23a 100644
--- a/app/code/Magento/Downloadable/Test/Unit/Controller/Download/LinkTest.php
+++ b/app/code/Magento/Downloadable/Test/Unit/Controller/Download/LinkTest.php
@@ -7,6 +7,11 @@
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
+/**
+ * Class LinkTest
+ *
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ */
class LinkTest extends \PHPUnit_Framework_TestCase
{
/** @var \Magento\Downloadable\Controller\Download\Link */
@@ -82,10 +87,10 @@ protected function setUp()
{
$this->objectManagerHelper = new ObjectManagerHelper($this);
- $this->request = $this->getMockBuilder('Magento\Framework\App\Request\Http')
+ $this->request = $this->getMockBuilder(\Magento\Framework\App\Request\Http::class)
->disableOriginalConstructor()->getMock();
$this->response = $this->getMock(
- '\Magento\Framework\App\ResponseInterface',
+ \Magento\Framework\App\ResponseInterface::class,
[
'setHttpResponseCode',
'clearBody',
@@ -95,7 +100,7 @@ protected function setUp()
]
);
$this->session = $this->getMock(
- 'Magento\Customer\Model\Session',
+ \Magento\Customer\Model\Session::class,
[
'getCustomerId',
'authenticate',
@@ -106,7 +111,7 @@ protected function setUp()
false
);
$this->helperData = $this->getMock(
- 'Magento\Downloadable\Helper\Data',
+ \Magento\Downloadable\Helper\Data::class,
[
'getIsShareable'
],
@@ -115,7 +120,7 @@ protected function setUp()
false
);
$this->downloadHelper = $this->getMock(
- 'Magento\Downloadable\Helper\Download',
+ \Magento\Downloadable\Helper\Download::class,
[
'setResource',
'getFilename',
@@ -129,7 +134,7 @@ protected function setUp()
false
);
$this->product = $this->getMock(
- 'Magento\Catalog\Model\Product',
+ \Magento\Catalog\Model\Product::class,
[
'_wakeup',
'load',
@@ -142,7 +147,7 @@ protected function setUp()
false
);
$this->linkPurchasedItem = $this->getMock(
- 'Magento\Downloadable\Model\Link\Purchased\Item',
+ \Magento\Downloadable\Model\Link\Purchased\Item::class,
[
'load',
'getId',
@@ -163,7 +168,7 @@ protected function setUp()
false
);
$this->linkPurchased = $this->getMock(
- 'Magento\Downloadable\Model\Link\Purchased',
+ \Magento\Downloadable\Model\Link\Purchased::class,
[
'load',
'getCustomerId'
@@ -173,28 +178,28 @@ protected function setUp()
false
);
$this->messageManager = $this->getMock(
- 'Magento\Framework\Message\ManagerInterface',
+ \Magento\Framework\Message\ManagerInterface::class,
[],
[],
'',
false
);
$this->redirect = $this->getMock(
- 'Magento\Framework\App\Response\RedirectInterface',
+ \Magento\Framework\App\Response\RedirectInterface::class,
[],
[],
'',
false
);
$this->urlInterface = $this->getMock(
- 'Magento\Framework\UrlInterface',
+ \Magento\Framework\UrlInterface::class,
[],
[],
'',
false
);
$this->objectManager = $this->getMock(
- '\Magento\Framework\ObjectManager\ObjectManager',
+ \Magento\Framework\ObjectManager\ObjectManager::class,
[
'create',
'get'
@@ -204,7 +209,7 @@ protected function setUp()
false
);
$this->link = $this->objectManagerHelper->getObject(
- 'Magento\Downloadable\Controller\Download\Link',
+ \Magento\Downloadable\Controller\Download\Link::class,
[
'objectManager' => $this->objectManager,
'request' => $this->request,
@@ -219,12 +224,12 @@ public function testAbsentLinkId()
{
$this->objectManager->expects($this->once())
->method('get')
- ->with('Magento\Customer\Model\Session')
+ ->with(\Magento\Customer\Model\Session::class)
->willReturn($this->session);
$this->request->expects($this->once())->method('getParam')->with('id', 0)->willReturn('some_id');
$this->objectManager->expects($this->once())
->method('create')
- ->with('Magento\Downloadable\Model\Link\Purchased\Item')
+ ->with(\Magento\Downloadable\Model\Link\Purchased\Item::class)
->willReturn($this->linkPurchasedItem);
$this->linkPurchasedItem->expects($this->once())
->method('load')
@@ -243,12 +248,12 @@ public function testGetLinkForGuestCustomer()
{
$this->objectManager->expects($this->at(0))
->method('get')
- ->with('Magento\Customer\Model\Session')
+ ->with(\Magento\Customer\Model\Session::class)
->willReturn($this->session);
$this->request->expects($this->once())->method('getParam')->with('id', 0)->willReturn('some_id');
$this->objectManager->expects($this->at(1))
->method('create')
- ->with('Magento\Downloadable\Model\Link\Purchased\Item')
+ ->with(\Magento\Downloadable\Model\Link\Purchased\Item::class)
->willReturn($this->linkPurchasedItem);
$this->linkPurchasedItem->expects($this->once())
->method('load')
@@ -257,7 +262,7 @@ public function testGetLinkForGuestCustomer()
$this->linkPurchasedItem->expects($this->once())->method('getId')->willReturn(5);
$this->objectManager->expects($this->at(2))
->method('get')
- ->with('Magento\Downloadable\Helper\Data')
+ ->with(\Magento\Downloadable\Helper\Data::class)
->willReturn($this->helperData);
$this->helperData->expects($this->once())
->method('getIsShareable')
@@ -266,7 +271,7 @@ public function testGetLinkForGuestCustomer()
$this->session->expects($this->once())->method('getCustomerId')->willReturn(null);
$this->objectManager->expects($this->at(3))
->method('create')
- ->with('Magento\Catalog\Model\Product')
+ ->with(\Magento\Catalog\Model\Product::class)
->willReturn($this->product);
$this->linkPurchasedItem->expects($this->once())->method('getProductId')->willReturn('product_id');
$this->product->expects($this->once())->method('load')->with('product_id')->willReturnSelf();
@@ -279,7 +284,7 @@ public function testGetLinkForGuestCustomer()
$this->session->expects($this->once())->method('authenticate')->willReturn(true);
$this->objectManager->expects($this->at(4))
->method('create')
- ->with('Magento\Framework\UrlInterface')
+ ->with(\Magento\Framework\UrlInterface::class)
->willReturn($this->urlInterface);
$this->urlInterface->expects($this->once())
->method('getUrl')
@@ -294,12 +299,12 @@ public function testGetLinkForWrongCustomer()
{
$this->objectManager->expects($this->at(0))
->method('get')
- ->with('Magento\Customer\Model\Session')
+ ->with(\Magento\Customer\Model\Session::class)
->willReturn($this->session);
$this->request->expects($this->once())->method('getParam')->with('id', 0)->willReturn('some_id');
$this->objectManager->expects($this->at(1))
->method('create')
- ->with('Magento\Downloadable\Model\Link\Purchased\Item')
+ ->with(\Magento\Downloadable\Model\Link\Purchased\Item::class)
->willReturn($this->linkPurchasedItem);
$this->linkPurchasedItem->expects($this->once())
->method('load')
@@ -308,7 +313,7 @@ public function testGetLinkForWrongCustomer()
$this->linkPurchasedItem->expects($this->once())->method('getId')->willReturn(5);
$this->objectManager->expects($this->at(2))
->method('get')
- ->with('Magento\Downloadable\Helper\Data')
+ ->with(\Magento\Downloadable\Helper\Data::class)
->willReturn($this->helperData);
$this->helperData->expects($this->once())
->method('getIsShareable')
@@ -317,7 +322,7 @@ public function testGetLinkForWrongCustomer()
$this->session->expects($this->once())->method('getCustomerId')->willReturn('customer_id');
$this->objectManager->expects($this->at(3))
->method('create')
- ->with('Magento\Downloadable\Model\Link\Purchased')
+ ->with(\Magento\Downloadable\Model\Link\Purchased::class)
->willReturn($this->linkPurchased);
$this->linkPurchasedItem->expects($this->once())->method('getPurchasedId')->willReturn('purchased_id');
$this->linkPurchased->expects($this->once())->method('load')->with('purchased_id')->willReturnSelf();
@@ -330,16 +335,22 @@ public function testGetLinkForWrongCustomer()
$this->assertEquals($this->response, $this->link->execute());
}
- public function testExceptionInUpdateLinkStatus()
+ /**
+ * @param string $mimeType
+ * @param string $disposition
+ * @dataProvider downloadTypesDataProvider
+ * @return void
+ */
+ public function testExceptionInUpdateLinkStatus($mimeType, $disposition)
{
$this->objectManager->expects($this->at(0))
->method('get')
- ->with('Magento\Customer\Model\Session')
+ ->with(\Magento\Customer\Model\Session::class)
->willReturn($this->session);
$this->request->expects($this->once())->method('getParam')->with('id', 0)->willReturn('some_id');
$this->objectManager->expects($this->at(1))
->method('create')
- ->with('Magento\Downloadable\Model\Link\Purchased\Item')
+ ->with(\Magento\Downloadable\Model\Link\Purchased\Item::class)
->willReturn($this->linkPurchasedItem);
$this->linkPurchasedItem->expects($this->once())
->method('load')
@@ -348,7 +359,7 @@ public function testExceptionInUpdateLinkStatus()
$this->linkPurchasedItem->expects($this->once())->method('getId')->willReturn(5);
$this->objectManager->expects($this->at(2))
->method('get')
- ->with('Magento\Downloadable\Helper\Data')
+ ->with(\Magento\Downloadable\Helper\Data::class)
->willReturn($this->helperData);
$this->helperData->expects($this->once())
->method('getIsShareable')
@@ -360,7 +371,7 @@ public function testExceptionInUpdateLinkStatus()
$this->linkPurchasedItem->expects($this->once())->method('getLinkType')->willReturn('url');
$this->linkPurchasedItem->expects($this->once())->method('getLinkUrl')->willReturn('link_url');
- $this->processDownload('link_url', 'url');
+ $this->processDownload('link_url', 'url', $mimeType, $disposition);
$this->linkPurchasedItem->expects($this->any())->method('setNumberOfDownloadsUsed')->willReturnSelf();
$this->linkPurchasedItem->expects($this->any())->method('setStatus')->with('expired')->willReturnSelf();
@@ -374,40 +385,43 @@ public function testExceptionInUpdateLinkStatus()
$this->assertEquals($this->response, $this->link->execute());
}
- private function processDownload($resource, $resourceType)
+ /**
+ * @param string $resource
+ * @param string $resourceType
+ * @param string $mimeType
+ * @param atring $disposition
+ * @return void
+ */
+ private function processDownload($resource, $resourceType, $mimeType, $disposition)
{
+ $fileSize = 58493;
+ $fileName = 'link.jpg';
+
$this->objectManager->expects($this->at(3))
->method('get')
- ->with('Magento\Downloadable\Helper\Download')
+ ->with(\Magento\Downloadable\Helper\Download::class)
->willReturn($this->downloadHelper);
$this->downloadHelper->expects($this->once())
->method('setResource')
->with($resource, $resourceType)
->willReturnSelf();
- $this->downloadHelper->expects($this->once())->method('getFilename')->willReturn('file_name');
- $this->downloadHelper->expects($this->once())->method('getContentType')->willReturn('content_type');
+ $this->downloadHelper->expects($this->once())->method('getFilename')->willReturn($fileName);
+ $this->downloadHelper->expects($this->once())->method('getContentType')->willReturn($mimeType);
$this->response->expects($this->once())->method('setHttpResponseCode')->with(200)->willReturnSelf();
- $this->response->expects($this->at(1))->method('setHeader')->with('Pragma', 'public', true)->willReturnSelf();
- $this->response->expects($this->at(2))
- ->method('setHeader')
- ->with('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)
- ->willReturnSelf();
- $this->response->expects($this->at(3))
+ $this->response
+ ->expects($this->any())
->method('setHeader')
- ->with('Content-type', 'content_type', true)
- ->willReturnSelf();
- $this->downloadHelper->expects($this->once())->method('getFileSize')->willReturn('file_size');
- $this->response->expects($this->at(4))
- ->method('setHeader')
- ->with('Content-Length', 'file_size')
- ->willReturnSelf();
- $this->downloadHelper->expects($this->once())
- ->method('getContentDisposition')
- ->willReturn('content_disposition');
- $this->response->expects($this->at(5))
- ->method('setHeader')
- ->with('Content-Disposition', 'content_disposition; filename=file_name')
+ ->withConsecutive(
+ ['Pragma', 'public', true],
+ ['Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true],
+ ['Content-type', $mimeType, true],
+ ['Content-Length', $fileSize],
+ ['Content-Disposition', $disposition . '; filename=' . $fileName]
+ )
->willReturnSelf();
+
+ $this->downloadHelper->expects($this->once())->method('getContentDisposition')->willReturn($disposition);
+ $this->downloadHelper->expects($this->once())->method('getFileSize')->willReturn($fileSize);
$this->response->expects($this->once())->method('clearBody')->willReturnSelf();
$this->response->expects($this->once())->method('sendHeaders')->willReturnSelf();
$this->downloadHelper->expects($this->once())->method('output');
@@ -423,12 +437,12 @@ public function testLinkNotAvailable($messageType, $status, $notice)
{
$this->objectManager->expects($this->at(0))
->method('get')
- ->with('Magento\Customer\Model\Session')
+ ->with(\Magento\Customer\Model\Session::class)
->willReturn($this->session);
$this->request->expects($this->once())->method('getParam')->with('id', 0)->willReturn('some_id');
$this->objectManager->expects($this->at(1))
->method('create')
- ->with('Magento\Downloadable\Model\Link\Purchased\Item')
+ ->with(\Magento\Downloadable\Model\Link\Purchased\Item::class)
->willReturn($this->linkPurchasedItem);
$this->linkPurchasedItem->expects($this->once())
->method('load')
@@ -437,7 +451,7 @@ public function testLinkNotAvailable($messageType, $status, $notice)
$this->linkPurchasedItem->expects($this->once())->method('getId')->willReturn(5);
$this->objectManager->expects($this->at(2))
->method('get')
- ->with('Magento\Downloadable\Helper\Data')
+ ->with(\Magento\Downloadable\Helper\Data::class)
->willReturn($this->helperData);
$this->helperData->expects($this->once())
->method('getIsShareable')
@@ -463,4 +477,15 @@ public function linkNotAvailableDataProvider()
['addError', 'wrong_status', 'Something went wrong while getting the requested content.']
];
}
+
+ /**
+ * @return array
+ */
+ public function downloadTypesDataProvider()
+ {
+ return [
+ ['mimeType' => 'text/html', 'disposition' => \Zend_Mime::DISPOSITION_ATTACHMENT],
+ ['mimeType' => 'image/jpeg', 'disposition' => \Zend_Mime::DISPOSITION_INLINE],
+ ];
+ }
}
diff --git a/app/code/Magento/Downloadable/composer.json b/app/code/Magento/Downloadable/composer.json
index 36758eb0a46ff..3642dc98d5965 100644
--- a/app/code/Magento/Downloadable/composer.json
+++ b/app/code/Magento/Downloadable/composer.json
@@ -25,7 +25,7 @@
"magento/module-downloadable-sample-data": "Sample Data version:100.1.*"
},
"type": "magento2-module",
- "version": "100.1.4",
+ "version": "100.1.6",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/links.phtml b/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/links.phtml
index a3be9e4b3dc43..4b8a3013af519 100644
--- a/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/links.phtml
+++ b/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/links.phtml
@@ -21,7 +21,7 @@
isSingleStoreMode() ? ' data-config-scope="' . __('[STORE VIEW]') . '"' : ''; ?>>
-
getStoreId() && $block->getUsedDefault()) ? 'disabled="disabled"' : '' ?>>
+
getStoreId() && $block->getUsedDefault()) ? 'disabled="disabled"' : '' ?>>
getStoreId()): ?>
getUsedDefault() ? 'checked="checked"' : '' ?> />
@@ -158,9 +158,9 @@ require([
'
'+
'
'+
'
' +
- '
' +
+ '
' +
'"@example.com',
+ 'sender_email' => '""@example.com',
+ ],
+ [
+ 'sender' => '"<script>alert(document.domain)</script>"@example.com',
+ 'sender_email' => '"<script>alert(document.domain)</script>"@example.com',
+ ],
+ ],
+ ];
+ }
+}
diff --git a/app/code/Magento/Newsletter/composer.json b/app/code/Magento/Newsletter/composer.json
index 7d0f9734a50f2..c3b6feb158d96 100644
--- a/app/code/Magento/Newsletter/composer.json
+++ b/app/code/Magento/Newsletter/composer.json
@@ -15,7 +15,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.5",
+ "version": "100.1.7",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/OfflinePayments/composer.json b/app/code/Magento/OfflinePayments/composer.json
index 404e6e9619285..11ee83313d760 100644
--- a/app/code/Magento/OfflinePayments/composer.json
+++ b/app/code/Magento/OfflinePayments/composer.json
@@ -8,7 +8,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.2",
+ "version": "100.1.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/OfflineShipping/Block/Adminhtml/Form/Field/Export.php b/app/code/Magento/OfflineShipping/Block/Adminhtml/Form/Field/Export.php
index cb20cc3139d55..48d6c298aa355 100644
--- a/app/code/Magento/OfflineShipping/Block/Adminhtml/Form/Field/Export.php
+++ b/app/code/Magento/OfflineShipping/Block/Adminhtml/Form/Field/Export.php
@@ -21,7 +21,7 @@ class Export extends \Magento\Framework\Data\Form\Element\AbstractElement
* @param \Magento\Framework\Data\Form\Element\Factory $factoryElement
* @param \Magento\Framework\Data\Form\Element\CollectionFactory $factoryCollection
* @param \Magento\Framework\Escaper $escaper
- * @param \Magento\Backend\Helper\Data $helper
+ * @param \Magento\Backend\Model\UrlInterface $backendUrl
* @param array $data
*/
public function __construct(
diff --git a/app/code/Magento/OfflineShipping/composer.json b/app/code/Magento/OfflineShipping/composer.json
index 419e57aaa44ff..be2187077d3dc 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.1.*"
},
"type": "magento2-module",
- "version": "100.1.4",
+ "version": "100.1.5",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/PageCache/composer.json b/app/code/Magento/PageCache/composer.json
index 7d789cc753f82..fcf7c90a9a6e8 100644
--- a/app/code/Magento/PageCache/composer.json
+++ b/app/code/Magento/PageCache/composer.json
@@ -9,7 +9,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.5",
+ "version": "100.1.6",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Payment/composer.json b/app/code/Magento/Payment/composer.json
index 81e7dc53d56de..8adac0125dffc 100644
--- a/app/code/Magento/Payment/composer.json
+++ b/app/code/Magento/Payment/composer.json
@@ -12,7 +12,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.8",
+ "version": "100.1.9",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Paypal/Model/Api/Nvp.php b/app/code/Magento/Paypal/Model/Api/Nvp.php
index b4417a33ffc46..dcc450a29fd47 100644
--- a/app/code/Magento/Paypal/Model/Api/Nvp.php
+++ b/app/code/Magento/Paypal/Model/Api/Nvp.php
@@ -1027,7 +1027,7 @@ public function callGetPalDetails()
}
/**
- * Set Customer BillingA greement call
+ * Set Customer BillingAgreement call
*
* @return void
* @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetCustomerBillingAgreement
@@ -1418,7 +1418,7 @@ protected function _deformatNVP($nvpstr)
$nvpstr = strpos($nvpstr, "\r\n\r\n") !== false ? substr($nvpstr, strpos($nvpstr, "\r\n\r\n") + 4) : $nvpstr;
while (strlen($nvpstr)) {
- //postion of Key
+ //position of Key
$keypos = strpos($nvpstr, '=');
//position of value
$valuepos = strpos($nvpstr, '&') ? strpos($nvpstr, '&') : strlen($nvpstr);
@@ -1426,7 +1426,7 @@ protected function _deformatNVP($nvpstr)
/*getting the Key and Value values and storing in a Associative Array*/
$keyval = substr($nvpstr, $intial, $keypos);
$valval = substr($nvpstr, $keypos + 1, $valuepos - $keypos - 1);
- //decoding the respose
+ //decoding the response
$nvpArray[urldecode($keyval)] = urldecode($valval);
$nvpstr = substr($nvpstr, $valuepos + 1, strlen($nvpstr));
}
diff --git a/app/code/Magento/Paypal/Model/Express/Checkout.php b/app/code/Magento/Paypal/Model/Express/Checkout.php
index 59360f4b0745b..b3dd1af692045 100644
--- a/app/code/Magento/Paypal/Model/Express/Checkout.php
+++ b/app/code/Magento/Paypal/Model/Express/Checkout.php
@@ -816,7 +816,9 @@ public function place($token, $shippingMethodCode = null)
case \Magento\Sales\Model\Order::STATE_PROCESSING:
case \Magento\Sales\Model\Order::STATE_COMPLETE:
case \Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW:
- $this->orderSender->send($order);
+ if (!$order->getEmailSent()) {
+ $this->orderSender->send($order);
+ }
$this->_checkoutSession->start();
break;
default:
diff --git a/app/code/Magento/Paypal/composer.json b/app/code/Magento/Paypal/composer.json
index b389927471723..a183129b7d867 100644
--- a/app/code/Magento/Paypal/composer.json
+++ b/app/code/Magento/Paypal/composer.json
@@ -25,7 +25,7 @@
"magento/module-checkout-agreements": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.8",
+ "version": "100.1.9",
"license": [
"proprietary"
],
diff --git a/app/code/Magento/Paypal/i18n/en_US.csv b/app/code/Magento/Paypal/i18n/en_US.csv
index 56ec49f4eb0d4..4686c4a9004f3 100644
--- a/app/code/Magento/Paypal/i18n/en_US.csv
+++ b/app/code/Magento/Paypal/i18n/en_US.csv
@@ -348,7 +348,7 @@ expires,expires
here,here
" to learn more."," to learn more."
"Important: ","Important: "
-"To use PayPal Payments Advanced, you must configure your PayPal Payments Advanced account on the PayPal website.","To use PayPal Payments Advanced, you must configure your PayPal Payments Advanced account on the PayPal website."
+"To use PayPal Payments Advanced, you must configure your PayPal Payments Advanced account on the PayPal website.","To use PayPal Payments Advanced, you must configure your PayPal Payments Advanced account on the PayPal website."
"Once you log into your PayPal Advanced account, navigate to the Service Settings - Hosted Checkout Pages - Set Up menu and set the options described below","Once you log into your PayPal Advanced account, navigate to the Service Settings - Hosted Checkout Pages - Set Up menu and set the options described below"
"To use PayPal Payflow Link, you must configure your PayPal Payflow Link account on the PayPal website.","To use PayPal Payflow Link, you must configure your PayPal Payflow Link account on the PayPal website."
"Once you log into your PayPal Payflow Link account, navigate to the Service Settings - Hosted Checkout Pages - Set Up menu and set the options described below","Once you log into your PayPal Payflow Link account, navigate to the Service Settings - Hosted Checkout Pages - Set Up menu and set the options described below"
diff --git a/app/code/Magento/Paypal/view/adminhtml/templates/system/config/payflowlink/advanced.phtml b/app/code/Magento/Paypal/view/adminhtml/templates/system/config/payflowlink/advanced.phtml
index 6442ce7c81921..00f9b5e969634 100644
--- a/app/code/Magento/Paypal/view/adminhtml/templates/system/config/payflowlink/advanced.phtml
+++ b/app/code/Magento/Paypal/view/adminhtml/templates/system/config/payflowlink/advanced.phtml
@@ -12,7 +12,7 @@
escapeHtml(__('Important: ')); ?>
- escapeHtml(__('To use PayPal Payments Advanced, you must configure your PayPal Payments Advanced account on the PayPal website.')); ?>
+ escapeHtml(__('To use PayPal Payments Advanced, you must configure your PayPal Payments Advanced account on the PayPal website.')); ?>
escapeHtml(__('Once you log into your PayPal Advanced account, navigate to the Service Settings - Hosted Checkout Pages - Set Up menu and set the options described below')); ?>
diff --git a/app/code/Magento/Paypal/view/frontend/layout/customer_account.xml b/app/code/Magento/Paypal/view/frontend/layout/customer_account.xml
index 5ca352f0b99b7..f6e23632dd4da 100644
--- a/app/code/Magento/Paypal/view/frontend/layout/customer_account.xml
+++ b/app/code/Magento/Paypal/view/frontend/layout/customer_account.xml
@@ -6,9 +6,6 @@
*/
-->
-
- Billing Agreements
-
diff --git a/app/code/Magento/Persistent/composer.json b/app/code/Magento/Persistent/composer.json
index 1293dce77941f..57a27aa97a61c 100644
--- a/app/code/Magento/Persistent/composer.json
+++ b/app/code/Magento/Persistent/composer.json
@@ -12,7 +12,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.4",
+ "version": "100.1.5",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/ProductAlert/composer.json b/app/code/Magento/ProductAlert/composer.json
index 1e54998731794..979e006419218 100644
--- a/app/code/Magento/ProductAlert/composer.json
+++ b/app/code/Magento/ProductAlert/composer.json
@@ -10,7 +10,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.3",
+ "version": "100.1.4",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/ProductVideo/composer.json b/app/code/Magento/ProductVideo/composer.json
index b99745ddc0dff..933e5497d9013 100644
--- a/app/code/Magento/ProductVideo/composer.json
+++ b/app/code/Magento/ProductVideo/composer.json
@@ -15,7 +15,7 @@
"magento/module-customer": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.8",
+ "version": "100.1.9",
"license": [
"proprietary"
],
diff --git a/app/code/Magento/Quote/Model/Quote.php b/app/code/Magento/Quote/Model/Quote.php
index 9b2ac61ef0989..5e5c356583b16 100644
--- a/app/code/Magento/Quote/Model/Quote.php
+++ b/app/code/Magento/Quote/Model/Quote.php
@@ -2363,13 +2363,17 @@ public function merge(Quote $quote)
* Trigger collect totals after loading, if required
*
* @return $this
+ * @throws \Exception
*/
protected function _afterLoad()
{
// collect totals and save me, if required
if (1 == $this->getData('trigger_recollect')) {
- $this->collectTotals()->save();
+ $this->collectTotals()
+ ->setTriggerRecollect(0)
+ ->save();
}
+
return parent::_afterLoad();
}
diff --git a/app/code/Magento/Quote/composer.json b/app/code/Magento/Quote/composer.json
index 1f4931b5a34f6..6849f34d9aa94 100644
--- a/app/code/Magento/Quote/composer.json
+++ b/app/code/Magento/Quote/composer.json
@@ -20,7 +20,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.7",
+ "version": "100.1.8",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Reports/composer.json b/app/code/Magento/Reports/composer.json
index 47f5a9a03ae8c..968d201d577dc 100644
--- a/app/code/Magento/Reports/composer.json
+++ b/app/code/Magento/Reports/composer.json
@@ -22,7 +22,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.6",
+ "version": "100.1.8",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Reports/view/adminhtml/templates/grid.phtml b/app/code/Magento/Reports/view/adminhtml/templates/grid.phtml
index b635c5ebdcd5e..677f9c138ec18 100644
--- a/app/code/Magento/Reports/view/adminhtml/templates/grid.phtml
+++ b/app/code/Magento/Reports/view/adminhtml/templates/grid.phtml
@@ -31,7 +31,7 @@ $numColumns = sizeof($block->getColumns());
type="text"
id="getSuffixId('period_date_from') ?>"
name="report_from"
- value="getFilter('report_from') ?>">
+ value="escapeHtml($block->getFilter('report_from')) ?>">
@@ -44,7 +44,7 @@ $numColumns = sizeof($block->getColumns());
type="text"
id="getSuffixId('period_date_to') ?>"
name="report_to"
- value="getFilter('report_to') ?>"/>
+ value="escapeHtml($block->getFilter('report_to')) ?>"/>
diff --git a/app/code/Magento/RequireJs/Model/FileManager.php b/app/code/Magento/RequireJs/Model/FileManager.php
index f13e3e050999e..8037fe44ee056 100644
--- a/app/code/Magento/RequireJs/Model/FileManager.php
+++ b/app/code/Magento/RequireJs/Model/FileManager.php
@@ -164,6 +164,9 @@ public function createBundleJsPool()
}
foreach ($libDir->read($bundleDir) as $bundleFile) {
+ if (pathinfo($bundleFile, PATHINFO_EXTENSION) !== 'js') {
+ continue;
+ }
$relPath = $libDir->getRelativePath($bundleFile);
$bundles[] = $this->assetRepo->createArbitrary($relPath, '');
}
diff --git a/app/code/Magento/RequireJs/Test/Unit/Model/FileManagerTest.php b/app/code/Magento/RequireJs/Test/Unit/Model/FileManagerTest.php
index 057f03edb9ba2..1963c860a5935 100644
--- a/app/code/Magento/RequireJs/Test/Unit/Model/FileManagerTest.php
+++ b/app/code/Magento/RequireJs/Test/Unit/Model/FileManagerTest.php
@@ -150,7 +150,7 @@ public function testCreateBundleJsPool()
->expects($this->once())
->method('read')
->with('path/to/bundle/dir/js/bundle')
- ->willReturn(['bundle1.js', 'bundle2.js']);
+ ->willReturn(['bundle1.js', 'bundle2.js', 'some_file.not_js']);
$dirRead
->expects($this->exactly(2))
->method('getRelativePath')
diff --git a/app/code/Magento/RequireJs/composer.json b/app/code/Magento/RequireJs/composer.json
index 4f0d3028a3b60..3c05a8bf63982 100644
--- a/app/code/Magento/RequireJs/composer.json
+++ b/app/code/Magento/RequireJs/composer.json
@@ -6,7 +6,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.3",
+ "version": "100.1.4",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Review/Block/Product/ReviewRenderer.php b/app/code/Magento/Review/Block/Product/ReviewRenderer.php
index f60b33bffb8cb..98e6ab9e09289 100644
--- a/app/code/Magento/Review/Block/Product/ReviewRenderer.php
+++ b/app/code/Magento/Review/Block/Product/ReviewRenderer.php
@@ -18,8 +18,8 @@ class ReviewRenderer extends \Magento\Framework\View\Element\Template implements
* @var array
*/
protected $_availableTemplates = [
- self::FULL_VIEW => 'helper/summary.phtml',
- self::SHORT_VIEW => 'helper/summary_short.phtml',
+ self::FULL_VIEW => 'Magento_Review::helper/summary.phtml',
+ self::SHORT_VIEW => 'Magento_Review::helper/summary_short.phtml',
];
/**
diff --git a/app/code/Magento/Review/Controller/Product.php b/app/code/Magento/Review/Controller/Product.php
index 4b8fa5fea92dd..1d2d0a78d8b0c 100644
--- a/app/code/Magento/Review/Controller/Product.php
+++ b/app/code/Magento/Review/Controller/Product.php
@@ -219,6 +219,11 @@ protected function loadProduct($productId)
try {
$product = $this->productRepository->getById($productId);
+
+ if (!in_array($this->storeManager->getStore()->getWebsiteId(), $product->getWebsiteIds())) {
+ throw new NoSuchEntityException();
+ }
+
if (!$product->isVisibleInCatalog() || !$product->isVisibleInSiteVisibility()) {
throw new NoSuchEntityException();
}
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 e85fdb67c77b6..27902a6b40e65 100644
--- a/app/code/Magento/Review/Test/Unit/Controller/Product/PostTest.php
+++ b/app/code/Magento/Review/Test/Unit/Controller/Product/PostTest.php
@@ -170,7 +170,13 @@ protected function setUp()
$ratingFactory->expects($this->once())->method('create')->willReturn($this->rating);
$this->messageManager = $this->getMock('\Magento\Framework\Message\ManagerInterface');
- $this->store = $this->getMock('\Magento\Store\Model\Store', ['getId'], [], '', false);
+ $this->store = $this->getMock(
+ '\Magento\Store\Model\Store',
+ ['getId', 'getWebsiteId'],
+ [],
+ '',
+ false
+ );
$storeManager = $this->getMockForAbstractClass('\Magento\Store\Model\StoreManagerInterface');
$storeManager->expects($this->any())->method('getStore')->willReturn($this->store);
@@ -242,7 +248,7 @@ public function testExecute()
->willReturn(1);
$product = $this->getMock(
'Magento\Catalog\Model\Product',
- ['__wakeup', 'isVisibleInCatalog', 'isVisibleInSiteVisibility', 'getId'],
+ ['__wakeup', 'isVisibleInCatalog', 'isVisibleInSiteVisibility', 'getId', 'getWebsiteIds'],
[],
'',
false
@@ -253,6 +259,10 @@ public function testExecute()
$product->expects($this->once())
->method('isVisibleInSiteVisibility')
->willReturn(true);
+ $product->expects($this->once())
+ ->method('getWebsiteIds')
+ ->willReturn([1]);
+
$this->productRepository->expects($this->any())->method('getById')
->with(1)
->willReturn($product);
@@ -288,6 +298,8 @@ public function testExecute()
$this->review->expects($this->once())->method('setCustomerId')->with($customerId)->willReturnSelf();
$this->store->expects($this->exactly(2))->method('getId')
->willReturn($storeId);
+ $this->store->expects($this->once())->method('getWebsiteId')
+ ->willReturn(1);
$this->review->expects($this->once())->method('setStoreId')
->with($storeId)
->willReturnSelf();
diff --git a/app/code/Magento/Review/composer.json b/app/code/Magento/Review/composer.json
index dcd2efe345852..4bb76ead4a548 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.1.*"
},
"type": "magento2-module",
- "version": "100.1.5",
+ "version": "100.1.7",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Review/i18n/en_US.csv b/app/code/Magento/Review/i18n/en_US.csv
index b27c7b1a99684..547bfe9f3df2f 100644
--- a/app/code/Magento/Review/i18n/en_US.csv
+++ b/app/code/Magento/Review/i18n/en_US.csv
@@ -131,3 +131,5 @@ Summary,Summary
"Allow Guests to Write Reviews","Allow Guests to Write Reviews"
Active,Active
Inactive,Inactive
+star,star
+stars,stars
diff --git a/app/code/Magento/Review/view/adminhtml/web/js/rating.js b/app/code/Magento/Review/view/adminhtml/web/js/rating.js
index 35f32e4a23ef5..22019179771c5 100644
--- a/app/code/Magento/Review/view/adminhtml/web/js/rating.js
+++ b/app/code/Magento/Review/view/adminhtml/web/js/rating.js
@@ -23,7 +23,7 @@ define([
_bind: function() {
this._labels.on({
click: $.proxy(function(e) {
- $('[id="' + $(e.currentTarget).attr('for') + '"]').prop('checked', true);
+ $(e.currentTarget).prev().prop('checked', true);
this._updateRating();
}, this),
diff --git a/app/code/Magento/Review/view/frontend/templates/form.phtml b/app/code/Magento/Review/view/frontend/templates/form.phtml
index 23d1bfd041404..80f552d292034 100644
--- a/app/code/Magento/Review/view/frontend/templates/form.phtml
+++ b/app/code/Magento/Review/view/frontend/templates/form.phtml
@@ -42,9 +42,9 @@
- 1 ? 'stars' : 'star') ?>
+ 1 ? __('stars') : __('star')) ?>
diff --git a/app/code/Magento/Review/view/frontend/templates/redirect.phtml b/app/code/Magento/Review/view/frontend/templates/redirect.phtml
index fc74cadacb319..2fdb5e90a9c18 100644
--- a/app/code/Magento/Review/view/frontend/templates/redirect.phtml
+++ b/app/code/Magento/Review/view/frontend/templates/redirect.phtml
@@ -8,9 +8,6 @@
?>
getProduct()->getProductUrl()}#info-product_reviews");
exit;
?>
diff --git a/app/code/Magento/Review/view/frontend/templates/view.phtml b/app/code/Magento/Review/view/frontend/templates/view.phtml
index 60551aa9c0319..3bb66580319b1 100644
--- a/app/code/Magento/Review/view/frontend/templates/view.phtml
+++ b/app/code/Magento/Review/view/frontend/templates/view.phtml
@@ -49,7 +49,7 @@
diff --git a/app/code/Magento/Robots/Controller/Index/Index.php b/app/code/Magento/Robots/Controller/Index/Index.php
index b94626e93432d..679066d723dce 100644
--- a/app/code/Magento/Robots/Controller/Index/Index.php
+++ b/app/code/Magento/Robots/Controller/Index/Index.php
@@ -43,6 +43,7 @@ public function execute()
/** @var Page $resultPage */
$resultPage = $this->resultPageFactory->create(true);
$resultPage->addHandle('robots_index_index');
+ $resultPage->setHeader('Content-Type', 'text/plain');
return $resultPage;
}
}
diff --git a/app/code/Magento/Robots/Test/Unit/Controller/Index/IndexTest.php b/app/code/Magento/Robots/Test/Unit/Controller/Index/IndexTest.php
index aaac511e3c521..3ebf1d05325c5 100644
--- a/app/code/Magento/Robots/Test/Unit/Controller/Index/IndexTest.php
+++ b/app/code/Magento/Robots/Test/Unit/Controller/Index/IndexTest.php
@@ -51,6 +51,9 @@ public function testExecute()
$resultPageMock->expects($this->once())
->method('addHandle')
->with('robots_index_index');
+ $resultPageMock->expects($this->once())
+ ->method('setHeader')
+ ->with('Content-Type', 'text/plain');
$this->resultPageFactory->expects($this->any())
->method('create')
diff --git a/app/code/Magento/Robots/composer.json b/app/code/Magento/Robots/composer.json
index 218a59138d998..a23211c6fa5d3 100644
--- a/app/code/Magento/Robots/composer.json
+++ b/app/code/Magento/Robots/composer.json
@@ -10,7 +10,7 @@
"magento/module-theme": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.0",
+ "version": "100.1.1",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Rss/composer.json b/app/code/Magento/Rss/composer.json
index 2202ad5ceabfd..dec7ee02e5196 100644
--- a/app/code/Magento/Rss/composer.json
+++ b/app/code/Magento/Rss/composer.json
@@ -9,7 +9,7 @@
"magento/module-customer": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.3",
+ "version": "100.1.4",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Rule/composer.json b/app/code/Magento/Rule/composer.json
index 5744235ab0bd8..18b3ac2ee98d9 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.1.7",
+ "version": "100.1.8",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php
index 0d78947cd523e..df674a93794c1 100644
--- a/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php
+++ b/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php
@@ -13,6 +13,7 @@
use Magento\Sales\Model\ResourceModel\Order as OrderResource;
use Magento\Sales\Model\Order\Address\Renderer;
use Magento\Framework\Event\ManagerInterface;
+use Magento\Framework\DataObject;
/**
* Class OrderSender
@@ -127,14 +128,17 @@ protected function prepareTemplate(Order $order)
'formattedShippingAddress' => $this->getFormattedShippingAddress($order),
'formattedBillingAddress' => $this->getFormattedBillingAddress($order),
];
- $transport = new \Magento\Framework\DataObject($transport);
+ $transportObject = new DataObject($transport);
+ /**
+ * Event argument `transport` is @deprecated. Use `transportObject` instead.
+ */
$this->eventManager->dispatch(
'email_order_set_template_vars_before',
- ['sender' => $this, 'transport' => $transport]
+ ['sender' => $this, 'transport' => $transportObject->getData(), 'transportObject' => $transportObject]
);
- $this->templateContainer->setTemplateVars($transport->getData());
+ $this->templateContainer->setTemplateVars($transportObject->getData());
parent::prepareTemplate($order);
}
diff --git a/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php b/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php
index b5477c6de8d4d..6e836bae1e215 100644
--- a/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php
+++ b/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php
@@ -851,7 +851,7 @@ protected function _drawItem(\Magento\Framework\DataObject $item, \Zend_Pdf_Page
protected function _setFontRegular($object, $size = 7)
{
$font = \Zend_Pdf_Font::fontWithPath(
- $this->_rootDirectory->getAbsolutePath('lib/internal/LinLibertineFont/LinLibertine_Re-4.4.1.ttf')
+ $this->_rootDirectory->getAbsolutePath('lib/internal/GnuFreeFont/FreeSerif.ttf')
);
$object->setFont($font, $size);
return $font;
@@ -867,7 +867,7 @@ protected function _setFontRegular($object, $size = 7)
protected function _setFontBold($object, $size = 7)
{
$font = \Zend_Pdf_Font::fontWithPath(
- $this->_rootDirectory->getAbsolutePath('lib/internal/LinLibertineFont/LinLibertine_Bd-2.8.1.ttf')
+ $this->_rootDirectory->getAbsolutePath('lib/internal/GnuFreeFont/FreeSerifBold.ttf')
);
$object->setFont($font, $size);
return $font;
@@ -883,7 +883,7 @@ protected function _setFontBold($object, $size = 7)
protected function _setFontItalic($object, $size = 7)
{
$font = \Zend_Pdf_Font::fontWithPath(
- $this->_rootDirectory->getAbsolutePath('lib/internal/LinLibertineFont/LinLibertine_It-2.8.2.ttf')
+ $this->_rootDirectory->getAbsolutePath('lib/internal/GnuFreeFont/FreeSerifItalic.ttf')
);
$object->setFont($font, $size);
return $font;
diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php b/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php
index ce63d77f1d5d7..15d1a83dfd313 100644
--- a/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php
+++ b/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php
@@ -335,7 +335,7 @@ public function getItemOptions()
protected function _setFontRegular($size = 7)
{
$font = \Zend_Pdf_Font::fontWithPath(
- $this->_rootDirectory->getAbsolutePath('lib/internal/LinLibertineFont/LinLibertine_Re-4.4.1.ttf')
+ $this->_rootDirectory->getAbsolutePath('lib/internal/GnuFreeFont/FreeSerif.ttf')
);
$this->getPage()->setFont($font, $size);
return $font;
@@ -350,7 +350,7 @@ protected function _setFontRegular($size = 7)
protected function _setFontBold($size = 7)
{
$font = \Zend_Pdf_Font::fontWithPath(
- $this->_rootDirectory->getAbsolutePath('lib/internal/LinLibertineFont/LinLibertine_Bd-2.8.1.ttf')
+ $this->_rootDirectory->getAbsolutePath('lib/internal/GnuFreeFont/FreeSerifBold.ttf')
);
$this->getPage()->setFont($font, $size);
return $font;
@@ -365,7 +365,7 @@ protected function _setFontBold($size = 7)
protected function _setFontItalic($size = 7)
{
$font = \Zend_Pdf_Font::fontWithPath(
- $this->_rootDirectory->getAbsolutePath('lib/internal/LinLibertineFont/LinLibertine_It-2.8.2.ttf')
+ $this->_rootDirectory->getAbsolutePath('lib/internal/GnuFreeFont/FreeSerifItalic.ttf')
);
$this->getPage()->setFont($font, $size);
return $font;
diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Item.php b/app/code/Magento/Sales/Model/Order/Shipment/Item.php
index e2ba72a870c33..64a1562da8739 100644
--- a/app/code/Magento/Sales/Model/Order/Shipment/Item.php
+++ b/app/code/Magento/Sales/Model/Order/Shipment/Item.php
@@ -146,8 +146,7 @@ public function getOrderItem()
* Declare qty
*
* @param float $qty
- * @return \Magento\Sales\Model\Order\Invoice\Item
- * @throws \Magento\Framework\Exception\LocalizedException
+ * @return $this
*/
public function setQty($qty)
{
@@ -159,7 +158,6 @@ public function setQty($qty)
* Applying qty to order item
*
* @return $this
- * @throws \Magento\Framework\Exception\LocalizedException
*/
public function register()
{
diff --git a/app/code/Magento/Sales/Model/ResourceModel/Grid/Collection.php b/app/code/Magento/Sales/Model/ResourceModel/Grid/Collection.php
index e6aafb07a0c87..1c7e4f0eec75d 100644
--- a/app/code/Magento/Sales/Model/ResourceModel/Grid/Collection.php
+++ b/app/code/Magento/Sales/Model/ResourceModel/Grid/Collection.php
@@ -6,7 +6,7 @@
namespace Magento\Sales\Model\ResourceModel\Grid;
use Magento\Framework\Api\Search\SearchResultInterface;
-use Magento\Framework\Search\AggregationInterface;
+use Magento\Framework\Api\Search\AggregationInterface;
use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection;
/**
@@ -15,7 +15,6 @@
*/
class Collection extends AbstractCollection implements SearchResultInterface
{
-
/**
* @var AggregationInterface
*/
@@ -78,9 +77,9 @@ public function getAggregations()
public function setAggregations($aggregations)
{
$this->aggregations = $aggregations;
+ return $this;
}
-
/**
* Retrieve all ids for collection
* Backward compatibility with EAV collection
diff --git a/app/code/Magento/Sales/composer.json b/app/code/Magento/Sales/composer.json
index 4e54681e1525f..d39a344ce9ca3 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.1.*"
},
"type": "magento2-module",
- "version": "100.1.10",
+ "version": "100.1.11",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml
index 69adf252a9b1d..fbb9d028c4f04 100644
--- a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml
+++ b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml
@@ -187,7 +187,6 @@
- date
- Purchase Date
- desc
- - MMM dd, YYYY, H:mm:ss A
diff --git a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_view_creditmemo_grid.xml b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_view_creditmemo_grid.xml
index ccb1faae5e8a8..e3c6e680da1f2 100644
--- a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_view_creditmemo_grid.xml
+++ b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_view_creditmemo_grid.xml
@@ -34,7 +34,15 @@
-
+
+
+ -
+
-
+
- *
+
+
+
+
diff --git a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_view_invoice_grid.xml b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_view_invoice_grid.xml
index 559254387875c..5663bca048995 100644
--- a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_view_invoice_grid.xml
+++ b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_view_invoice_grid.xml
@@ -34,7 +34,15 @@
-
+
+
+ -
+
-
+
- *
+
+
+
+
diff --git a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_view_shipment_grid.xml b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_view_shipment_grid.xml
index 12cdd55a5f9fe..006318b00221b 100644
--- a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_view_shipment_grid.xml
+++ b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_view_shipment_grid.xml
@@ -34,7 +34,15 @@
-
+
+
+ -
+
-
+
- *
+
+
+
+
diff --git a/app/code/Magento/SalesInventory/composer.json b/app/code/Magento/SalesInventory/composer.json
index 783382f0d4af6..1efbde227d20c 100644
--- a/app/code/Magento/SalesInventory/composer.json
+++ b/app/code/Magento/SalesInventory/composer.json
@@ -10,7 +10,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.1",
+ "version": "100.1.2",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote.php b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote.php
index 2b788d36acb0c..d58c8220813ef 100644
--- a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote.php
+++ b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote.php
@@ -74,7 +74,7 @@ protected function _initRule()
/**
* Initiate action
*
- * @return this
+ * @return $this
*/
protected function _initAction()
{
diff --git a/app/code/Magento/SalesRule/Model/ResourceModel/Coupon.php b/app/code/Magento/SalesRule/Model/ResourceModel/Coupon.php
index 5068f53f23bc9..3907261cad1b9 100644
--- a/app/code/Magento/SalesRule/Model/ResourceModel/Coupon.php
+++ b/app/code/Magento/SalesRule/Model/ResourceModel/Coupon.php
@@ -106,7 +106,7 @@ public function exists($code)
}
/**
- * Update auto generated Specific Coupon if it's rule changed
+ * Update auto generated Specific Coupon if its rule changed
*
* @param \Magento\SalesRule\Model\Rule $rule
* @return $this
diff --git a/app/code/Magento/SalesRule/composer.json b/app/code/Magento/SalesRule/composer.json
index 77bca4537aeaf..ce3923b8c648c 100644
--- a/app/code/Magento/SalesRule/composer.json
+++ b/app/code/Magento/SalesRule/composer.json
@@ -25,7 +25,7 @@
"magento/module-sales-rule-sample-data": "Sample Data version:100.1.*"
},
"type": "magento2-module",
- "version": "100.1.6",
+ "version": "100.1.7",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/SalesSequence/composer.json b/app/code/Magento/SalesSequence/composer.json
index 32397fa0399c3..c51e9704c051a 100644
--- a/app/code/Magento/SalesSequence/composer.json
+++ b/app/code/Magento/SalesSequence/composer.json
@@ -6,7 +6,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.3",
+ "version": "100.1.4",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/SampleData/composer.json b/app/code/Magento/SampleData/composer.json
index 99d41c91d09ef..07f6d6e7cd3e6 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.1.*"
},
"type": "magento2-module",
- "version": "100.1.4",
+ "version": "100.1.5",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Search/composer.json b/app/code/Magento/Search/composer.json
index c8ffd9323e561..d3fd9854b5f1a 100644
--- a/app/code/Magento/Search/composer.json
+++ b/app/code/Magento/Search/composer.json
@@ -11,7 +11,7 @@
"magento/module-ui": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.4",
+ "version": "100.1.5",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Security/Model/AdminSessionInfo.php b/app/code/Magento/Security/Model/AdminSessionInfo.php
index 2da74ce7689b2..2a66aaad80cf7 100644
--- a/app/code/Magento/Security/Model/AdminSessionInfo.php
+++ b/app/code/Magento/Security/Model/AdminSessionInfo.php
@@ -154,7 +154,7 @@ public function isOtherSessionsTerminated()
* Setter for isOtherSessionsTerminated
*
* @param bool $isOtherSessionsTerminated
- * @return this
+ * @return $this
*/
public function setIsOtherSessionsTerminated($isOtherSessionsTerminated)
{
diff --git a/app/code/Magento/Security/composer.json b/app/code/Magento/Security/composer.json
index 0bd8008b96689..a20481d091c6e 100644
--- a/app/code/Magento/Security/composer.json
+++ b/app/code/Magento/Security/composer.json
@@ -11,7 +11,7 @@
"magento/module-customer": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.3",
+ "version": "100.1.4",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Security/etc/adminhtml/di.xml b/app/code/Magento/Security/etc/adminhtml/di.xml
index c1188c2d405cf..79477e9443097 100644
--- a/app/code/Magento/Security/etc/adminhtml/di.xml
+++ b/app/code/Magento/Security/etc/adminhtml/di.xml
@@ -24,7 +24,7 @@
- Magento\Security\Model\SecurityChecker\Frequency
- - Magento\Security\Model\SecurityChecker\Quantity
+ - Magento\Security\Model\SecurityChecker\Quantity
diff --git a/app/code/Magento/SendFriend/composer.json b/app/code/Magento/SendFriend/composer.json
index afda90dea6059..523ee5de43b42 100644
--- a/app/code/Magento/SendFriend/composer.json
+++ b/app/code/Magento/SendFriend/composer.json
@@ -10,7 +10,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.2",
+ "version": "100.1.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Shipping/Model/Info.php b/app/code/Magento/Shipping/Model/Info.php
index ec03d06c5b2d1..718edbce83b8c 100644
--- a/app/code/Magento/Shipping/Model/Info.php
+++ b/app/code/Magento/Shipping/Model/Info.php
@@ -116,7 +116,7 @@ protected function _initOrder()
/** @var \Magento\Sales\Model\Order $order */
$order = $this->_orderFactory->create()->load($this->getOrderId());
- if (!$order->getId() || $this->getProtectCode() != $order->getProtectCode()) {
+ if (!$order->getId() || $this->getProtectCode() !== $order->getProtectCode()) {
return false;
}
@@ -132,7 +132,7 @@ protected function _initShipment()
{
/* @var $model Shipment */
$ship = $this->shipmentRepository->get($this->getShipId());
- if (!$ship->getEntityId() || $this->getProtectCode() != $ship->getProtectCode()) {
+ if (!$ship->getEntityId() || $this->getProtectCode() !== $ship->getProtectCode()) {
return false;
}
@@ -197,7 +197,7 @@ public function getTrackingInfoByTrackId()
{
/** @var \Magento\Shipping\Model\Order\Track $track */
$track = $this->_trackFactory->create()->load($this->getTrackId());
- if ($track->getId() && $this->getProtectCode() == $track->getProtectCode()) {
+ if ($track->getId() && $this->getProtectCode() === $track->getProtectCode()) {
$this->_trackingInfo = [[$track->getNumberDetail()]];
}
return $this->_trackingInfo;
diff --git a/app/code/Magento/Shipping/Test/Unit/Model/InfoTest.php b/app/code/Magento/Shipping/Test/Unit/Model/InfoTest.php
new file mode 100644
index 0000000000000..3fe2f1e14448b
--- /dev/null
+++ b/app/code/Magento/Shipping/Test/Unit/Model/InfoTest.php
@@ -0,0 +1,300 @@
+helper = $this->getMockBuilder(\Magento\Shipping\Helper\Data::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->orderFactory = $this->getMockBuilder(\Magento\Sales\Model\OrderFactory::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['create'])
+ ->getMock();
+ $this->shipmentRepository = $this->getMockBuilder(\Magento\Sales\Api\ShipmentRepositoryInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->trackFactory = $this->getMockBuilder(\Magento\Shipping\Model\Order\TrackFactory::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['create'])
+ ->getMock();
+ $this->trackCollectionFactory = $this->getMockBuilder(CollectionFactory::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['create'])
+ ->getMock();
+ $objectManagerHelper = new ObjectManager($this);
+ $this->info = $objectManagerHelper->getObject(
+ Info::class,
+ [
+ 'shippingData' => $this->helper,
+ 'orderFactory' => $this->orderFactory,
+ 'shipmentRepository' => $this->shipmentRepository,
+ 'trackFactory' => $this->trackFactory,
+ 'trackCollectionFactory' => $this->trackCollectionFactory,
+ ]
+ );
+ }
+
+ public function testLoadByHashWithOrderId()
+ {
+ $hash = strtr(base64_encode('order_id:1:protected_code'), '+/=', '-_,');
+ $decodedHash = [
+ 'key' => 'order_id',
+ 'id' => 1,
+ 'hash' => 'protected_code',
+ ];
+ $shipmentId = 1;
+ $shipmentIncrementId = 3;
+ $trackDetails = 'track_details';
+
+ $this->helper->expects($this->atLeastOnce())
+ ->method('decodeTrackingHash')
+ ->with($hash)
+ ->willReturn($decodedHash);
+ $shipmentCollection = $this->getMockBuilder(\Magento\Sales\Model\ResourceModel\Order\Shipment\Collection::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['getIterator'])
+ ->getMock();
+ $order = $this->getMockBuilder(\Magento\Sales\Model\Order::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['load', 'getId', 'getProtectCode', 'getShipmentsCollection'])
+ ->getMock();
+ $order->expects($this->atLeastOnce())->method('load')->with($decodedHash['id'])->willReturnSelf();
+ $order->expects($this->atLeastOnce())->method('getId')->willReturn($decodedHash['id']);
+ $order->expects($this->atLeastOnce())->method('getProtectCode')->willReturn($decodedHash['hash']);
+ $order->expects($this->atLeastOnce())->method('getShipmentsCollection')->willReturn($shipmentCollection);
+
+ $shipment = $this->getMockBuilder(\Magento\Sales\Model\Order\Shipment::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['getIncrementId', 'getId'])
+ ->getMock();
+ $shipment->expects($this->atLeastOnce())->method('getIncrementId')->willReturn($shipmentIncrementId);
+ $shipment->expects($this->atLeastOnce())->method('getId')->willReturn($shipmentId);
+
+ $shipmentCollection->expects($this->any())->method('getIterator')->willReturn(new \ArrayIterator([$shipment]));
+ $this->orderFactory->expects($this->atLeastOnce())->method('create')->willReturn($order);
+ $track = $this->getMockBuilder(\Magento\Sales\Model\Order\Shipment\Track::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['setShipment', 'getNumberDetail'])
+ ->getMock();
+ $track->expects($this->atLeastOnce())->method('setShipment')->with($shipment)->willReturnSelf();
+ $track->expects($this->atLeastOnce())->method('getNumberDetail')->willReturn($trackDetails);
+ $trackCollection = $this->getMockBuilder(\Magento\Shipping\Model\ResourceModel\Order\Track\Collection::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['getIterator', 'setShipmentFilter'])
+ ->getMock();
+ $trackCollection->expects($this->atLeastOnce())
+ ->method('setShipmentFilter')
+ ->with($shipmentId)
+ ->willReturnSelf();
+ $trackCollection->expects($this->atLeastOnce())
+ ->method('getIterator')
+ ->willReturn(new \ArrayIterator([$track]));
+ $this->trackCollectionFactory->expects($this->atLeastOnce())->method('create')->willReturn($trackCollection);
+
+ $this->info->loadByHash($hash);
+ $this->assertEquals([$shipmentIncrementId => [$trackDetails]], $this->info->getTrackingInfo());
+ }
+
+ public function testLoadByHashWithOrderIdWrongCode()
+ {
+ $hash = strtr(base64_encode('order_id:1:0'), '+/=', '-_,');
+ $decodedHash = [
+ 'key' => 'order_id',
+ 'id' => 1,
+ 'hash' => '0',
+ ];
+
+ $this->helper->expects($this->atLeastOnce())
+ ->method('decodeTrackingHash')
+ ->with($hash)
+ ->willReturn($decodedHash);
+ $order = $this->getMockBuilder(\Magento\Sales\Model\Order::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['load', 'getId', 'getProtectCode', 'getShipmentsCollection'])
+ ->getMock();
+ $order->expects($this->atLeastOnce())->method('load')->with($decodedHash['id'])->willReturnSelf();
+ $order->expects($this->atLeastOnce())->method('getId')->willReturn($decodedHash['id']);
+ $order->expects($this->atLeastOnce())->method('getProtectCode')->willReturn('0e123123123');
+ $this->orderFactory->expects($this->atLeastOnce())->method('create')->willReturn($order);
+ $this->info->loadByHash($hash);
+ $this->assertEmpty($this->info->getTrackingInfo());
+ }
+
+ public function testLoadByHashWithShipmentId()
+ {
+ $hash = strtr(base64_encode('ship_id:1:protected_code'), '+/=', '-_,');
+ $decodedHash = [
+ 'key' => 'ship_id',
+ 'id' => 1,
+ 'hash' => 'protected_code',
+ ];
+ $shipmentIncrementId = 3;
+ $trackDetails = 'track_details';
+
+ $this->helper->expects($this->atLeastOnce())
+ ->method('decodeTrackingHash')
+ ->with($hash)
+ ->willReturn($decodedHash);
+ $shipment = $this->getMockBuilder(\Magento\Sales\Model\Order\Shipment::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['getEntityId', 'getProtectCode', 'getIncrementId', 'getId'])
+ ->getMock();
+ $shipment->expects($this->atLeastOnce())->method('getIncrementId')->willReturn($shipmentIncrementId);
+ $shipment->expects($this->atLeastOnce())->method('getId')->willReturn($decodedHash['id']);
+ $shipment->expects($this->atLeastOnce())->method('getEntityId')->willReturn(3);
+ $shipment->expects($this->atLeastOnce())->method('getProtectCode')->willReturn($decodedHash['hash']);
+ $this->shipmentRepository->expects($this->atLeastOnce())
+ ->method('get')
+ ->with($decodedHash['id'])
+ ->willReturn($shipment);
+ $track = $this->getMockBuilder(\Magento\Sales\Model\Order\Shipment\Track::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['setShipment', 'getNumberDetail'])
+ ->getMock();
+ $track->expects($this->atLeastOnce())->method('setShipment')->with($shipment)->willReturnSelf();
+ $track->expects($this->atLeastOnce())->method('getNumberDetail')->willReturn($trackDetails);
+ $trackCollection = $this->getMockBuilder(\Magento\Shipping\Model\ResourceModel\Order\Track\Collection::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['getIterator', 'setShipmentFilter'])
+ ->getMock();
+ $trackCollection->expects($this->atLeastOnce())
+ ->method('setShipmentFilter')
+ ->with($decodedHash['id'])
+ ->willReturnSelf();
+ $trackCollection->expects($this->atLeastOnce())
+ ->method('getIterator')
+ ->willReturn(new \ArrayIterator([$track]));
+ $this->trackCollectionFactory->expects($this->atLeastOnce())->method('create')->willReturn($trackCollection);
+
+ $this->info->loadByHash($hash);
+ $this->assertEquals([$shipmentIncrementId => [$trackDetails]], $this->info->getTrackingInfo());
+ }
+
+ public function testLoadByHashWithShipmentIdWrongCode()
+ {
+ $hash = strtr(base64_encode('ship_id:1:0'), '+/=', '-_,');
+ $decodedHash = [
+ 'key' => 'ship_id',
+ 'id' => 1,
+ 'hash' => '0',
+ ];
+
+ $this->helper->expects($this->atLeastOnce())
+ ->method('decodeTrackingHash')
+ ->with($hash)
+ ->willReturn($decodedHash);
+ $shipment = $this->getMockBuilder(\Magento\Sales\Model\Order\Shipment::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['getEntityId', 'getProtectCode', 'getIncrementId', 'getId'])
+ ->getMock();
+ $shipment->expects($this->atLeastOnce())->method('getEntityId')->willReturn(3);
+ $shipment->expects($this->atLeastOnce())->method('getProtectCode')->willReturn('0e123123123');
+ $this->shipmentRepository->expects($this->atLeastOnce())
+ ->method('get')
+ ->with($decodedHash['id'])
+ ->willReturn($shipment);
+
+ $this->info->loadByHash($hash);
+ $this->assertEmpty($this->info->getTrackingInfo());
+ }
+
+ public function testLoadByHashWithTrackId()
+ {
+ $hash = base64_encode('hash');
+ $decodedHash = [
+ 'key' => 'track_id',
+ 'id' => 1,
+ 'hash' => 'protected_code',
+ ];
+ $trackDetails = 'track_details';
+ $this->helper->expects($this->atLeastOnce())
+ ->method('decodeTrackingHash')
+ ->with($hash)
+ ->willReturn($decodedHash);
+ $track = $this->getMockBuilder(\Magento\Sales\Model\Order\Shipment\Track::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['load', 'getId', 'getProtectCode', 'getNumberDetail'])
+ ->getMock();
+ $track->expects($this->atLeastOnce())->method('load')->with($decodedHash['id'])->willReturnSelf();
+ $track->expects($this->atLeastOnce())->method('getId')->willReturn($decodedHash['id']);
+ $track->expects($this->atLeastOnce())->method('getProtectCode')->willReturn($decodedHash['hash']);
+ $track->expects($this->atLeastOnce())->method('getNumberDetail')->willReturn($trackDetails);
+ $this->trackFactory->expects($this->atLeastOnce())->method('create')->willReturn($track);
+
+ $this->info->loadByHash($hash);
+ $this->assertEquals([[$trackDetails]], $this->info->getTrackingInfo());
+ }
+
+ public function testLoadByHashWithWrongCode()
+ {
+ $hash = base64_encode('hash');
+ $decodedHash = [
+ 'key' => 'track_id',
+ 'id' => 1,
+ 'hash' => 'protected_code',
+ ];
+ $this->helper->expects($this->atLeastOnce())
+ ->method('decodeTrackingHash')
+ ->with($hash)
+ ->willReturn($decodedHash);
+ $track = $this->getMockBuilder(\Magento\Sales\Model\Order\Shipment\Track::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['load', 'getId', 'getProtectCode', 'getNumberDetail'])
+ ->getMock();
+ $track->expects($this->atLeastOnce())->method('load')->with($decodedHash['id'])->willReturnSelf();
+ $track->expects($this->atLeastOnce())->method('getId')->willReturn($decodedHash['id']);
+ $track->expects($this->atLeastOnce())->method('getProtectCode')->willReturn('0e123123123');
+ $this->trackFactory->expects($this->atLeastOnce())->method('create')->willReturn($track);
+
+ $this->info->loadByHash($hash);
+ $this->assertEmpty($this->info->getTrackingInfo());
+ }
+}
diff --git a/app/code/Magento/Shipping/composer.json b/app/code/Magento/Shipping/composer.json
index a51856c0c04bd..58c58ab4f5555 100644
--- a/app/code/Magento/Shipping/composer.json
+++ b/app/code/Magento/Shipping/composer.json
@@ -24,7 +24,7 @@
"magento/module-ups": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.5",
+ "version": "100.1.7",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Shipping/view/adminhtml/templates/view/form.phtml b/app/code/Magento/Shipping/view/adminhtml/templates/view/form.phtml
index 3f8c95320a861..9db675694578b 100644
--- a/app/code/Magento/Shipping/view/adminhtml/templates/view/form.phtml
+++ b/app/code/Magento/Shipping/view/adminhtml/templates/view/form.phtml
@@ -6,70 +6,78 @@
// @codingStandardsIgnoreFile
+/**
+ * @var \Magento\Shipping\Block\Adminhtml\View\Form $block
+ */
+$order = $block->getShipment()->getOrder();
?>
-getShipment()->getOrder() ?>
-getChildHtml('order_info') ?>
+getChildHtml('order_info'); ?>
-
+ escapeHtml(__('Payment & Shipping Method')); ?>
-
+ escapeHtml(__('Payment Information')); ?>
-
getChildHtml('order_payment') ?>
-
getOrderCurrencyCode()) ?>
+
getChildHtml('order_payment'); ?>
+
+ escapeHtml(__('The order was placed using %1.', $order->getOrderCurrencyCode())); ?>
+
-
+ escapeHtml(__('Shipping and Tracking Information')); ?>
getShipment()->getTracksCollection()->count()): ?>
-
+
+ escapeHtml(__('Track this shipment')); ?>
- escapeHtml($_order->getShippingDescription()) ?>
+ escapeHtml($order->getShippingDescription()) ?>
- :
+ escapeHtml(__('Total Shipping Charges')); ?>:
- helper('Magento\Tax\Helper\Data')->displayShippingPriceIncludingTax()): ?>
- displayShippingPriceInclTax($_order); ?>
+ helper(\Magento\Tax\Helper\Data::class)->displayShippingPriceIncludingTax()): ?>
+ displayShippingPriceInclTax($order); ?>
- displayPriceAttribute('shipping_amount', false, ' '); ?>
+ displayPriceAttribute('shipping_amount', false, ' '); ?>
- displayShippingPriceInclTax($_order); ?>
+ displayShippingPriceInclTax($order); ?>
-
- helper('Magento\Tax\Helper\Data')->displayShippingBothPrices() && $_incl != $_excl): ?>
- ( )
+
+ helper(\Magento\Tax\Helper\Data::class)->displayShippingBothPrices() && $incl != $excl): ?>
+ (escapeHtml(__('Incl. Tax')); ?> )
- canCreateShippingLabel()): ?>
- getCreateLabelButton()?>
+ canCreateShippingLabel()): ?>
+ getCreateLabelButton(); ?>
+
getShipment()->getShippingLabel()): ?>
- getPrintLabelButton() ?>
+ getPrintLabelButton(); ?>
getShipment()->getPackages()): ?>
- getShowPackagesButton() ?>
+ getShowPackagesButton(); ?>
-
- getChildHtml('shipment_tracking') ?>
+ getChildHtml('shipment_tracking'); ?>
- getChildHtml('shipment_packaging') ?>
+ getChildHtml('shipment_packaging'); ?>
diff --git a/app/code/Magento/SwatchesLayeredNavigation/composer.json b/app/code/Magento/SwatchesLayeredNavigation/composer.json
index 11dd456885353..99823150e378d 100644
--- a/app/code/Magento/SwatchesLayeredNavigation/composer.json
+++ b/app/code/Magento/SwatchesLayeredNavigation/composer.json
@@ -7,7 +7,7 @@
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "100.1.2",
+ "version": "100.1.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Tax/Model/Config.php b/app/code/Magento/Tax/Model/Config.php
index 713b34c16d1f2..64f5b44803848 100644
--- a/app/code/Magento/Tax/Model/Config.php
+++ b/app/code/Magento/Tax/Model/Config.php
@@ -831,12 +831,12 @@ public function getInfoUrl($store = null)
* If it necessary will be returned conversion type (minus or plus)
*
* @param null|int|string|Store $store
- * @return bool
+ * @return bool|int
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function needPriceConversion($store = null)
{
- $res = false;
+ $res = 0;
$priceIncludesTax = $this->priceIncludesTax($store) || $this->getNeedUseShippingExcludeTax();
if ($priceIncludesTax) {
switch ($this->getPriceDisplayType($store)) {
@@ -844,7 +844,7 @@ public function needPriceConversion($store = null)
case self::DISPLAY_TYPE_BOTH:
return self::PRICE_CONVERSION_MINUS;
case self::DISPLAY_TYPE_INCLUDING_TAX:
- $res = true;
+ $res = false;
break;
default:
break;
diff --git a/app/code/Magento/Tax/composer.json b/app/code/Magento/Tax/composer.json
index 75e91ef3e2cac..67a656e47e083 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.1.*"
},
"type": "magento2-module",
- "version": "100.1.4",
+ "version": "100.1.5",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/TaxImportExport/composer.json b/app/code/Magento/TaxImportExport/composer.json
index 184b545ec06b0..21f645b3dc3ab 100644
--- a/app/code/Magento/TaxImportExport/composer.json
+++ b/app/code/Magento/TaxImportExport/composer.json
@@ -10,7 +10,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.2",
+ "version": "100.1.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 61a8e728e2236..a3cfa4cbe9b4a 100644
--- a/app/code/Magento/Theme/composer.json
+++ b/app/code/Magento/Theme/composer.json
@@ -21,7 +21,7 @@
"magento/module-theme-sample-data": "Sample Data version:100.1.*"
},
"type": "magento2-module",
- "version": "100.1.9",
+ "version": "100.1.10",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Theme/view/frontend/templates/html/print.phtml b/app/code/Magento/Theme/view/frontend/templates/html/print.phtml
index 4892cceded8b7..d05faac66ffd1 100644
--- a/app/code/Magento/Theme/view/frontend/templates/html/print.phtml
+++ b/app/code/Magento/Theme/view/frontend/templates/html/print.phtml
@@ -5,7 +5,14 @@
*/
?>
diff --git a/app/code/Magento/Translation/Block/Html/Head/Config.php b/app/code/Magento/Translation/Block/Html/Head/Config.php
index 4001929191072..1a1f2d6942cdf 100644
--- a/app/code/Magento/Translation/Block/Html/Head/Config.php
+++ b/app/code/Magento/Translation/Block/Html/Head/Config.php
@@ -31,7 +31,6 @@ class Config extends \Magento\Framework\View\Element\AbstractBlock
/**
* @param \Magento\Framework\View\Element\Context $context
- * @param RequireJsConfig $config
* @param \Magento\Framework\View\Page\Config $pageConfig
* @param \Magento\Translation\Model\FileManager $fileManager
* @param Inline $inline
diff --git a/app/code/Magento/Translation/Model/Js/DataProvider.php b/app/code/Magento/Translation/Model/Js/DataProvider.php
index 26b8e3e6615d3..0e0f0c9dd4808 100644
--- a/app/code/Magento/Translation/Model/Js/DataProvider.php
+++ b/app/code/Magento/Translation/Model/Js/DataProvider.php
@@ -1,6 +1,6 @@
config->getPatterns() as $pattern) {
- $result = preg_match_all($pattern, $content, $matches);
+ $concatenatedContent = preg_replace('~(["\'])\s*?\+\s*?\1~', '', $content);
+ $result = preg_match_all($pattern, $concatenatedContent, $matches);
if ($result) {
if (isset($matches[2])) {
foreach ($matches[2] as $match) {
- $phrases[] = str_replace('\\\'', '\'', $match);
+ $phrases[] = str_replace(["\'", '\"'], ["'", '"'], $match);
}
}
}
diff --git a/app/code/Magento/Translation/composer.json b/app/code/Magento/Translation/composer.json
index b776021b248cd..936a6e9dfef88 100644
--- a/app/code/Magento/Translation/composer.json
+++ b/app/code/Magento/Translation/composer.json
@@ -13,7 +13,7 @@
"magento/module-deploy": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.4",
+ "version": "100.1.5",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Translation/etc/di.xml b/app/code/Magento/Translation/etc/di.xml
index ac9daaa2eca39..c75324029116b 100644
--- a/app/code/Magento/Translation/etc/di.xml
+++ b/app/code/Magento/Translation/etc/di.xml
@@ -59,8 +59,8 @@
- - ~\$\.mage\.__\((?s)[^'"]*?(['"])(.+?)\1(?s).*?\)~
- - ~\$t\((?s)[^'"]*?(["'])(.+?)\1(?s).*?\)~
+
+
diff --git a/app/code/Magento/Ui/Component/ExportButton.php b/app/code/Magento/Ui/Component/ExportButton.php
index 9d5f125839003..20cc6623c847c 100644
--- a/app/code/Magento/Ui/Component/ExportButton.php
+++ b/app/code/Magento/Ui/Component/ExportButton.php
@@ -54,11 +54,13 @@ public function getComponentName()
*/
public function prepare()
{
+ $context = $this->getContext();
$config = $this->getData('config');
if (isset($config['options'])) {
$options = [];
foreach ($config['options'] as $option) {
- $option['url'] = $this->urlBuilder->getUrl($option['url']);
+ $additionalParams = $this->getAdditionalParams($config, $context);
+ $option['url'] = $this->urlBuilder->getUrl($option['url'], $additionalParams);
$options[] = $option;
}
$config['options'] = $options;
@@ -66,4 +68,25 @@ public function prepare()
}
parent::prepare();
}
+
+ /**
+ * Get export button additional parameters
+ *
+ * @param array $config
+ * @param ContextInterface $context
+ * @return array
+ */
+ private function getAdditionalParams($config, $context)
+ {
+ $additionalParams = [];
+ if (isset($config['additionalParams'])) {
+ foreach ($config['additionalParams'] as $paramName => $paramValue) {
+ if ('*' == $paramValue) {
+ $paramValue = $context->getRequestParam($paramName);
+ }
+ $additionalParams[$paramName] = $paramValue;
+ }
+ }
+ return $additionalParams;
+ }
}
diff --git a/app/code/Magento/Ui/Controller/Adminhtml/Export/GridToCsv.php b/app/code/Magento/Ui/Controller/Adminhtml/Export/GridToCsv.php
index 13aed8fe300e5..759ec43ca2673 100644
--- a/app/code/Magento/Ui/Controller/Adminhtml/Export/GridToCsv.php
+++ b/app/code/Magento/Ui/Controller/Adminhtml/Export/GridToCsv.php
@@ -5,10 +5,13 @@
*/
namespace Magento\Ui\Controller\Adminhtml\Export;
+use Magento\Framework\App\ObjectManager;
use Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;
use Magento\Ui\Model\Export\ConvertToCsv;
use Magento\Framework\App\Response\Http\FileFactory;
+use Magento\Ui\Component\MassAction\Filter;
+use Psr\Log\LoggerInterface;
/**
* Class Render
@@ -25,19 +28,37 @@ class GridToCsv extends Action
*/
protected $fileFactory;
+ /**
+ * @var Filter
+ */
+ private $filter;
+
+ /**
+ * @var LoggerInterface
+ */
+ private $logger;
+
/**
* @param Context $context
* @param ConvertToCsv $converter
* @param FileFactory $fileFactory
+ * @param Filter|null $filter
+ * @param LoggerInterface|null $logger
*/
public function __construct(
Context $context,
ConvertToCsv $converter,
- FileFactory $fileFactory
+ FileFactory $fileFactory,
+ Filter $filter = null,
+ LoggerInterface $logger = null
) {
parent::__construct($context);
$this->converter = $converter;
$this->fileFactory = $fileFactory;
+ $this->filter = $filter
+ ?: ObjectManager::getInstance()->get(Filter::class);
+ $this->logger = $logger
+ ?: ObjectManager::getInstance()->get(LoggerInterface::class);
}
/**
@@ -48,6 +69,34 @@ public function __construct(
*/
public function execute()
{
- return $this->fileFactory->create('export.csv', $this->converter->getCsvFile(), 'var');
+ return $this->fileFactory->create(
+ 'export.csv',
+ $this->converter->getCsvFile(),
+ 'var'
+ );
+ }
+
+ /**
+ * Checking if the user has access to requested component.
+ *
+ * @inheritDoc
+ */
+ protected function _isAllowed()
+ {
+ if ($this->_request->getParam('namespace')) {
+ try {
+ $component = $this->filter->getComponent();
+ $aclResource = $component->getData('acl');
+ if ($aclResource) {
+ return $this->_authorization->isAllowed($aclResource);
+ }
+ } catch (\Exception $exception) {
+ $this->logger->critical($exception);
+
+ return false;
+ }
+ }
+
+ return true;
}
}
diff --git a/app/code/Magento/Ui/Controller/Adminhtml/Export/GridToXml.php b/app/code/Magento/Ui/Controller/Adminhtml/Export/GridToXml.php
index f00825a3e0bb9..da2609db91273 100644
--- a/app/code/Magento/Ui/Controller/Adminhtml/Export/GridToXml.php
+++ b/app/code/Magento/Ui/Controller/Adminhtml/Export/GridToXml.php
@@ -5,10 +5,13 @@
*/
namespace Magento\Ui\Controller\Adminhtml\Export;
+use Magento\Framework\App\ObjectManager;
use Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;
use Magento\Ui\Model\Export\ConvertToXml;
use Magento\Framework\App\Response\Http\FileFactory;
+use Magento\Ui\Component\MassAction\Filter;
+use Psr\Log\LoggerInterface;
/**
* Class Render
@@ -25,19 +28,37 @@ class GridToXml extends Action
*/
protected $fileFactory;
+ /**
+ * @var Filter
+ */
+ private $filter;
+
+ /**
+ * @var LoggerInterface
+ */
+ private $logger;
+
/**
* @param Context $context
* @param ConvertToXml $converter
* @param FileFactory $fileFactory
+ * @param Filter|null $filter
+ * @param LoggerInterface|null $logger
*/
public function __construct(
Context $context,
ConvertToXml $converter,
- FileFactory $fileFactory
+ FileFactory $fileFactory,
+ Filter $filter = null,
+ LoggerInterface $logger = null
) {
parent::__construct($context);
$this->converter = $converter;
$this->fileFactory = $fileFactory;
+ $this->filter = $filter
+ ?: ObjectManager::getInstance()->get(Filter::class);
+ $this->logger = $logger
+ ?: ObjectManager::getInstance()->get(LoggerInterface::class);
}
/**
@@ -48,6 +69,34 @@ public function __construct(
*/
public function execute()
{
- return $this->fileFactory->create('export.xml', $this->converter->getXmlFile(), 'var');
+ return $this->fileFactory->create(
+ 'export.xml',
+ $this->converter->getXmlFile(),
+ 'var'
+ );
+ }
+
+ /**
+ * Checking if the user has access to requested component.
+ *
+ * @inheritDoc
+ */
+ protected function _isAllowed()
+ {
+ if ($this->_request->getParam('namespace')) {
+ try {
+ $component = $this->filter->getComponent();
+ $aclResource = $component->getData('acl');
+ if ($aclResource) {
+ return $this->_authorization->isAllowed($aclResource);
+ }
+ } catch (\Exception $exception) {
+ $this->logger->critical($exception);
+
+ return false;
+ }
+ }
+
+ return true;
}
}
diff --git a/app/code/Magento/Ui/Controller/Adminhtml/Index/Render.php b/app/code/Magento/Ui/Controller/Adminhtml/Index/Render.php
index 85c8e3967be87..e16e3e43bdf30 100644
--- a/app/code/Magento/Ui/Controller/Adminhtml/Index/Render.php
+++ b/app/code/Magento/Ui/Controller/Adminhtml/Index/Render.php
@@ -37,6 +37,11 @@ public function execute()
}
$this->prepareComponent($component);
+
+ if ($component->getContext()->getAcceptType() === 'json') {
+ $this->_response->setHeader('Content-Type', 'application/json');
+ }
+
$this->_response->appendBody((string) $component->render());
}
diff --git a/app/code/Magento/Ui/Model/Export/ConvertToCsv.php b/app/code/Magento/Ui/Model/Export/ConvertToCsv.php
index 9eba829982533..e8136c7520054 100644
--- a/app/code/Magento/Ui/Model/Export/ConvertToCsv.php
+++ b/app/code/Magento/Ui/Model/Export/ConvertToCsv.php
@@ -8,7 +8,6 @@
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Filesystem;
-use Magento\Framework\Filesystem\Directory\WriteInterface;
use Magento\Ui\Component\MassAction\Filter;
/**
@@ -17,7 +16,7 @@
class ConvertToCsv
{
/**
- * @var WriteInterface
+ * @var DirectoryList
*/
protected $directory;
diff --git a/app/code/Magento/Ui/Model/Export/ConvertToXml.php b/app/code/Magento/Ui/Model/Export/ConvertToXml.php
index 58c3419e95312..8f06193740cfc 100644
--- a/app/code/Magento/Ui/Model/Export/ConvertToXml.php
+++ b/app/code/Magento/Ui/Model/Export/ConvertToXml.php
@@ -12,7 +12,6 @@
use Magento\Framework\Convert\ExcelFactory;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Filesystem;
-use Magento\Framework\Filesystem\Directory\WriteInterface;
use Magento\Ui\Component\MassAction\Filter;
/**
@@ -21,7 +20,7 @@
class ConvertToXml
{
/**
- * @var WriteInterface
+ * @var DirectoryList
*/
protected $directory;
diff --git a/app/code/Magento/Ui/TemplateEngine/Xhtml/Result.php b/app/code/Magento/Ui/TemplateEngine/Xhtml/Result.php
index cda3106a14f49..e249a64861d43 100644
--- a/app/code/Magento/Ui/TemplateEngine/Xhtml/Result.php
+++ b/app/code/Magento/Ui/TemplateEngine/Xhtml/Result.php
@@ -80,7 +80,9 @@ public function getDocumentElement()
*/
public function appendLayoutConfiguration()
{
- $layoutConfiguration = $this->wrapContent(json_encode($this->structure->generate($this->component)));
+ $layoutConfiguration = $this->wrapContent(
+ json_encode($this->structure->generate($this->component), JSON_HEX_TAG)
+ );
$this->template->append($layoutConfiguration);
}
diff --git a/app/code/Magento/Ui/Test/Unit/Controller/Adminhtml/Index/RenderTest.php b/app/code/Magento/Ui/Test/Unit/Controller/Adminhtml/Index/RenderTest.php
index 50476c0e41db4..090d54ebf721f 100644
--- a/app/code/Magento/Ui/Test/Unit/Controller/Adminhtml/Index/RenderTest.php
+++ b/app/code/Magento/Ui/Test/Unit/Controller/Adminhtml/Index/RenderTest.php
@@ -5,67 +5,71 @@
*/
namespace Magento\Ui\Test\Unit\Controller\Adminhtml\Index;
-use \Magento\Ui\Controller\Adminhtml\Index\Render;
+use Magento\Ui\Controller\Adminhtml\Index\Render;
+use PHPUnit_Framework_MockObject_MockObject as MockObject;
/**
- * Class RenderTest
+ * Unit test for Magento\Ui\Controller\Adminhtml\Index\Render
*/
class RenderTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Render
*/
- protected $render;
+ private $render;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
- protected $requestMock;
+ private $requestMock;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var MockObject
*/
- protected $responseMock;
+ private $responseMock;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var \Magento\Framework\View\Element\UiComponentFactory|MockObject
*/
- protected $uiFactoryMock;
+ private $uiFactoryMock;
/**
- * @var \Magento\Backend\App\Action\Context|\PHPUnit_Framework_MockObject_MockObject
+ * @var \Magento\Backend\App\Action\Context|MockObject
*/
private $contextMock;
/**
- * @var \Magento\Framework\AuthorizationInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var \Magento\Framework\AuthorizationInterface|MockObject
*/
private $authorizationMock;
/**
- * @var \Magento\Backend\Model\Session|\PHPUnit_Framework_MockObject_MockObject
+ * @var \Magento\Backend\Model\Session|MockObject
*/
private $sessionMock;
/**
- * @var \Magento\Framework\App\ActionFlag|\PHPUnit_Framework_MockObject_MockObject
+ * @var \Magento\Framework\App\ActionFlag|MockObject
*/
private $actionFlagMock;
/**
- * @var \Magento\Backend\Helper\Data|\PHPUnit_Framework_MockObject_MockObject
+ * @var \Magento\Backend\Helper\Data|MockObject
*/
private $helperMock;
+ /**
+ * @inheritdoc
+ */
protected function setUp()
{
- $this->requestMock = $this->getMockBuilder('Magento\Framework\App\Request\Http')
+ $this->requestMock = $this->getMockBuilder(\Magento\Framework\App\Request\Http::class)
->disableOriginalConstructor()
->getMock();
- $this->responseMock = $this->getMockBuilder('Magento\Framework\App\Response\Http')
+ $this->responseMock = $this->getMockBuilder(\Magento\Framework\App\Response\Http::class)
->disableOriginalConstructor()
->getMock();
- $this->contextMock = $this->getMockBuilder('Magento\Backend\App\Action\Context')
+ $this->contextMock = $this->getMockBuilder(\Magento\Backend\App\Action\Context::class)
->disableOriginalConstructor()
->getMock();
$this->uiFactoryMock = $this->getMockBuilder(\Magento\Framework\View\Element\UiComponentFactory::class)
@@ -110,38 +114,23 @@ public function testExecuteAjaxRequest()
$name = 'test-name';
$renderedData = 'data';
- $this->requestMock->expects($this->any())
- ->method('getParam')
- ->with('namespace')
- ->willReturn($name);
- $this->requestMock->expects($this->any())
- ->method('getParams')
- ->willReturn([]);
- $this->responseMock->expects($this->once())
- ->method('appendBody')
- ->with($renderedData);
+ $this->prepareComponent($name, $renderedData);
- /**
- * @var \Magento\Framework\View\Element\UiComponentInterface|\PHPUnit_Framework_MockObject_MockObject $viewMock
- */
- $viewMock = $this->getMockForAbstractClass(
- 'Magento\Framework\View\Element\UiComponentInterface',
- [],
- '',
- false,
- true,
- true,
- ['render']
- );
- $viewMock->expects($this->once())
- ->method('render')
- ->willReturn($renderedData);
- $viewMock->expects($this->once())
- ->method('getChildComponents')
- ->willReturn([]);
- $this->uiFactoryMock->expects($this->once())
- ->method('create')
- ->willReturn($viewMock);
+ $this->responseMock->expects($this->never())->method('setHeader');
+
+ $this->render->executeAjaxRequest();
+ }
+
+ public function testExecuteAjaxJsonRequest()
+ {
+ $name = 'test-name';
+ $renderedData = '{"data": "test"}';
+
+ $this->prepareComponent($name, $renderedData, 'json');
+
+ $this->responseMock->expects($this->once())
+ ->method('setHeader')
+ ->with('Content-Type', 'application/json');
$this->render->executeAjaxRequest();
}
@@ -160,9 +149,6 @@ public function testExecuteAjaxRequestWithoutPermissions($acl, $isAllowed)
->method('getParam')
->with('namespace')
->willReturn($name);
- $this->requestMock->expects($this->any())
- ->method('getParams')
- ->willReturn([]);
$this->responseMock->expects($this->any())
->method('appendBody')
->with($renderedData);
@@ -180,6 +166,12 @@ public function testExecuteAjaxRequestWithoutPermissions($acl, $isAllowed)
true,
['render']
);
+
+ $contextMock = $this->getMockBuilder(\Magento\Framework\View\Element\UiComponent\ContextInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $contextMock->expects($this->any())->method('getAcceptType')->willReturn('html');
+
$componentMock->expects($this->any())
->method('render')
->willReturn($renderedData);
@@ -190,6 +182,9 @@ public function testExecuteAjaxRequestWithoutPermissions($acl, $isAllowed)
->method('getData')
->with('acl')
->willReturn($acl);
+ $componentMock->expects($this->any())
+ ->method('getContext')
+ ->willReturn($contextMock);
$this->uiFactoryMock->expects($this->once())
->method('create')
->willReturn($componentMock);
@@ -208,4 +203,53 @@ public function executeAjaxRequestWithoutPermissionsDataProvider()
['', null],
];
}
+
+ /**
+ * Prepares component mock.
+ *
+ * @param string $namespace
+ * @param string $renderedData
+ * @param string $acceptType
+ * @return \Magento\Framework\View\Element\UiComponentInterface|MockObject
+ */
+ private function prepareComponent($namespace, $renderedData, $acceptType = 'html')
+ {
+ $this->requestMock->expects($this->any())
+ ->method('getParam')
+ ->with('namespace')
+ ->willReturn($namespace);
+ $this->responseMock->expects($this->once())
+ ->method('appendBody')
+ ->with($renderedData);
+
+ /** @var \Magento\Framework\View\Element\UiComponentInterface|MockObject $componentMock */
+ $componentMock = $this->getMockForAbstractClass(
+ \Magento\Framework\View\Element\UiComponentInterface::class,
+ [],
+ '',
+ false,
+ true,
+ true,
+ ['render']
+ );
+ $contextMock = $this->getMockBuilder(\Magento\Framework\View\Element\UiComponent\ContextInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $contextMock->expects($this->once())->method('getAcceptType')->willReturn($acceptType);
+
+ $componentMock->expects($this->once())
+ ->method('render')
+ ->willReturn($renderedData);
+ $componentMock->expects($this->once())
+ ->method('getChildComponents')
+ ->willReturn([]);
+ $componentMock->expects($this->once())
+ ->method('getContext')
+ ->willReturn($contextMock);
+ $this->uiFactoryMock->expects($this->once())
+ ->method('create')
+ ->willReturn($componentMock);
+
+ return $componentMock;
+ }
}
diff --git a/app/code/Magento/Ui/composer.json b/app/code/Magento/Ui/composer.json
index 673edb6174190..c9bc0aa0d64ee 100644
--- a/app/code/Magento/Ui/composer.json
+++ b/app/code/Magento/Ui/composer.json
@@ -10,7 +10,7 @@
"magento/module-user": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.9",
+ "version": "100.1.11",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Ui/etc/di.xml b/app/code/Magento/Ui/etc/di.xml
index bb29515777576..3b9803b72e26d 100644
--- a/app/code/Magento/Ui/etc/di.xml
+++ b/app/code/Magento/Ui/etc/di.xml
@@ -197,6 +197,7 @@
+ - Magento\Framework\Data\Argument\Interpreter\Constant
- configurableObjectArgumentInterpreterProxy
- configurableObjectArgumentInterpreterProxy
- arrayArgumentInterpreterProxy
diff --git a/app/code/Magento/Ui/i18n/en_US.csv b/app/code/Magento/Ui/i18n/en_US.csv
index f7f5b845ef8b6..109bebf1c836a 100644
--- a/app/code/Magento/Ui/i18n/en_US.csv
+++ b/app/code/Magento/Ui/i18n/en_US.csv
@@ -109,3 +109,25 @@ Ok,Ok
Action,Action
CSV,CSV
"Excel XML","Excel XML"
+"Please select one of the options above.","Please select one of the options above."
+"Please select a file.","Please select a file."
+"Please select one of the options.","Please select one of the options."
+"Please enter a value less than or equal to %s.","Please enter a value less than or equal to %s."
+"Please enter a value greater than or equal to %s.","Please enter a value greater than or equal to %s."
+"Card type does not match credit card number.","Card type does not match credit card number."
+"Credit card number does not match credit card type.","Credit card number does not match credit card type."
+"Incorrect credit card expiration date.","Incorrect credit card expiration date."
+"Please enter less or equal than %1 symbols.","Please enter less or equal than %1 symbols."
+"Please enter more or equal than %1 symbols.","Please enter more or equal than %1 symbols."
+"Please enter a valid value from list","Please enter a valid value from list"
+"Please enter valid SKU key.","Please enter valid SKU key."
+"Please enter a valid number.","Please enter a valid number."
+"Admin is a required field in the each row.","Admin is a required field in the each row."
+"Please fix this field.","Please fix this field."
+"Please enter a valid date (ISO).","Please enter a valid date (ISO)."
+"Please enter only digits.","Please enter only digits."
+"Please enter the same value again.","Please enter the same value again."
+"Please enter no more than {0} characters.","Please enter no more than {0} characters."
+"Please enter at least {0} characters.","Please enter at least {0} characters."
+"Please enter a value between {0} and {1} characters long.","Please enter a value between {0} and {1} characters long."
+"Please enter a value between {0} and {1}.","Please enter a value between {0} and {1}."
diff --git a/app/code/Magento/Ui/view/base/web/js/form/components/html.js b/app/code/Magento/Ui/view/base/web/js/form/components/html.js
index 4a13c1ae7e641..67954b23ee821 100644
--- a/app/code/Magento/Ui/view/base/web/js/form/components/html.js
+++ b/app/code/Magento/Ui/view/base/web/js/form/components/html.js
@@ -16,7 +16,10 @@ define([
loading: false,
visible: true,
template: 'ui/content/content',
- additionalClasses: {}
+ additionalClasses: {},
+ ignoreTmpls: {
+ content: true
+ }
},
/**
diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/abstract.js b/app/code/Magento/Ui/view/base/web/js/form/element/abstract.js
index c07135b1f246a..a7f2fdbd7d090 100755
--- a/app/code/Magento/Ui/view/base/web/js/form/element/abstract.js
+++ b/app/code/Magento/Ui/view/base/web/js/form/element/abstract.js
@@ -205,7 +205,7 @@ define([
},
/**
- * Sets 'value' as 'hidden' propertie's value, triggers 'toggle' event,
+ * Sets 'value' as 'hidden' property's value, triggers 'toggle' event,
* sets instance's hidden identifier in params storage based on
* 'value'.
*
diff --git a/app/code/Magento/Ui/view/base/web/js/form/form.js b/app/code/Magento/Ui/view/base/web/js/form/form.js
index 81cae4910d58b..0114e0e7cb921 100644
--- a/app/code/Magento/Ui/view/base/web/js/form/form.js
+++ b/app/code/Magento/Ui/view/base/web/js/form/form.js
@@ -38,7 +38,8 @@ define([
* @returns {Object}
*/
function collectData(items) {
- var result = {};
+ var result = {},
+ name;
items = Array.prototype.slice.call(items);
@@ -54,6 +55,11 @@ define([
}
break;
+ case 'select-multiple':
+ name = item.name.substring(0, item.name.length - 2); //remove [] from the name ending
+ result[name] = _.pluck(item.selectedOptions, 'value');
+ break;
+
default:
result[item.name] = item.value;
}
diff --git a/app/code/Magento/Ui/view/base/web/js/form/provider.js b/app/code/Magento/Ui/view/base/web/js/form/provider.js
index a496d05d0d53c..3c40c75105e75 100644
--- a/app/code/Magento/Ui/view/base/web/js/form/provider.js
+++ b/app/code/Magento/Ui/view/base/web/js/form/provider.js
@@ -17,6 +17,9 @@ define([
save: '${ $.submit_url }',
beforeSave: '${ $.validate_url }'
}
+ },
+ ignoreTmpls: {
+ data: true
}
},
diff --git a/app/code/Magento/Ui/view/base/web/js/grid/provider.js b/app/code/Magento/Ui/view/base/web/js/grid/provider.js
index 75bc13977e564..520f78e169fbb 100644
--- a/app/code/Magento/Ui/view/base/web/js/grid/provider.js
+++ b/app/code/Magento/Ui/view/base/web/js/grid/provider.js
@@ -27,6 +27,9 @@ define([
listens: {
params: 'onParamsChange',
requestConfig: 'updateRequestConfig'
+ },
+ ignoreTmpls: {
+ data: true
}
},
diff --git a/app/code/Magento/Ui/view/base/web/js/lib/core/class.js b/app/code/Magento/Ui/view/base/web/js/lib/core/class.js
index aae3ca31bf803..5bfa87e650271 100644
--- a/app/code/Magento/Ui/view/base/web/js/lib/core/class.js
+++ b/app/code/Magento/Ui/view/base/web/js/lib/core/class.js
@@ -27,12 +27,12 @@ define([
* Creates constructor function which allows
* initialization without usage of a 'new' operator.
*
- * @param {Object} protoProps - Prototypal propeties of a new consturctor.
- * @param {Function} consturctor
- * @returns {Function} Created consturctor.
+ * @param {Object} protoProps - Prototypal properties of a new constructor.
+ * @param {Function} constructor
+ * @returns {Function} Created constructor.
*/
- function createConstructor(protoProps, consturctor) {
- var UiClass = consturctor;
+ function createConstructor(protoProps, constructor) {
+ var UiClass = constructor;
if (!UiClass) {
@@ -61,7 +61,7 @@ define([
Class = createConstructor({
/**
- * Entry point to the initialization of consturctors' instance.
+ * Entry point to the initialization of constructors' instance.
*
* @param {Object} [options={}]
* @returns {Class} Chainable.
diff --git a/app/code/Magento/Ups/composer.json b/app/code/Magento/Ups/composer.json
index 4ce3e2e20cc12..8f81ad73aa08c 100644
--- a/app/code/Magento/Ups/composer.json
+++ b/app/code/Magento/Ups/composer.json
@@ -13,7 +13,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.4",
+ "version": "100.1.5",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/UrlRewrite/composer.json b/app/code/Magento/UrlRewrite/composer.json
index 639d60653e293..af0be1814df91 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.1.*"
},
"type": "magento2-module",
- "version": "100.1.4",
+ "version": "100.1.5",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/User/Model/Backend/Config/ObserverConfig.php b/app/code/Magento/User/Model/Backend/Config/ObserverConfig.php
index 29c4cc14ed674..e807749b11c32 100644
--- a/app/code/Magento/User/Model/Backend/Config/ObserverConfig.php
+++ b/app/code/Magento/User/Model/Backend/Config/ObserverConfig.php
@@ -72,7 +72,7 @@ public function getAdminPasswordLifetime()
}
/**
- * Get admin maxiumum security failures from config
+ * Get admin maximum security failures from config
*
* @return int
*/
diff --git a/app/code/Magento/User/composer.json b/app/code/Magento/User/composer.json
index 7d207ffbaf86d..e7e39cea332f0 100644
--- a/app/code/Magento/User/composer.json
+++ b/app/code/Magento/User/composer.json
@@ -12,7 +12,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.4",
+ "version": "100.1.5",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Usps/Model/Carrier.php b/app/code/Magento/Usps/Model/Carrier.php
index 918990cc5a1a6..da08a110fb0b5 100644
--- a/app/code/Magento/Usps/Model/Carrier.php
+++ b/app/code/Magento/Usps/Model/Carrier.php
@@ -356,6 +356,15 @@ public function getResult()
return $this->_result;
}
+ /**
+ * @inheritdoc
+ * Starting from 23.02.2018 USPS doesn't allow to create free shipping labels via their API.
+ */
+ public function isShippingLabelsAvailable()
+ {
+ return false;
+ }
+
/**
* Get quotes
*
@@ -1414,6 +1423,8 @@ protected function _filterServiceName($name)
*
* @param \Magento\Framework\DataObject $request
* @return string
+ * @deprecated This method should not be used anymore.
+ * @see \Magento\Usps\Model\Carrier::_doShipmentRequest method doc block.
*/
protected function _formUsExpressShipmentRequest(\Magento\Framework\DataObject $request)
{
@@ -1589,6 +1600,8 @@ protected function _convertPoundOunces($weightInPounds)
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ * @deprecated Should not be used anymore.
+ * @see \Magento\Usps\Model\Carrier::_doShipmentRequest doc block.
*/
protected function _formIntlShipmentRequest(\Magento\Framework\DataObject $request)
{
@@ -1842,6 +1855,8 @@ protected function _formIntlShipmentRequest(\Magento\Framework\DataObject $reque
* @param \Magento\Framework\DataObject $request
* @return \Magento\Framework\DataObject
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
+ * @deprecated This method must not be used anymore. Starting from 23.02.2018 USPS elimates API usage for
+ * free shipping labels generating.
*/
protected function _doShipmentRequest(\Magento\Framework\DataObject $request)
{
diff --git a/app/code/Magento/Usps/composer.json b/app/code/Magento/Usps/composer.json
index c7226f5dfb3be..09fa8ed8b7445 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.1.4",
+ "version": "100.1.6",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Variable/Model/Variable.php b/app/code/Magento/Variable/Model/Variable.php
index c96b4ab0720bc..dc06435576c32 100644
--- a/app/code/Magento/Variable/Model/Variable.php
+++ b/app/code/Magento/Variable/Model/Variable.php
@@ -61,7 +61,7 @@ public function __construct(
protected function _construct()
{
parent::_construct();
- $this->_init('Magento\Variable\Model\ResourceModel\Variable');
+ $this->_init(\Magento\Variable\Model\ResourceModel\Variable::class);
}
/**
@@ -154,7 +154,7 @@ public function getVariablesOptionArray($withGroup = false)
foreach ($collection->toOptionArray() as $variable) {
$variables[] = [
'value' => '{{customVar code=' . $variable['value'] . '}}',
- 'label' => __('%1', $variable['label']),
+ 'label' => __('%1', $this->_escaper->escapeHtml($variable['label'])),
];
}
if ($withGroup && $variables) {
diff --git a/app/code/Magento/Variable/Test/Unit/Model/VariableTest.php b/app/code/Magento/Variable/Test/Unit/Model/VariableTest.php
index 78d4570c9943e..bc99f4af6ad78 100644
--- a/app/code/Magento/Variable/Test/Unit/Model/VariableTest.php
+++ b/app/code/Magento/Variable/Test/Unit/Model/VariableTest.php
@@ -12,10 +12,10 @@ class VariableTest extends \PHPUnit_Framework_TestCase
/** @var \Magento\Variable\Model\Variable */
private $model;
- /** @var \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \PHPUnit_Framework_MockObject_MockObject */
private $escaperMock;
- /** @var \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \PHPUnit_Framework_MockObject_MockObject */
private $resourceMock;
/** @var \Magento\Framework\Phrase */
@@ -27,17 +27,17 @@ class VariableTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$this->objectManager = new ObjectManager($this);
- $this->escaperMock = $this->getMockBuilder('Magento\Framework\Escaper')
+ $this->escaperMock = $this->getMockBuilder(\Magento\Framework\Escaper::class)
->disableOriginalConstructor()
->getMock();
- $this->resourceMock = $this->getMockBuilder('Magento\Variable\Model\ResourceModel\Variable')
+ $this->resourceMock = $this->getMockBuilder(\Magento\Variable\Model\ResourceModel\Variable::class)
->disableOriginalConstructor()
->getMock();
$this->model = $this->objectManager->getObject(
- 'Magento\Variable\Model\Variable',
+ \Magento\Variable\Model\Variable::class,
[
'escaper' => $this->escaperMock,
- 'resource' => $this->resourceMock
+ 'resource' => $this->resourceMock,
]
);
$this->validationFailedPhrase = __('Validation has failed.');
@@ -99,63 +99,6 @@ public function testValidate($variableArray, $objectId, $expectedResult)
$this->assertEquals($expectedResult, $this->model->validate($variableArray));
}
- public function testGetVariablesOptionArrayNoGroup()
- {
- $origOptions = [
- ['value' => 'VAL', 'label' => 'LBL',]
- ];
-
- $transformedOptions = [
- ['value' => '{{customVar code=VAL}}', 'label' => __('%1', 'LBL')]
- ];
-
- $collectionMock = $this->getMockBuilder('\Magento\Variable\Model\ResourceModel\Variable\Collection')
- ->disableOriginalConstructor()
- ->getMock();
- $collectionMock->expects($this->any())
- ->method('toOptionArray')
- ->willReturn($origOptions);
- $mockVariable = $this->getMock(
- 'Magento\Variable\Model\Variable',
- ['getCollection'],
- $this->objectManager->getConstructArguments('Magento\Variable\Model\Variable')
- );
- $mockVariable->expects($this->any())
- ->method('getCollection')
- ->willReturn($collectionMock);
- $this->assertEquals($transformedOptions, $mockVariable->getVariablesOptionArray());
- }
-
- public function testGetVariablesOptionArrayWithGroup()
- {
- $origOptions = [
- ['value' => 'VAL', 'label' => 'LBL',]
- ];
-
- $transformedOptions = [
- 'label' => __('Custom Variables'),
- 'value' => [
- ['value' => '{{customVar code=VAL}}', 'label' => __('%1', 'LBL')]
- ]
- ];
-
- $collectionMock = $this->getMockBuilder('\Magento\Variable\Model\ResourceModel\Variable\Collection')
- ->disableOriginalConstructor()
- ->getMock();
- $collectionMock->expects($this->any())
- ->method('toOptionArray')
- ->willReturn($origOptions);
- $mockVariable = $this->getMock(
- 'Magento\Variable\Model\Variable',
- ['getCollection'],
- $this->objectManager->getConstructArguments('Magento\Variable\Model\Variable')
- );
- $mockVariable->expects($this->any())
- ->method('getCollection')
- ->willReturn($collectionMock);
- $this->assertEquals($transformedOptions, $mockVariable->getVariablesOptionArray(true));
- }
-
public function validateDataProvider()
{
$variable = [
diff --git a/app/code/Magento/Variable/composer.json b/app/code/Magento/Variable/composer.json
index 63a4be3777299..fa5318c980c71 100644
--- a/app/code/Magento/Variable/composer.json
+++ b/app/code/Magento/Variable/composer.json
@@ -9,7 +9,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.2",
+ "version": "100.1.4",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Vault/composer.json b/app/code/Magento/Vault/composer.json
index 3618ffda9f043..ad4be58226e51 100644
--- a/app/code/Magento/Vault/composer.json
+++ b/app/code/Magento/Vault/composer.json
@@ -13,7 +13,7 @@
"magento/module-theme": "100.1.*"
},
"type": "magento2-module",
- "version": "100.2.2",
+ "version": "100.2.3",
"license": [
"proprietary"
],
diff --git a/app/code/Magento/Version/Controller/Index/Index.php b/app/code/Magento/Version/Controller/Index/Index.php
index 4314676c479f9..6e2c094e448c4 100644
--- a/app/code/Magento/Version/Controller/Index/Index.php
+++ b/app/code/Magento/Version/Controller/Index/Index.php
@@ -9,7 +9,6 @@
use Magento\Framework\App\Action\Action;
use Magento\Framework\App\Action\Context;
use Magento\Framework\App\ProductMetadataInterface;
-use Magento\Framework\Exception\StateException;
/**
* Magento Version controller
diff --git a/app/code/Magento/Version/composer.json b/app/code/Magento/Version/composer.json
index bed6c5367eb80..00fa9a97d4b2c 100644
--- a/app/code/Magento/Version/composer.json
+++ b/app/code/Magento/Version/composer.json
@@ -6,7 +6,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.2",
+ "version": "100.1.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 b4726720cb731..f935fd12cee64 100644
--- a/app/code/Magento/Webapi/composer.json
+++ b/app/code/Magento/Webapi/composer.json
@@ -14,7 +14,7 @@
"magento/module-customer": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.5",
+ "version": "100.1.6",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/WebapiSecurity/composer.json b/app/code/Magento/WebapiSecurity/composer.json
index a937fd11b9eb2..e99e5626b9246 100644
--- a/app/code/Magento/WebapiSecurity/composer.json
+++ b/app/code/Magento/WebapiSecurity/composer.json
@@ -7,7 +7,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.2",
+ "version": "100.1.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Weee/composer.json b/app/code/Magento/Weee/composer.json
index 5e0b95168269f..24e694f1108fe 100644
--- a/app/code/Magento/Weee/composer.json
+++ b/app/code/Magento/Weee/composer.json
@@ -18,7 +18,7 @@
"magento/module-ui": "100.1.*"
},
"type": "magento2-module",
- "version": "100.1.2",
+ "version": "100.1.3",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Widget/Model/Config/Converter.php b/app/code/Magento/Widget/Model/Config/Converter.php
index 894d63ad4cc57..010c46da56950 100644
--- a/app/code/Magento/Widget/Model/Config/Converter.php
+++ b/app/code/Magento/Widget/Model/Config/Converter.php
@@ -44,7 +44,7 @@ public function convert($source)
case 'parameters':
/** @var $parameter \DOMNode */
foreach ($widgetSubNode->childNodes as $parameter) {
- if ($parameter->nodeName === '#text') {
+ if ($parameter->nodeName === '#text' || $parameter->nodeName === '#comment') {
continue;
}
$subNodeAttributes = $parameter->attributes;
@@ -57,7 +57,7 @@ public function convert($source)
$widgetArray['supported_containers'] = [];
}
foreach ($widgetSubNode->childNodes as $container) {
- if ($container->nodeName === '#text') {
+ if ($container->nodeName === '#text' || $container->nodeName === '#comment') {
continue;
}
$widgetArray['supported_containers'] = array_merge(
diff --git a/app/code/Magento/Widget/Test/Unit/Model/_files/widget.xml b/app/code/Magento/Widget/Test/Unit/Model/_files/widget.xml
index 0a3ace9463557..02e65707d322f 100644
--- a/app/code/Magento/Widget/Test/Unit/Model/_files/widget.xml
+++ b/app/code/Magento/Widget/Test/Unit/Model/_files/widget.xml
@@ -11,6 +11,7 @@
Orders and Returns
Orders and Returns Search Form
+
Anchor Custom Title
@@ -54,6 +55,7 @@
+
diff --git a/app/code/Magento/Widget/composer.json b/app/code/Magento/Widget/composer.json
index 307cb6007d6da..54bcddc835670 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.1.*"
},
"type": "magento2-module",
- "version": "100.1.6",
+ "version": "100.1.7",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/Wishlist/composer.json b/app/code/Magento/Wishlist/composer.json
index 1c0cade018a4e..4bf6895b01b79 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.1.*"
},
"type": "magento2-module",
- "version": "100.1.7",
+ "version": "100.1.8",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/design/adminhtml/Magento/backend/Magento_ConfigurableProduct/web/css/source/module/components/_currency-addon.less b/app/design/adminhtml/Magento/backend/Magento_ConfigurableProduct/web/css/source/module/components/_currency-addon.less
index 0c33b8d3b8a02..65f8afbce0df0 100644
--- a/app/design/adminhtml/Magento/backend/Magento_ConfigurableProduct/web/css/source/module/components/_currency-addon.less
+++ b/app/design/adminhtml/Magento/backend/Magento_ConfigurableProduct/web/css/source/module/components/_currency-addon.less
@@ -18,10 +18,29 @@
.currency-addon {
position: relative;
+ border: 1px solid #adadad;
+ display: -webkit-inline-flex;
+ display: -ms-inline-flexbox;
+ -webkit-flex-direction: row;
+ -ms-flex-direction: row;
+ flex-direction: row;
+ display: inline-flex;
+ flex-flow: row nowrap;
+ width: 100%;
.admin__control-text {
- border-width: 1px 1px 1px 0;
- padding-left: @currency-addon-symbol__width + .2;
+ appearence: none;
+ -webkit-flex-grow: 1;
+ flex-grow: 1;
+ -ms-flex-order: 1;
+ -webkit-order: 1;
+ order: 1;
+ -webkit-flex-shrink: 1;
+ flex-shrink: 1;
+ background-color: transparent;
+ border-color: transparent;
+ box-shadow: none;
+ vertical-align: top;
&:focus {
+ .currency-symbol {
@@ -30,18 +49,29 @@
}
}
+ label.error {
+ position: absolute;
+ left: 0;
+ top: 33px;
+ }
+
.currency-symbol {
border: solid @currency-addon-symbol__border-color;
- border-width: 0 0 0 1px;
+ border-width: 0;
box-sizing: border-box;
color: @currency-addon-symbol__color;
height: @currency-addon-symbol__height;
- left: 0;
padding: 7px 0 0 @indent__xs;
- position: absolute;
- top: 0;
transition: @smooth__border-color;
- width: @currency-addon-symbol__width;
+ position: static;
+ -webkit-flex-basis: auto;
+ flex-basis: auto;
+ -webkit-flex-grow: 0;
+ flex-grow: 0;
+ -webkit-flex-shrink: 0;
+ flex-shrink: 0;
+ z-index: 1;
+ order: 0;
}
._error & {
diff --git a/app/design/adminhtml/Magento/backend/composer.json b/app/design/adminhtml/Magento/backend/composer.json
index d92f18488f3b9..943ed7a3de9dc 100644
--- a/app/design/adminhtml/Magento/backend/composer.json
+++ b/app/design/adminhtml/Magento/backend/composer.json
@@ -6,7 +6,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-theme",
- "version": "100.1.3",
+ "version": "100.1.4",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/design/adminhtml/Magento/backend/web/css/source/variables/_spinner.less b/app/design/adminhtml/Magento/backend/web/css/source/variables/_spinner.less
index 09baf498cbcf4..60b84b1f467fe 100644
--- a/app/design/adminhtml/Magento/backend/web/css/source/variables/_spinner.less
+++ b/app/design/adminhtml/Magento/backend/web/css/source/variables/_spinner.less
@@ -26,4 +26,4 @@
@spinner-rotate-step: 45;
// One step in degree
-@spinner-delay: .9;
+@spinner-delay: .9s;
diff --git a/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/_minicart.less b/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/_minicart.less
index e166b549f141e..9d13249a5b86d 100644
--- a/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/_minicart.less
+++ b/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/_minicart.less
@@ -106,6 +106,10 @@
.lib-dropdown(
@_toggle-selector: ~'.action.showcart',
@_options-selector: ~'.block-minicart',
+ @_dropdown-list-width: 320px,
+ @_dropdown-list-position-right: 0px,
+ @_dropdown-list-pointer-position: right,
+ @_dropdown-list-pointer-position-left-right: 26px,
@_dropdown-toggle-icon-content: @icon-cart,
@_dropdown-toggle-active-icon-content: @icon-cart,
@_dropdown-list-item-padding: false,
@@ -121,22 +125,10 @@
.block-minicart {
.lib-css(padding, 25px @minicart__padding-horizontal);
- right: 0;
- width: 320px;
.block-title {
display: none;
}
-
- &:after {
- left: auto;
- right: 25px;
- }
-
- &:before {
- left: auto;
- right: 26px;
- }
}
.product {
@@ -246,7 +238,6 @@
.product-item-pricing {
.label {
display: inline-block;
- width: 4.5rem;
}
}
diff --git a/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/checkout/_payments.less b/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/checkout/_payments.less
index c58cfcd734e7d..5f8134193c67f 100644
--- a/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/checkout/_payments.less
+++ b/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/checkout/_payments.less
@@ -162,6 +162,11 @@
.lib-css(margin, 0 -(@checkout-payment-method-title-mobile__padding));
}
+ .step-title {
+ .lib-css(padding-left, @checkout-payment-method-title-mobile__padding);
+ .lib-css(padding-right, @checkout-payment-method-title-mobile__padding)
+ }
+
.payment-method-title {
.lib-css(padding, @checkout-payment-method-title-mobile__padding)
}
diff --git a/app/design/frontend/Magento/blank/composer.json b/app/design/frontend/Magento/blank/composer.json
index a9b0f41c244ae..57dac63f88f9e 100644
--- a/app/design/frontend/Magento/blank/composer.json
+++ b/app/design/frontend/Magento/blank/composer.json
@@ -6,7 +6,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-theme",
- "version": "100.1.7",
+ "version": "100.1.8",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/design/frontend/Magento/blank/web/css/source/_email-base.less b/app/design/frontend/Magento/blank/web/css/source/_email-base.less
index 1cdae848ec318..8ecc480a84775 100644
--- a/app/design/frontend/Magento/blank/web/css/source/_email-base.less
+++ b/app/design/frontend/Magento/blank/web/css/source/_email-base.less
@@ -238,7 +238,7 @@ body {
a:visited {
// Undo general link hover state
border: 1px solid @button-primary__hover__background;
- color: @button-primary__color !important;
+ color: @button-primary__hover__color !important;
text-decoration: none !important;
}
}
diff --git a/app/design/frontend/Magento/blank/web/css/source/_extends.less b/app/design/frontend/Magento/blank/web/css/source/_extends.less
index 19c76d2feb454..58adadf8f1a82 100644
--- a/app/design/frontend/Magento/blank/web/css/source/_extends.less
+++ b/app/design/frontend/Magento/blank/web/css/source/_extends.less
@@ -1232,7 +1232,7 @@
}
}
-.media-width(@extremum, @break) when (@extremum = 'max') and (@break = (@screen__m + 1)) {
+.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
.abs-checkout-tooltip-content-position-top-mobile {
@abs-checkout-tooltip-content-position-top();
}
diff --git a/app/design/frontend/Magento/blank/web/css/source/_navigation.less b/app/design/frontend/Magento/blank/web/css/source/_navigation.less
index 4d403f6492321..2060b0544470b 100644
--- a/app/design/frontend/Magento/blank/web/css/source/_navigation.less
+++ b/app/design/frontend/Magento/blank/web/css/source/_navigation.less
@@ -93,7 +93,7 @@
.switcher {
border-top: 1px solid @color-gray82;
font-size: 1.6rem;
- font-weight: 700;
+ font-weight: @font-weight__bold;
margin: 0;
padding: .8rem 3.5rem .8rem 2rem;
@@ -147,7 +147,7 @@
&.greet.welcome {
border-top: 1px solid @color-gray82;
- font-weight: 700;
+ font-weight: @font-weight__bold;
padding: .8rem @indent__base;
}
@@ -161,7 +161,7 @@
.lib-css(color, @navigation-level0-item__color);
.lib-css(text-decoration, @navigation-level0-item__text-decoration);
display: block;
- font-weight: 700;
+ font-weight: @font-weight__bold;
padding: .8rem @indent__base;
}
diff --git a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less
index e76aacf2b3293..c64efa65ae2f9 100644
--- a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less
+++ b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less
@@ -189,10 +189,6 @@
&:last-child {
margin-bottom: 0;
}
-
- &._hidden {
- display: none;
- }
}
}
}
diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less
index b1dc3e6c426bb..3f26e87c34be2 100644
--- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less
+++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less
@@ -109,6 +109,10 @@
.lib-dropdown(
@_toggle-selector: ~'.action.showcart',
@_options-selector: ~'.block-minicart',
+ @_dropdown-list-width: 320px,
+ @_dropdown-list-position-right: 0px,
+ @_dropdown-list-pointer-position: right,
+ @_dropdown-list-pointer-position-left-right: 26px,
@_dropdown-toggle-icon-content: @icon-cart,
@_dropdown-toggle-active-icon-content: @icon-cart,
@_dropdown-list-item-padding: false,
@@ -124,22 +128,10 @@
.block-minicart {
.lib-css(padding, 25px @minicart__padding-horizontal);
- right: 0;
- width: 320px;
.block-title {
display: none;
}
-
- &:after {
- left: auto;
- right: 25px;
- }
-
- &:before {
- left: auto;
- right: 26px;
- }
}
.product {
.actions {
@@ -251,7 +243,6 @@
.product-item-pricing {
.label {
display: inline-block;
- width: 4.5rem;
}
}
diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_payments.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_payments.less
index 087f9c9fe6554..3136056d9426d 100644
--- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_payments.less
+++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_payments.less
@@ -162,6 +162,11 @@
.lib-css(margin, 0 -(@checkout-payment-method-title-mobile__padding));
}
+ .step-title {
+ .lib-css(padding-left, @checkout-payment-method-title-mobile__padding);
+ .lib-css(padding-right, @checkout-payment-method-title-mobile__padding)
+ }
+
.payment-method-title {
.lib-css(padding, @checkout-payment-method-title-mobile__padding)
}
diff --git a/app/design/frontend/Magento/luma/composer.json b/app/design/frontend/Magento/luma/composer.json
index c384fca399c73..689a3b69ec652 100644
--- a/app/design/frontend/Magento/luma/composer.json
+++ b/app/design/frontend/Magento/luma/composer.json
@@ -7,7 +7,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-theme",
- "version": "100.1.7",
+ "version": "100.1.8",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/design/frontend/Magento/luma/web/css/source/_extends.less b/app/design/frontend/Magento/luma/web/css/source/_extends.less
index c2a3e7dbd8392..20fa098ba2c4a 100644
--- a/app/design/frontend/Magento/luma/web/css/source/_extends.less
+++ b/app/design/frontend/Magento/luma/web/css/source/_extends.less
@@ -1673,7 +1673,7 @@
}
}
-.media-width(@extremum, @break) when (@extremum = 'max') and (@break = (@screen__m + 1)) {
+.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
.abs-checkout-tooltip-content-position-top-mobile {
@abs-checkout-tooltip-content-position-top();
}
diff --git a/app/i18n/Magento/de_DE/composer.json b/app/i18n/Magento/de_DE/composer.json
index 69754a3d36275..87fc7768723ef 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.1.1",
+ "version": "100.1.2",
"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 e6a0dce3ca405..07a53bd955369 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.1.1",
+ "version": "100.1.2",
"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 0d4730969311c..b8864fdee92d2 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.1.1",
+ "version": "100.1.2",
"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 2f9b6693bc356..92e7b98e3f2b4 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.1.1",
+ "version": "100.1.2",
"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 bb7ae85ee1231..d3ee1f1b0f10b 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.1.1",
+ "version": "100.1.2",
"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 8e5615bcb80ca..a786aade7d7d3 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.1.1",
+ "version": "100.1.2",
"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 6072102fb3b35..b277e6c1bea08 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.1.1",
+ "version": "100.1.2",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/composer.json b/composer.json
index d2b38e732589f..e7a1b5669466d 100644
--- a/composer.json
+++ b/composer.json
@@ -2,7 +2,7 @@
"name": "magento/magento2ce",
"description": "Magento 2 (Community Edition)",
"type": "project",
- "version": "2.1.13-dev",
+ "version": "2.1.15-dev",
"license": [
"OSL-3.0",
"AFL-3.0"
@@ -76,121 +76,121 @@
"sebastian/phpcpd": "2.0.0"
},
"replace": {
- "magento/module-marketplace": "100.1.2",
- "magento/module-admin-notification": "100.1.3",
- "magento/module-advanced-pricing-import-export": "100.1.3",
- "magento/module-authorization": "100.1.2",
- "magento/module-authorizenet": "100.1.6",
- "magento/module-backend": "100.1.6",
- "magento/module-backup": "100.1.4",
- "magento/module-braintree": "100.1.8",
- "magento/module-bundle": "100.1.6",
- "magento/module-bundle-import-export": "100.1.4",
- "magento/module-cache-invalidate": "100.1.3",
- "magento/module-captcha": "100.1.3",
- "magento/module-catalog": "101.0.11",
- "magento/module-catalog-import-export": "100.1.8",
- "magento/module-catalog-inventory": "100.1.7",
- "magento/module-catalog-rule": "100.1.5",
- "magento/module-catalog-rule-configurable": "100.1.3",
- "magento/module-catalog-search": "100.1.8",
- "magento/module-catalog-url-rewrite": "100.1.5",
- "magento/module-catalog-widget": "100.1.4",
- "magento/module-checkout": "100.1.10",
- "magento/module-checkout-agreements": "100.1.3",
- "magento/module-cms": "101.0.9",
- "magento/module-cms-url-rewrite": "100.1.3",
- "magento/module-config": "100.1.7",
- "magento/module-configurable-import-export": "100.1.3",
- "magento/module-configurable-product": "100.1.11",
- "magento/module-contact": "100.1.3",
- "magento/module-cookie": "100.1.3",
- "magento/module-cron": "100.1.4",
- "magento/module-currency-symbol": "100.1.3",
- "magento/module-customer": "100.1.10",
- "magento/module-customer-import-export": "100.1.5",
- "magento/module-deploy": "100.1.6",
- "magento/module-developer": "100.1.3",
- "magento/module-dhl": "100.1.3",
- "magento/module-directory": "100.1.5",
- "magento/module-downloadable": "100.1.4",
- "magento/module-downloadable-import-export": "100.1.2",
- "magento/module-eav": "100.1.8",
- "magento/module-email": "100.1.6",
- "magento/module-encryption-key": "100.1.2",
- "magento/module-fedex": "100.1.4",
- "magento/module-gift-message": "100.1.4",
- "magento/module-google-adwords": "100.1.2",
- "magento/module-google-analytics": "100.1.2",
- "magento/module-google-optimizer": "100.1.2",
- "magento/module-grouped-import-export": "100.1.2",
- "magento/module-grouped-product": "100.1.4",
- "magento/module-import-export": "100.1.6",
- "magento/module-indexer": "100.1.5",
- "magento/module-integration": "100.1.6",
- "magento/module-layered-navigation": "100.1.2",
- "magento/module-media-storage": "100.1.3",
- "magento/module-msrp": "100.1.3",
- "magento/module-multishipping": "100.1.3",
- "magento/module-new-relic-reporting": "100.1.3",
- "magento/module-newsletter": "100.1.5",
- "magento/module-offline-payments": "100.1.2",
- "magento/module-offline-shipping": "100.1.4",
- "magento/module-page-cache": "100.1.5",
- "magento/module-payment": "100.1.8",
- "magento/module-paypal": "100.1.8",
- "magento/module-persistent": "100.1.4",
- "magento/module-product-alert": "100.1.3",
- "magento/module-product-video": "100.1.8",
- "magento/module-quote": "100.1.7",
- "magento/module-reports": "100.1.6",
- "magento/module-require-js": "100.1.3",
- "magento/module-review": "100.1.5",
- "magento/module-robots": "100.1.0",
- "magento/module-rss": "100.1.3",
- "magento/module-rule": "100.1.7",
- "magento/module-sales": "100.1.10",
- "magento/module-sales-rule": "100.1.6",
- "magento/module-sales-inventory": "100.1.1",
- "magento/module-sales-sequence": "100.1.3",
- "magento/module-sample-data": "100.1.4",
- "magento/module-search": "100.1.4",
- "magento/module-security": "100.1.3",
- "magento/module-send-friend": "100.1.2",
- "magento/module-shipping": "100.1.5",
- "magento/module-sitemap": "100.1.5",
- "magento/module-store": "100.1.9",
- "magento/module-swagger": "100.1.2",
- "magento/module-swatches": "100.1.10",
- "magento/module-swatches-layered-navigation": "100.1.2",
- "magento/module-tax": "100.1.4",
- "magento/module-tax-import-export": "100.1.2",
- "magento/module-theme": "100.1.9",
- "magento/module-translation": "100.1.4",
- "magento/module-ui": "100.1.9",
- "magento/module-ups": "100.1.4",
- "magento/module-url-rewrite": "100.1.4",
- "magento/module-user": "100.1.4",
- "magento/module-usps": "100.1.4",
- "magento/module-variable": "100.1.2",
- "magento/module-vault": "100.2.2",
- "magento/module-version": "100.1.2",
- "magento/module-webapi": "100.1.5",
- "magento/module-webapi-security": "100.1.2",
- "magento/module-weee": "100.1.2",
- "magento/module-widget": "100.1.6",
- "magento/module-wishlist": "100.1.7",
- "magento/theme-adminhtml-backend": "100.1.3",
- "magento/theme-frontend-blank": "100.1.7",
- "magento/theme-frontend-luma": "100.1.7",
- "magento/language-de_de": "100.1.1",
- "magento/language-en_us": "100.1.1",
- "magento/language-es_es": "100.1.1",
- "magento/language-fr_fr": "100.1.1",
- "magento/language-nl_nl": "100.1.1",
- "magento/language-pt_br": "100.1.1",
- "magento/language-zh_hans_cn": "100.1.1",
- "magento/framework": "100.1.11",
+ "magento/module-marketplace": "100.1.3",
+ "magento/module-admin-notification": "100.1.4",
+ "magento/module-advanced-pricing-import-export": "100.1.4",
+ "magento/module-authorization": "100.1.3",
+ "magento/module-authorizenet": "100.1.7",
+ "magento/module-backend": "100.1.8",
+ "magento/module-backup": "100.1.6",
+ "magento/module-braintree": "100.1.9",
+ "magento/module-bundle": "100.1.7",
+ "magento/module-bundle-import-export": "100.1.5",
+ "magento/module-cache-invalidate": "100.1.4",
+ "magento/module-captcha": "100.1.4",
+ "magento/module-catalog": "101.0.13",
+ "magento/module-catalog-import-export": "100.1.9",
+ "magento/module-catalog-inventory": "100.1.8",
+ "magento/module-catalog-rule": "100.1.6",
+ "magento/module-catalog-rule-configurable": "100.1.4",
+ "magento/module-catalog-search": "100.1.9",
+ "magento/module-catalog-url-rewrite": "100.1.6",
+ "magento/module-catalog-widget": "100.1.5",
+ "magento/module-checkout": "100.1.12",
+ "magento/module-checkout-agreements": "100.1.4",
+ "magento/module-cms": "101.0.11",
+ "magento/module-cms-url-rewrite": "100.1.4",
+ "magento/module-config": "100.1.8",
+ "magento/module-configurable-import-export": "100.1.4",
+ "magento/module-configurable-product": "100.1.13",
+ "magento/module-contact": "100.1.4",
+ "magento/module-cookie": "100.1.4",
+ "magento/module-cron": "100.1.5",
+ "magento/module-currency-symbol": "100.1.4",
+ "magento/module-customer": "100.1.12",
+ "magento/module-customer-import-export": "100.1.6",
+ "magento/module-deploy": "100.1.7",
+ "magento/module-developer": "100.1.4",
+ "magento/module-dhl": "100.1.4",
+ "magento/module-directory": "100.1.6",
+ "magento/module-downloadable": "100.1.6",
+ "magento/module-downloadable-import-export": "100.1.3",
+ "magento/module-eav": "100.1.10",
+ "magento/module-email": "100.1.7",
+ "magento/module-encryption-key": "100.1.3",
+ "magento/module-fedex": "100.1.5",
+ "magento/module-gift-message": "100.1.5",
+ "magento/module-google-adwords": "100.1.3",
+ "magento/module-google-analytics": "100.1.3",
+ "magento/module-google-optimizer": "100.1.3",
+ "magento/module-grouped-import-export": "100.1.3",
+ "magento/module-grouped-product": "100.1.5",
+ "magento/module-import-export": "100.1.8",
+ "magento/module-indexer": "100.1.6",
+ "magento/module-integration": "100.1.7",
+ "magento/module-layered-navigation": "100.1.3",
+ "magento/module-media-storage": "100.1.4",
+ "magento/module-msrp": "100.1.4",
+ "magento/module-multishipping": "100.1.4",
+ "magento/module-new-relic-reporting": "100.1.4",
+ "magento/module-newsletter": "100.1.7",
+ "magento/module-offline-payments": "100.1.3",
+ "magento/module-offline-shipping": "100.1.5",
+ "magento/module-page-cache": "100.1.6",
+ "magento/module-payment": "100.1.9",
+ "magento/module-paypal": "100.1.9",
+ "magento/module-persistent": "100.1.5",
+ "magento/module-product-alert": "100.1.4",
+ "magento/module-product-video": "100.1.9",
+ "magento/module-quote": "100.1.8",
+ "magento/module-reports": "100.1.8",
+ "magento/module-require-js": "100.1.4",
+ "magento/module-review": "100.1.7",
+ "magento/module-robots": "100.1.1",
+ "magento/module-rss": "100.1.4",
+ "magento/module-rule": "100.1.8",
+ "magento/module-sales": "100.1.11",
+ "magento/module-sales-rule": "100.1.7",
+ "magento/module-sales-inventory": "100.1.2",
+ "magento/module-sales-sequence": "100.1.4",
+ "magento/module-sample-data": "100.1.5",
+ "magento/module-search": "100.1.5",
+ "magento/module-security": "100.1.4",
+ "magento/module-send-friend": "100.1.3",
+ "magento/module-shipping": "100.1.7",
+ "magento/module-sitemap": "100.1.6",
+ "magento/module-store": "100.1.10",
+ "magento/module-swagger": "100.1.3",
+ "magento/module-swatches": "100.1.11",
+ "magento/module-swatches-layered-navigation": "100.1.3",
+ "magento/module-tax": "100.1.5",
+ "magento/module-tax-import-export": "100.1.3",
+ "magento/module-theme": "100.1.10",
+ "magento/module-translation": "100.1.5",
+ "magento/module-ui": "100.1.11",
+ "magento/module-ups": "100.1.5",
+ "magento/module-url-rewrite": "100.1.5",
+ "magento/module-user": "100.1.5",
+ "magento/module-usps": "100.1.6",
+ "magento/module-variable": "100.1.4",
+ "magento/module-vault": "100.2.3",
+ "magento/module-version": "100.1.3",
+ "magento/module-webapi": "100.1.6",
+ "magento/module-webapi-security": "100.1.3",
+ "magento/module-weee": "100.1.3",
+ "magento/module-widget": "100.1.7",
+ "magento/module-wishlist": "100.1.8",
+ "magento/theme-adminhtml-backend": "100.1.4",
+ "magento/theme-frontend-blank": "100.1.8",
+ "magento/theme-frontend-luma": "100.1.8",
+ "magento/language-de_de": "100.1.2",
+ "magento/language-en_us": "100.1.2",
+ "magento/language-es_es": "100.1.2",
+ "magento/language-fr_fr": "100.1.2",
+ "magento/language-nl_nl": "100.1.2",
+ "magento/language-pt_br": "100.1.2",
+ "magento/language-zh_hans_cn": "100.1.2",
+ "magento/framework": "100.1.13",
"trentrichardson/jquery-timepicker-addon": "1.4.3",
"components/jquery": "1.11.0",
"blueimp/jquery-file-upload": "5.6.14",
diff --git a/composer.lock b/composer.lock
index d64d0f0c9f758..85657b45a0128 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "content-hash": "67903290f1ec8b4b0228d88b8e0d5abd",
+ "content-hash": "0a521e8d94a10edef043d49f142491ea",
"packages": [
{
"name": "braintree/braintree_php",
@@ -91,16 +91,16 @@
},
{
"name": "colinmollenhour/cache-backend-redis",
- "version": "1.9",
+ "version": "1.9.0",
"source": {
"type": "git",
"url": "https://github.com/colinmollenhour/Cm_Cache_Backend_Redis.git",
- "reference": "6319714bb3a4fe699c5db0edb887f5e8fe40a6dc"
+ "reference": "155f4dc20240aae06dd5cb8747475f37974d053a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/colinmollenhour/Cm_Cache_Backend_Redis/zipball/6319714bb3a4fe699c5db0edb887f5e8fe40a6dc",
- "reference": "6319714bb3a4fe699c5db0edb887f5e8fe40a6dc",
+ "url": "https://api.github.com/repos/colinmollenhour/Cm_Cache_Backend_Redis/zipball/155f4dc20240aae06dd5cb8747475f37974d053a",
+ "reference": "155f4dc20240aae06dd5cb8747475f37974d053a",
"shasum": ""
},
"require": {
@@ -123,7 +123,7 @@
],
"description": "Zend_Cache backend using Redis with full support for tags.",
"homepage": "https://github.com/colinmollenhour/Cm_Cache_Backend_Redis",
- "time": "2016-05-02T16:23:36+00:00"
+ "time": "2016-10-03T16:55:11+00:00"
},
{
"name": "colinmollenhour/credis",
@@ -341,23 +341,23 @@
},
{
"name": "composer/spdx-licenses",
- "version": "1.1.6",
+ "version": "1.3.0",
"source": {
"type": "git",
"url": "https://github.com/composer/spdx-licenses.git",
- "reference": "2603a0d7ddc00a015deb576fa5297ca43dee6b1c"
+ "reference": "7e111c50db92fa2ced140f5ba23b4e261bc77a30"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/2603a0d7ddc00a015deb576fa5297ca43dee6b1c",
- "reference": "2603a0d7ddc00a015deb576fa5297ca43dee6b1c",
+ "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/7e111c50db92fa2ced140f5ba23b4e261bc77a30",
+ "reference": "7e111c50db92fa2ced140f5ba23b4e261bc77a30",
"shasum": ""
},
"require": {
"php": "^5.3.2 || ^7.0"
},
"require-dev": {
- "phpunit/phpunit": "^4.5 || ^5.0.5",
+ "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5",
"phpunit/phpunit-mock-objects": "2.3.0 || ^3.0"
},
"type": "library",
@@ -398,7 +398,7 @@
"spdx",
"validator"
],
- "time": "2017-04-03T19:08:52+00:00"
+ "time": "2018-01-31T13:17:27+00:00"
},
{
"name": "justinrainbow/json-schema",
@@ -553,16 +553,16 @@
},
{
"name": "magento/magento-composer-installer",
- "version": "0.1.12",
+ "version": "0.1.13",
"source": {
"type": "git",
"url": "https://github.com/magento/magento-composer-installer.git",
- "reference": "10c600e88ad34fec71bb6b435ea8415ce92d51de"
+ "reference": "8b6c32f53b4944a5d6656e86344cd0f9784709a1"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/magento/magento-composer-installer/zipball/10c600e88ad34fec71bb6b435ea8415ce92d51de",
- "reference": "10c600e88ad34fec71bb6b435ea8415ce92d51de",
+ "url": "https://api.github.com/repos/magento/magento-composer-installer/zipball/8b6c32f53b4944a5d6656e86344cd0f9784709a1",
+ "reference": "8b6c32f53b4944a5d6656e86344cd0f9784709a1",
"shasum": ""
},
"require": {
@@ -628,7 +628,7 @@
"composer-installer",
"magento"
],
- "time": "2016-10-06T16:05:07+00:00"
+ "time": "2017-12-29T16:45:24+00:00"
},
{
"name": "magento/zendframework1",
@@ -820,12 +820,12 @@
"version": "v0.1.1",
"source": {
"type": "git",
- "url": "https://github.com/jjriv/emogrifier.git",
+ "url": "https://github.com/MyIntervals/emogrifier.git",
"reference": "ed72bcd6a3c7014862ff86d026193667a172fedf"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/jjriv/emogrifier/zipball/ed72bcd6a3c7014862ff86d026193667a172fedf",
+ "url": "https://api.github.com/repos/MyIntervals/emogrifier/zipball/ed72bcd6a3c7014862ff86d026193667a172fedf",
"reference": "ed72bcd6a3c7014862ff86d026193667a172fedf",
"shasum": ""
},
@@ -873,16 +873,16 @@
},
{
"name": "phpseclib/phpseclib",
- "version": "2.0.9",
+ "version": "2.0.11",
"source": {
"type": "git",
"url": "https://github.com/phpseclib/phpseclib.git",
- "reference": "c9a3fe35e20eb6eeaca716d6a23cde03f52d1558"
+ "reference": "7053f06f91b3de78e143d430e55a8f7889efc08b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/c9a3fe35e20eb6eeaca716d6a23cde03f52d1558",
- "reference": "c9a3fe35e20eb6eeaca716d6a23cde03f52d1558",
+ "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/7053f06f91b3de78e143d430e55a8f7889efc08b",
+ "reference": "7053f06f91b3de78e143d430e55a8f7889efc08b",
"shasum": ""
},
"require": {
@@ -890,7 +890,7 @@
},
"require-dev": {
"phing/phing": "~2.7",
- "phpunit/phpunit": "~4.0",
+ "phpunit/phpunit": "^4.8.35|^5.7|^6.0",
"sami/sami": "~2.0",
"squizlabs/php_codesniffer": "~2.0"
},
@@ -961,7 +961,7 @@
"x.509",
"x509"
],
- "time": "2017-11-29T06:38:08+00:00"
+ "time": "2018-04-15T16:55:05+00:00"
},
{
"name": "psr/log",
@@ -1060,23 +1060,23 @@
},
{
"name": "seld/jsonlint",
- "version": "1.6.2",
+ "version": "1.7.1",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/jsonlint.git",
- "reference": "7a30649c67ee0d19faacfd9fa2cfb6cc032d9b19"
+ "reference": "d15f59a67ff805a44c50ea0516d2341740f81a38"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/7a30649c67ee0d19faacfd9fa2cfb6cc032d9b19",
- "reference": "7a30649c67ee0d19faacfd9fa2cfb6cc032d9b19",
+ "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/d15f59a67ff805a44c50ea0516d2341740f81a38",
+ "reference": "d15f59a67ff805a44c50ea0516d2341740f81a38",
"shasum": ""
},
"require": {
"php": "^5.3 || ^7.0"
},
"require-dev": {
- "phpunit/phpunit": "^4.5"
+ "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0"
},
"bin": [
"bin/jsonlint"
@@ -1105,7 +1105,7 @@
"parser",
"validator"
],
- "time": "2017-11-30T15:34:22+00:00"
+ "time": "2018-01-24T12:46:19+00:00"
},
{
"name": "seld/phar-utils",
@@ -1265,16 +1265,16 @@
},
{
"name": "symfony/event-dispatcher",
- "version": "v2.8.32",
+ "version": "v2.8.39",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
- "reference": "b59aacf238fadda50d612c9de73b74751872a903"
+ "reference": "9b69aad7d4c086dc94ebade2d5eb9145da5dac8c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/b59aacf238fadda50d612c9de73b74751872a903",
- "reference": "b59aacf238fadda50d612c9de73b74751872a903",
+ "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/9b69aad7d4c086dc94ebade2d5eb9145da5dac8c",
+ "reference": "9b69aad7d4c086dc94ebade2d5eb9145da5dac8c",
"shasum": ""
},
"require": {
@@ -1321,20 +1321,20 @@
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com",
- "time": "2017-11-05T15:25:56+00:00"
+ "time": "2018-04-06T07:35:03+00:00"
},
{
"name": "symfony/filesystem",
- "version": "v3.4.1",
+ "version": "v3.4.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
- "reference": "de56eee71e0a128d8c54ccc1909cdefd574bad0f"
+ "reference": "253a4490b528597aa14d2bf5aeded6f5e5e4a541"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/filesystem/zipball/de56eee71e0a128d8c54ccc1909cdefd574bad0f",
- "reference": "de56eee71e0a128d8c54ccc1909cdefd574bad0f",
+ "url": "https://api.github.com/repos/symfony/filesystem/zipball/253a4490b528597aa14d2bf5aeded6f5e5e4a541",
+ "reference": "253a4490b528597aa14d2bf5aeded6f5e5e4a541",
"shasum": ""
},
"require": {
@@ -1370,20 +1370,20 @@
],
"description": "Symfony Filesystem Component",
"homepage": "https://symfony.com",
- "time": "2017-11-19T18:59:05+00:00"
+ "time": "2018-02-22T10:48:49+00:00"
},
{
"name": "symfony/finder",
- "version": "v3.4.1",
+ "version": "v3.4.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
- "reference": "dac8d7db537bac7ad8143eb11360a8c2231f251a"
+ "reference": "bd14efe8b1fabc4de82bf50dce62f05f9a102433"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/finder/zipball/dac8d7db537bac7ad8143eb11360a8c2231f251a",
- "reference": "dac8d7db537bac7ad8143eb11360a8c2231f251a",
+ "url": "https://api.github.com/repos/symfony/finder/zipball/bd14efe8b1fabc4de82bf50dce62f05f9a102433",
+ "reference": "bd14efe8b1fabc4de82bf50dce62f05f9a102433",
"shasum": ""
},
"require": {
@@ -1419,20 +1419,20 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
- "time": "2017-11-05T16:10:10+00:00"
+ "time": "2018-04-04T05:07:11+00:00"
},
{
"name": "symfony/process",
- "version": "v2.8.32",
+ "version": "v2.8.39",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
- "reference": "d25449e031f600807949aab7cadbf267712f4eee"
+ "reference": "ee2c91470ff262b1a00aec27875d38594aa87629"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/process/zipball/d25449e031f600807949aab7cadbf267712f4eee",
- "reference": "d25449e031f600807949aab7cadbf267712f4eee",
+ "url": "https://api.github.com/repos/symfony/process/zipball/ee2c91470ff262b1a00aec27875d38594aa87629",
+ "reference": "ee2c91470ff262b1a00aec27875d38594aa87629",
"shasum": ""
},
"require": {
@@ -1468,7 +1468,7 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
- "time": "2017-11-05T15:25:56+00:00"
+ "time": "2018-04-03T05:20:27+00:00"
},
{
"name": "tedivm/jshrink",
@@ -4326,16 +4326,16 @@
},
{
"name": "symfony/stopwatch",
- "version": "v3.4.1",
+ "version": "v3.4.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/stopwatch.git",
- "reference": "52510fe1aefdc1c5d2076ac6030421d387e689d1"
+ "reference": "eb17cfa072cab26537ac37e9c4ece6c0361369af"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/stopwatch/zipball/52510fe1aefdc1c5d2076ac6030421d387e689d1",
- "reference": "52510fe1aefdc1c5d2076ac6030421d387e689d1",
+ "url": "https://api.github.com/repos/symfony/stopwatch/zipball/eb17cfa072cab26537ac37e9c4ece6c0361369af",
+ "reference": "eb17cfa072cab26537ac37e9c4ece6c0361369af",
"shasum": ""
},
"require": {
@@ -4371,20 +4371,20 @@
],
"description": "Symfony Stopwatch Component",
"homepage": "https://symfony.com",
- "time": "2017-11-07T14:28:09+00:00"
+ "time": "2018-02-17T14:55:25+00:00"
},
{
"name": "symfony/yaml",
- "version": "v2.8.32",
+ "version": "v2.8.39",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
- "reference": "968ef42161e4bc04200119da473077f9e7015128"
+ "reference": "d20bd2bdee063863e426297af41eda45ccad6f7e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/yaml/zipball/968ef42161e4bc04200119da473077f9e7015128",
- "reference": "968ef42161e4bc04200119da473077f9e7015128",
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/d20bd2bdee063863e426297af41eda45ccad6f7e",
+ "reference": "d20bd2bdee063863e426297af41eda45ccad6f7e",
"shasum": ""
},
"require": {
@@ -4420,7 +4420,7 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
- "time": "2017-11-29T09:33:18+00:00"
+ "time": "2018-04-08T07:53:13+00:00"
},
{
"name": "theseer/fdomdocument",
diff --git a/dev/tests/api-functional/framework/bootstrap.php b/dev/tests/api-functional/framework/bootstrap.php
index 304113060688c..8bf13b909f009 100644
--- a/dev/tests/api-functional/framework/bootstrap.php
+++ b/dev/tests/api-functional/framework/bootstrap.php
@@ -14,6 +14,8 @@
$integrationTestsDir = realpath("{$testsBaseDir}/../integration");
$fixtureBaseDir = $integrationTestsDir . '/testsuite';
+setCustomErrorHandler();
+
$logWriter = new \Zend_Log_Writer_Stream('php://output');
$logWriter->setFormatter(new \Zend_Log_Formatter_Simple('%message%' . PHP_EOL));
$logger = new \Zend_Log($logWriter);
@@ -102,3 +104,40 @@
)
);
unset($bootstrap, $application, $settings, $shell);
+
+/**
+ * Set custom error handler
+ */
+function setCustomErrorHandler()
+{
+ set_error_handler(
+ function ($errNo, $errStr, $errFile, $errLine) {
+ if (error_reporting()) {
+ $errorNames = [
+ E_ERROR => 'Error',
+ E_WARNING => 'Warning',
+ E_PARSE => 'Parse',
+ E_NOTICE => 'Notice',
+ E_CORE_ERROR => 'Core Error',
+ E_CORE_WARNING => 'Core Warning',
+ E_COMPILE_ERROR => 'Compile Error',
+ E_COMPILE_WARNING => 'Compile Warning',
+ E_USER_ERROR => 'User Error',
+ E_USER_WARNING => 'User Warning',
+ E_USER_NOTICE => 'User Notice',
+ E_STRICT => 'Strict',
+ E_RECOVERABLE_ERROR => 'Recoverable Error',
+ E_DEPRECATED => 'Deprecated',
+ E_USER_DEPRECATED => 'User Deprecated',
+ ];
+
+ $errName = isset($errorNames[$errNo]) ? $errorNames[$errNo] : "";
+
+ throw new \PHPUnit_Framework_Exception(
+ sprintf("%s: %s in %s:%s.", $errName, $errStr, $errFile, $errLine),
+ $errNo
+ );
+ }
+ }
+ );
+}
diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductCustomOptionRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductCustomOptionRepositoryTest.php
index f0f42bc10e969..bb3e82d89e54d 100644
--- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductCustomOptionRepositoryTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductCustomOptionRepositoryTest.php
@@ -426,7 +426,9 @@ public function testUpdateNegative($optionData, $message, $exceptionCode)
],
];
+
$this->setExpectedException('Exception', $message, $exceptionCode);
+
$this->_webApiCall($serviceInfo, ['option' => $optionData]);
}
diff --git a/dev/tests/api-functional/testsuite/Magento/Customer/Api/AccountManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Customer/Api/AccountManagementTest.php
index 625c1dfe0ef3a..4d7bad46bf0ea 100644
--- a/dev/tests/api-functional/testsuite/Magento/Customer/Api/AccountManagementTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/Customer/Api/AccountManagementTest.php
@@ -157,7 +157,7 @@ public function tearDown()
private function initSubscriber()
{
$this->subscriber = Bootstrap::getObjectManager()->create(
- 'Magento\Newsletter\Model\Subscriber'
+ \Magento\Newsletter\Model\Subscriber::class
);
}
diff --git a/dev/tests/functional/lib/Magento/Mtf/Client/Element/SimplifiedselectElement.php b/dev/tests/functional/lib/Magento/Mtf/Client/Element/SimplifiedselectElement.php
index c9f37e9c18945..3aa7010377fb4 100644
--- a/dev/tests/functional/lib/Magento/Mtf/Client/Element/SimplifiedselectElement.php
+++ b/dev/tests/functional/lib/Magento/Mtf/Client/Element/SimplifiedselectElement.php
@@ -21,7 +21,7 @@ class SimplifiedselectElement extends SelectElement
protected $optionGroupValue = ".//*[@data-title='%s' or contains(normalize-space(.), %s)]";
/**
- * Select value in ropdown which has option groups.
+ * Select value in dropdown which has option groups.
*
* @param string $value
* @return void
diff --git a/dev/tests/functional/lib/Magento/Mtf/Client/Element/SuggestElement.php b/dev/tests/functional/lib/Magento/Mtf/Client/Element/SuggestElement.php
index 78c398be83986..94d4142626b24 100644
--- a/dev/tests/functional/lib/Magento/Mtf/Client/Element/SuggestElement.php
+++ b/dev/tests/functional/lib/Magento/Mtf/Client/Element/SuggestElement.php
@@ -60,6 +60,13 @@ class SuggestElement extends SimpleElement
*/
protected $closeButton = '[data-action="close-advanced-select"]';
+ /**
+ * Searched count.
+ *
+ * @var string
+ */
+ protected $searchedCount = '[class*=search-count]';
+
/**
* Set value.
*
@@ -77,6 +84,12 @@ public function setValue($value)
}
$this->keys([$value]);
$searchedItem = $this->find(sprintf($this->resultItem, $value), Locator::SELECTOR_XPATH);
+ $searchedCountElements = $this->find($this->searchedCount);
+ $this->waitUntil(
+ function () use ($searchedCountElements) {
+ return $searchedCountElements->isVisible() ? true : null;
+ }
+ );
$searchedItem->click();
$closeButton = $this->find($this->closeButton);
if ($closeButton->isVisible()) {
diff --git a/dev/tests/functional/lib/Magento/Mtf/Client/Element/SwitcherElement.php b/dev/tests/functional/lib/Magento/Mtf/Client/Element/SwitcherElement.php
index 6dce3d12a1fbe..36a203bb057e1 100644
--- a/dev/tests/functional/lib/Magento/Mtf/Client/Element/SwitcherElement.php
+++ b/dev/tests/functional/lib/Magento/Mtf/Client/Element/SwitcherElement.php
@@ -22,7 +22,7 @@ class SwitcherElement extends SimpleElement
protected $parentContainer = 'parent::div[@data-role="switcher"]';
/**
- * XPath selector for label text on swticher element.
+ * XPath selector for label text on switcher element.
*
* @var string
*/
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/Attributes/Search.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/Attributes/Search.php
index d17b06456c831..7b5bcf8060e2d 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/Attributes/Search.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/Attributes/Search.php
@@ -37,7 +37,7 @@ class Search extends SuggestElement
protected $actionToggle = '.action-toggle';
/**
- * Saerch result dropdown.
+ * Search result dropdown.
*
* @var string
*/
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/Options.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/Options.php
index 59f328a05bd3c..87aea888a0567 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/Options.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/Options.php
@@ -89,6 +89,13 @@ class Options extends Section
*/
protected $sortRowsData = [];
+ /**
+ * Locator for file_extension field.
+ *
+ * @var string
+ */
+ private $hintMessage = "div[data-index='file_extension'] div[id^='notice']";
+
/**
* Fill custom options form on tab.
*
@@ -382,4 +389,14 @@ private function processField($keyRoot, array $field)
$this->setOptionTypeData($options, $field['type'], $rootElement);
}
}
+
+ /**
+ * Returns notice-message elements for 'file_extension' fields.
+ *
+ * @return ElementInterface[]
+ */
+ public function getFileOptionElements()
+ {
+ return $this->_rootElement->getElements($this->hintMessage);
+ }
}
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCustomOptions.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCustomOptions.php
new file mode 100644
index 0000000000000..7542fe5703179
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCustomOptions.php
@@ -0,0 +1,81 @@
+arguments['expectedCustomOptions'];
+ $filter = ['sku' => $product->getSku()];
+ $productGrid->open();
+ $productGrid->getProductGrid()->searchAndOpen($filter);
+ $productData = [];
+ if ($product->hasData('custom_options')) {
+ $productData = $this->addExpectedOptionValues($product, $expectedCustomOptions);
+ }
+ $fixtureData = $this->prepareFixtureData($productData, $this->sortFields);
+ $formData = $this->prepareFormData($productPage->getProductForm()->getData($product), $this->sortFields);
+ $error = $this->verifyData($fixtureData, $formData);
+ \PHPUnit_Framework_Assert::assertTrue(empty($error), $error);
+ }
+
+ /**
+ * Adds expected value of Custom Options.
+ *
+ * @param FixtureInterface $product
+ * @param array $expectedCustomOptions
+ * @return array
+ */
+ private function addExpectedOptionValues(FixtureInterface $product, array $expectedCustomOptions)
+ {
+ /** @var array $customOptionsSource */
+ $customOptionsSource = $product->getDataFieldConfig('custom_options')['source']->getCustomOptions();
+ foreach (array_keys($customOptionsSource) as $optionKey) {
+ foreach ($expectedCustomOptions as $expectedCustomOption) {
+ if ($customOptionsSource[$optionKey]['type'] === $expectedCustomOption['optionType']) {
+ $options = array_keys($customOptionsSource[$optionKey]['options']);
+ $optionField = $expectedCustomOption['optionField'];
+ $optionValue = $expectedCustomOption['optionValue'];
+ foreach ($options as $optionsKey) {
+ $customOptionsSource[$optionKey]['options'][$optionsKey][$optionField] = $optionValue;
+ }
+ }
+ }
+ }
+
+ return ['custom_options' => $customOptionsSource];
+ }
+
+ /**
+ * Returns a string representation of the object.
+ *
+ * @return string
+ */
+ public function toString()
+ {
+ return 'Custom option values are same as expected.';
+ }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertFileExtensionHints.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertFileExtensionHints.php
new file mode 100644
index 0000000000000..74b98b1512fcf
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertFileExtensionHints.php
@@ -0,0 +1,57 @@
+getProductForm();
+ $productForm->openSection('customer-options');
+ /** @var \Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Section\Options $options */
+ $options = $productForm->getSection('customer-options');
+ $fileOptionElements = $options->getFileOptionElements();
+ foreach ($fileOptionElements as $fileOptionElement) {
+ \PHPUnit_Framework_Assert::assertEquals(
+ self::EXPECTED_MESSAGE,
+ $fileOptionElement->getText(),
+ 'Actual message differ from expected.'
+ );
+ }
+ }
+
+ /**
+ * Returns a string representation of the object.
+ *
+ * @return string
+ */
+ public function toString()
+ {
+ return 'Assert correct file extensions hint is showed.';
+ }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductAttributeIsHtmlAllowed.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductAttributeIsHtmlAllowed.php
index f1999498b96df..47a4ab7be3313 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductAttributeIsHtmlAllowed.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductAttributeIsHtmlAllowed.php
@@ -23,7 +23,7 @@ class AssertProductAttributeIsHtmlAllowed extends AbstractConstraint
/**
* Check whether html tags are using in attribute value.
- * Checked tag structure atttribute_default_value
+ * Checked tag structure attribute_default_value
*
* @param InjectableFixture $product
* @param CatalogProductAttribute $attribute
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/TierPrice.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/TierPrice.php
index 6ed4bbf4f5edb..1678e7a8dde02 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/TierPrice.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/TierPrice.php
@@ -41,7 +41,7 @@ class TierPrice extends DataSource
private $fixtureFactory;
/**
- * Rought fixture field data.
+ * Rough fixture field data.
*
* @var array
*/
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/WebsiteIds.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/WebsiteIds.php
index 2bd71dbf4f8a6..57fe2bb59154f 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/WebsiteIds.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/WebsiteIds.php
@@ -37,7 +37,7 @@ class WebsiteIds extends DataSource
private $fixtureFactory;
/**
- * Rought fixture field data.
+ * Rough fixture field data.
*
* @var array
*/
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Product/CustomOptions.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Product/CustomOptions.xml
index cb0f8fbcac58d..4ba7944e99998 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Product/CustomOptions.xml
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Product/CustomOptions.xml
@@ -343,5 +343,21 @@
+
+
+
+ - custom option file %isolation%
+ - Yes
+ - File/File
+ -
+
-
+
- 40
+ - Percent
+ - file_option
+ - jpg, jpg gif .png
+
+
+
+
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml
index 9de7ab9baed28..00ac3bc08e755 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml
@@ -480,5 +480,24 @@
+
+ Create product with file option
+ simple-product-%isolation%
+ Simple Product %isolation%
+ simple_sku_%isolation%
+ 1000
+ 100
+ file_option_type
+
+ -
+
- File/File
+ - file_extension
+ - jpg, gif, png
+
+
+
+
+
+
diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart/DiscountCodes.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart/DiscountCodes.php
index 710771de9d38a..2bd90d7ab590b 100644
--- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart/DiscountCodes.php
+++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart/DiscountCodes.php
@@ -37,14 +37,21 @@ class DiscountCodes extends Form
protected $couponCode = '#coupon_code';
/**
- * Click apply button selector
+ * Locator for "Apply Discount" button.
*
* @var string
*/
protected $applyButton = '.action.apply';
/**
- * Enter discount code and click apply button
+ * Locator for "Cancel Coupon" button.
+ *
+ * @var string
+ */
+ protected $cancelButton = '.action.cancel';
+
+ /**
+ * Enter Discount Code and click "Apply Discount" button.
*
* @param string $code
* @return void
@@ -57,4 +64,17 @@ public function applyCouponCode($code)
$this->_rootElement->find($this->couponCode, Locator::SELECTOR_CSS)->setValue($code);
$this->_rootElement->find($this->applyButton, Locator::SELECTOR_CSS)->click();
}
+
+ /**
+ * Click "Cancel Coupon" button.
+ *
+ * @return void
+ */
+ public function cancelCouponCode()
+ {
+ if (!$this->_rootElement->find($this->formWrapper)->isVisible()) {
+ $this->_rootElement->find($this->openForm)->click();
+ }
+ $this->_rootElement->find($this->cancelButton)->click();
+ }
}
diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertBillingAddressSameAsShippingCheckbox.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertBillingAddressSameAsShippingCheckbox.php
index 3e889c058ee84..9a042ab13f048 100644
--- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertBillingAddressSameAsShippingCheckbox.php
+++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertBillingAddressSameAsShippingCheckbox.php
@@ -37,7 +37,7 @@ public function processAssert(CheckoutOnepage $checkoutOnepage, $billingCheckbox
}
/**
- * Returns a string representation of successfull assertion.
+ * Returns a string representation of successful assertion.
*
* @return string
*/
diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertProductTierPriceOnProductPage.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertProductTierPriceOnProductPage.php
index e7fd0d73878e3..1b9a1f305f778 100644
--- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertProductTierPriceOnProductPage.php
+++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertProductTierPriceOnProductPage.php
@@ -10,7 +10,7 @@
use Magento\ConfigurableProduct\Test\Block\Product\View\ConfigurableOptions;
/**
- * Open created configurble product on frontend and choose variation with tier price.
+ * Open created configurable product on frontend and choose variation with tier price.
*/
class AssertProductTierPriceOnProductPage extends AssertProductPage
{
diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/AbstractApplyVatIdTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/AbstractApplyVatIdTest.php
index ac90ef43c915c..6ea4545594716 100644
--- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/AbstractApplyVatIdTest.php
+++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/AbstractApplyVatIdTest.php
@@ -76,7 +76,7 @@ public function __prepare(FixtureFactory $fixtureFactory)
}
/**
- * Prepare VAT ID confguration.
+ * Prepare VAT ID configuration.
*
* @param ConfigData $vatConfig
* @param string $customerGroup
diff --git a/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/ReAuthorizeTokensIntegrationEntityTest.php b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/ReAuthorizeTokensIntegrationEntityTest.php
index d94f5810c9865..e8417ba400ec5 100644
--- a/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/ReAuthorizeTokensIntegrationEntityTest.php
+++ b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/ReAuthorizeTokensIntegrationEntityTest.php
@@ -52,7 +52,7 @@ class ReAuthorizeTokensIntegrationEntityTest extends Injectable
*
* @param FixtureFactory $fixtureFactory
* @param IntegrationIndex $integrationIndex
- * @retun void
+ * @return void
*/
public function __inject(IntegrationIndex $integrationIndex, FixtureFactory $fixtureFactory)
{
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/CustomerActivities/Sidebar.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/CustomerActivities/Sidebar.php
index 3cc8d07da393e..8e31f21ca3b89 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/CustomerActivities/Sidebar.php
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/CustomerActivities/Sidebar.php
@@ -29,7 +29,7 @@ abstract class Sidebar extends Block
protected $addToOrderProductName = './/tr/td[.="%s"]';
/**
- * Add productz to order.
+ * Add products to order.
*
* @param array $products
* @return void
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CancelCreatedOrderTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CancelCreatedOrderTest.php
index 2dc482b368424..da99481f43c70 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CancelCreatedOrderTest.php
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CancelCreatedOrderTest.php
@@ -22,7 +22,7 @@
* 2. Sales > Orders.
* 3. Open the created order.
* 4. Do cancel Order.
- * 5. Perform all assetions.
+ * 5. Perform all assertions.
*
* @group Order_Management_(CS)
* @ZephyrId MAGETWO-28191
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCustomOrderStatusEntityTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCustomOrderStatusEntityTest.php
index 18a3206db86e4..017597eeab94f 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCustomOrderStatusEntityTest.php
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCustomOrderStatusEntityTest.php
@@ -31,7 +31,7 @@ class CreateCustomOrderStatusEntityTest extends Injectable
/* end tags */
/**
- * Order staus page.
+ * Order status page.
*
* @var OrderStatusIndex
*/
diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleSuccessDeleteMessage.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleSuccessDeleteMessage.php
index 472218205cb4f..381de91030a61 100644
--- a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleSuccessDeleteMessage.php
+++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleSuccessDeleteMessage.php
@@ -10,7 +10,7 @@
use Magento\Mtf\Constraint\AbstractConstraint;
/**
- * Assert sales rule delte message.
+ * Assert sales rule delete message.
*/
class AssertCartPriceRuleSuccessDeleteMessage extends AbstractConstraint
{
diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/ApplySalesRuleOnFrontendStep.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/ApplySalesRuleOnFrontendStep.php
index e185accdddd0b..6da34639728f3 100644
--- a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/ApplySalesRuleOnFrontendStep.php
+++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/ApplySalesRuleOnFrontendStep.php
@@ -29,15 +29,24 @@ class ApplySalesRuleOnFrontendStep implements TestStepInterface
*/
protected $salesRule;
+ /**
+ * Sales Rule Discount Code.
+ *
+ * @var SalesRule
+ */
+ protected $couponCode;
+
/**
* @constructor
* @param CheckoutCart $checkoutCart
* @param SalesRule $salesRule
+ * @param string $couponCode
*/
- public function __construct(CheckoutCart $checkoutCart, SalesRule $salesRule = null)
+ public function __construct(CheckoutCart $checkoutCart, SalesRule $salesRule = null, $couponCode = null)
{
$this->checkoutCart = $checkoutCart;
$this->salesRule = $salesRule;
+ $this->couponCode = $couponCode;
}
/**
@@ -51,5 +60,10 @@ public function run()
$this->checkoutCart->getDiscountCodesBlock()->applyCouponCode($this->salesRule->getCouponCode());
$this->checkoutCart->getTotalsBlock()->waitForUpdatedTotals();
}
+
+ if ($this->couponCode !== null) {
+ $this->checkoutCart->getDiscountCodesBlock()->applyCouponCode($this->couponCode);
+ $this->checkoutCart->getTotalsBlock()->waitForUpdatedTotals();
+ }
}
}
diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/CancelSalesRuleOnFrontendStep.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/CancelSalesRuleOnFrontendStep.php
new file mode 100644
index 0000000000000..bba48acd667f5
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/CancelSalesRuleOnFrontendStep.php
@@ -0,0 +1,43 @@
+checkoutCart = $checkoutCart;
+ }
+
+ /**
+ * Apply coupon before one page checkout.
+ *
+ * @return void
+ */
+ public function run()
+ {
+ $this->checkoutCart->getDiscountCodesBlock()->cancelCouponCode();
+ $this->checkoutCart->getTotalsBlock()->waitForUpdatedTotals();
+ }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Theme/Test/Block/Html/Footer.php b/dev/tests/functional/tests/app/Magento/Theme/Test/Block/Html/Footer.php
index 0bcf20b38801e..30842af0b020d 100644
--- a/dev/tests/functional/tests/app/Magento/Theme/Test/Block/Html/Footer.php
+++ b/dev/tests/functional/tests/app/Magento/Theme/Test/Block/Html/Footer.php
@@ -120,7 +120,7 @@ public function selectStoreGroup(Store $store)
}
/**
- * Check if correspondent "Store" is present in "Store" swither or not.
+ * Check if correspondent "Store" is present in "Store" switcher or not.
*
* @param Store $store
* @return bool
diff --git a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php
index 78b1c40c3b0a0..e4d5dd8618ade 100644
--- a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php
+++ b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php
@@ -339,7 +339,7 @@ public function selectMassAction($massActionSelection)
}
/**
- * Peform action using the dropdown above the grid.
+ * Perform action using the dropdown above the grid.
*
* @param array|string $action [array -> key = value from first select; value => value from subselect]
* @return void
diff --git a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/Modal.php b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/Modal.php
index 605a5a114083e..01e2011fc750e 100644
--- a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/Modal.php
+++ b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/Modal.php
@@ -131,7 +131,7 @@ public function setAlertText($text)
}
/**
- * Wait until modal window will disapper.
+ * Wait until modal window will disappear.
*
* @return void
*/
diff --git a/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridFullTextSearchTest.php b/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridFullTextSearchTest.php
index 21b258ea05732..b9321c54585ff 100644
--- a/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridFullTextSearchTest.php
+++ b/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridFullTextSearchTest.php
@@ -19,8 +19,8 @@
* Steps:
* 1. Navigate to backend.
* 2. Go to grid page
- * 3. Perfrom full text search
- * 5. Perform Asserts
+ * 3. Perform full text search
+ * 4. Perform Asserts
*
* @group Ui_(CS)
* @ZephyrId MAGETWO-41330
diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Block/Adminhtml/Catalog/Edit/UrlRewriteForm.php b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Block/Adminhtml/Catalog/Edit/UrlRewriteForm.php
index 114709becde6f..988229d308250 100644
--- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Block/Adminhtml/Catalog/Edit/UrlRewriteForm.php
+++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Block/Adminhtml/Catalog/Edit/UrlRewriteForm.php
@@ -39,7 +39,7 @@ protected function prepareData(FixtureInterface $fixture)
*
* @param array $data
* @param SimpleElement $context
- * @retun void
+ * @return void
*/
protected function fillFields(array $data, SimpleElement $context)
{
diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/Instance/Edit/Tab/WidgetInstanceType/GenericPages.xml b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/Instance/Edit/Tab/WidgetInstanceType/GenericPages.xml
index e8899cf6e5533..aa6844834da4b 100644
--- a/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/Instance/Edit/Tab/WidgetInstanceType/GenericPages.xml
+++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/Instance/Edit/Tab/WidgetInstanceType/GenericPages.xml
@@ -11,6 +11,10 @@
.page_group_select
optgroupselect
+
+ #layout_handle
+ select
+
.block_reference select
select
diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetCmsPageLink.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetCmsPageLink.php
index 7c4b05526fe66..52dfc910e1292 100644
--- a/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetCmsPageLink.php
+++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetCmsPageLink.php
@@ -12,7 +12,7 @@
use Magento\Mtf\Constraint\AbstractConstraint;
/**
- * Check that created widget displayed on frontent on Home page and on Advanced Search and
+ * Check that created widget displayed on frontend on Home page and on Advanced Search and
* after click on widget link on frontend system redirects you to cms page.
*/
class AssertWidgetCmsPageLink extends AbstractConstraint
diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/AbstractCreateWidgetEntityTest.php b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/AbstractCreateWidgetEntityTest.php
index 1195722834d9c..ad8c446cbe651 100644
--- a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/AbstractCreateWidgetEntityTest.php
+++ b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/AbstractCreateWidgetEntityTest.php
@@ -6,17 +6,26 @@
namespace Magento\Widget\Test\TestCase;
+use Magento\Mtf\TestStep\TestStepFactory;
use Magento\Widget\Test\Fixture\Widget;
use Magento\Widget\Test\Page\Adminhtml\WidgetInstanceEdit;
use Magento\Widget\Test\Page\Adminhtml\WidgetInstanceIndex;
use Magento\Widget\Test\Page\Adminhtml\WidgetInstanceNew;
use Magento\Mtf\TestCase\Injectable;
+use Magento\PageCache\Test\Page\Adminhtml\AdminCache;
/**
* Test Creation for New Instance of WidgetEntity.
*/
abstract class AbstractCreateWidgetEntityTest extends Injectable
{
+ /**
+ * Factory for Test Steps.
+ *
+ * @var TestStepFactory
+ */
+ protected $testStep;
+
/**
* WidgetInstanceIndex page.
*
@@ -38,31 +47,57 @@ abstract class AbstractCreateWidgetEntityTest extends Injectable
*/
protected $widgetInstanceEdit;
+ /**
+ * "Cache Management" Admin panel page.
+ *
+ * @var AdminCache
+ */
+ protected $cachePage;
+
/**
* Injection data.
*
* @param WidgetInstanceIndex $widgetInstanceIndex
* @param WidgetInstanceNew $widgetInstanceNew
* @param WidgetInstanceEdit $widgetInstanceEdit
+ * @param AdminCache $adminCache
+ * @param TestStepFactory $testStepFactory
* @return void
*/
public function __inject(
WidgetInstanceIndex $widgetInstanceIndex,
WidgetInstanceNew $widgetInstanceNew,
- WidgetInstanceEdit $widgetInstanceEdit
+ WidgetInstanceEdit $widgetInstanceEdit,
+ AdminCache $adminCache,
+ TestStepFactory $testStepFactory
) {
$this->widgetInstanceIndex = $widgetInstanceIndex;
$this->widgetInstanceNew = $widgetInstanceNew;
$this->widgetInstanceEdit = $widgetInstanceEdit;
+ $this->cachePage = $adminCache;
+ $this->testStep = $testStepFactory;
}
/**
- * Delete all widgets.
+ * Delete all Widgets & flush the Cache.
*
* @return void
*/
public function tearDown()
{
$this->objectManager->create('Magento\Widget\Test\TestStep\DeleteAllWidgetsStep')->run();
+ $this->flushCache();
+ }
+
+ /**
+ * Flush Magento Cache in Admin panel.
+ *
+ * @return void
+ */
+ protected function flushCache()
+ {
+ $this->cachePage->open();
+ $this->cachePage->getActionsBlock()->flushMagentoCache();
+ $this->cachePage->getMessagesBlock()->waitSuccessMessage();
}
}
diff --git a/dev/tests/integration/framework/Magento/TestFramework/Annotation/DataFixture.php b/dev/tests/integration/framework/Magento/TestFramework/Annotation/DataFixture.php
index 1e424e8f5b344..a83ed41ca7efd 100644
--- a/dev/tests/integration/framework/Magento/TestFramework/Annotation/DataFixture.php
+++ b/dev/tests/integration/framework/Magento/TestFramework/Annotation/DataFixture.php
@@ -171,8 +171,13 @@ protected function _applyOneFixture($fixture)
require $fixture;
}
} catch (\Exception $e) {
- throw new \Exception(
- sprintf("Error in fixture: %s.\n %s", json_encode($fixture), $e->getMessage()),
+ throw new \PHPUnit_Framework_Exception(
+ sprintf(
+ "Error in fixture: %s.\n %s\n %s",
+ json_encode($fixture),
+ $e->getMessage(),
+ $e->getTraceAsString()
+ ),
500,
$e
);
diff --git a/dev/tests/integration/framework/Magento/TestFramework/Annotation/DataFixtureBeforeTransaction.php b/dev/tests/integration/framework/Magento/TestFramework/Annotation/DataFixtureBeforeTransaction.php
index 6a79aba1feb8d..ec23de5061f76 100644
--- a/dev/tests/integration/framework/Magento/TestFramework/Annotation/DataFixtureBeforeTransaction.php
+++ b/dev/tests/integration/framework/Magento/TestFramework/Annotation/DataFixtureBeforeTransaction.php
@@ -138,8 +138,15 @@ protected function _applyOneFixture($fixture)
require $fixture;
}
} catch (\Exception $e) {
- throw new \Exception(
- sprintf("Error in fixture: %s.\n %s", json_encode($fixture), (string)$e)
+ throw new \PHPUnit_Framework_Exception(
+ sprintf(
+ "Error in fixture: %s.\n %s\n %s",
+ json_encode($fixture),
+ $e->getMessage(),
+ $e->getTraceAsString()
+ ),
+ 500,
+ $e
);
}
}
diff --git a/dev/tests/integration/framework/Magento/TestFramework/Db/AbstractDb.php b/dev/tests/integration/framework/Magento/TestFramework/Db/AbstractDb.php
index 949d17ffb5f66..a15bdec6157a3 100644
--- a/dev/tests/integration/framework/Magento/TestFramework/Db/AbstractDb.php
+++ b/dev/tests/integration/framework/Magento/TestFramework/Db/AbstractDb.php
@@ -84,7 +84,7 @@ abstract public function cleanup();
abstract protected function getSetupDbDumpFilename();
/**
- * Is dump esxists
+ * Is dump exists
*
* @return bool
*/
diff --git a/dev/tests/integration/framework/Magento/TestFramework/Db/Mysql.php b/dev/tests/integration/framework/Magento/TestFramework/Db/Mysql.php
index d84511db358c7..a986d6a5a4abf 100644
--- a/dev/tests/integration/framework/Magento/TestFramework/Db/Mysql.php
+++ b/dev/tests/integration/framework/Magento/TestFramework/Db/Mysql.php
@@ -70,7 +70,7 @@ protected function getSetupDbDumpFilename()
}
/**
- * Is dump esxists
+ * Is dump exists
*
* @return bool
*/
diff --git a/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractConfigFiles.php b/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractConfigFiles.php
index 77dbe90c4573a..d4ab07aa94677 100644
--- a/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractConfigFiles.php
+++ b/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractConfigFiles.php
@@ -47,7 +47,7 @@ public function setUp()
'Magento\Framework\App\Arguments\FileResolver\Primary'
)->disableOriginalConstructor()->getMock();
- /* Enable Validation regardles of MAGE_MODE */
+ /* Enable Validation regardless of MAGE_MODE */
$validateStateMock = $this->getMockBuilder(
'Magento\Framework\Config\ValidationStateInterface'
)->disableOriginalConstructor()->getMock();
diff --git a/dev/tests/integration/testsuite/Magento/AdminNotification/_files/notifications.php b/dev/tests/integration/testsuite/Magento/AdminNotification/_files/notifications.php
index 8aaca8b0c8536..9a1819ad62218 100644
--- a/dev/tests/integration/testsuite/Magento/AdminNotification/_files/notifications.php
+++ b/dev/tests/integration/testsuite/Magento/AdminNotification/_files/notifications.php
@@ -4,34 +4,34 @@
* See COPYING.txt for license details.
*/
$om = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-$mesasge = $om->create('Magento\AdminNotification\Model\Inbox');
-$mesasge->setSeverity(
+$message = $om->create('Magento\AdminNotification\Model\Inbox');
+$message->setSeverity(
\Magento\Framework\Notification\MessageInterface::SEVERITY_CRITICAL
)->setTitle(
'Unread Critical 1'
)->save();
-$mesasge = $om->create('Magento\AdminNotification\Model\Inbox');
-$mesasge->setSeverity(\Magento\Framework\Notification\MessageInterface::SEVERITY_MAJOR)
+$message = $om->create('Magento\AdminNotification\Model\Inbox');
+$message->setSeverity(\Magento\Framework\Notification\MessageInterface::SEVERITY_MAJOR)
->setTitle('Unread Major 1')
->save();
-$mesasge = $om->create('Magento\AdminNotification\Model\Inbox');
-$mesasge->setSeverity(
+$message = $om->create('Magento\AdminNotification\Model\Inbox');
+$message->setSeverity(
\Magento\Framework\Notification\MessageInterface::SEVERITY_CRITICAL
)->setTitle(
'Unread Critical 2'
)->save();
-$mesasge = $om->create('Magento\AdminNotification\Model\Inbox');
-$mesasge->setSeverity(
+$message = $om->create('Magento\AdminNotification\Model\Inbox');
+$message->setSeverity(
\Magento\Framework\Notification\MessageInterface::SEVERITY_CRITICAL
)->setTitle(
'Unread Critical 3'
)->save();
-$mesasge = $om->create('Magento\AdminNotification\Model\Inbox');
-$mesasge->setSeverity(
+$message = $om->create('Magento\AdminNotification\Model\Inbox');
+$message->setSeverity(
\Magento\Framework\Notification\MessageInterface::SEVERITY_CRITICAL
)->setTitle(
'Read Critical 1'
@@ -39,13 +39,13 @@
1
)->save();
-$mesasge = $om->create('Magento\AdminNotification\Model\Inbox');
-$mesasge->setSeverity(\Magento\Framework\Notification\MessageInterface::SEVERITY_MAJOR)
+$message = $om->create('Magento\AdminNotification\Model\Inbox');
+$message->setSeverity(\Magento\Framework\Notification\MessageInterface::SEVERITY_MAJOR)
->setTitle('Unread Major 2')
->save();
-$mesasge = $om->create('Magento\AdminNotification\Model\Inbox');
-$mesasge->setSeverity(
+$message = $om->create('Magento\AdminNotification\Model\Inbox');
+$message->setSeverity(
\Magento\Framework\Notification\MessageInterface::SEVERITY_CRITICAL
)->setTitle(
'Removed Critical 1'
diff --git a/dev/tests/integration/testsuite/Magento/Backend/Model/Auth/SessionTest.php b/dev/tests/integration/testsuite/Magento/Backend/Model/Auth/SessionTest.php
index 035da95ba2d88..a6eda5de3ab4a 100644
--- a/dev/tests/integration/testsuite/Magento/Backend/Model/Auth/SessionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Backend/Model/Auth/SessionTest.php
@@ -7,6 +7,8 @@
/**
* @magentoAppArea adminhtml
+ * @magentoAppIsolation enabled
+ * @magentoDbIsolation enabled
*/
class SessionTest extends \PHPUnit_Framework_TestCase
{
@@ -34,6 +36,7 @@ protected function setUp()
$this->auth = $this->objectManager->create(\Magento\Backend\Model\Auth::class);
$this->authSession = $this->objectManager->create(\Magento\Backend\Model\Auth\Session::class);
$this->auth->setAuthStorage($this->authSession);
+ $this->auth->logout();
}
protected function tearDown()
diff --git a/dev/tests/integration/testsuite/Magento/Backend/Model/UrlTest.php b/dev/tests/integration/testsuite/Magento/Backend/Model/UrlTest.php
index 32cc75afa7acc..ae29a37679536 100644
--- a/dev/tests/integration/testsuite/Magento/Backend/Model/UrlTest.php
+++ b/dev/tests/integration/testsuite/Magento/Backend/Model/UrlTest.php
@@ -75,6 +75,9 @@ public function testGetUrl()
];
$url = $this->_model->getUrl('path', $routeParams);
$this->assertContains('/param4/' . $paramEncoder->encode('a4==') . '/', $url);
+
+ $url = $this->_model->getUrl('route/controller/action/id/100');
+ $this->assertContains('id/100', $url);
}
/**
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/TypeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/TypeTest.php
index 516f67b234d4b..4b0d60ca3d8c6 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/TypeTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/TypeTest.php
@@ -20,7 +20,7 @@ protected function setUp()
}
/**
- * @param sring|null $typeId
+ * @param string|null $typeId
* @param string $expectedClass
* @dataProvider factoryDataProvider
*/
@@ -52,7 +52,7 @@ public function factoryDataProvider()
}
/**
- * @param sring|null $typeId
+ * @param string|null $typeId
* @dataProvider factoryReturnsSingletonDataProvider
*/
public function testFactoryReturnsSingleton($typeId)
@@ -82,7 +82,7 @@ public function factoryReturnsSingletonDataProvider()
}
/**
- * @param sring|null $typeId
+ * @param string|null $typeId
* @param string $expectedClass
* @dataProvider priceFactoryDataProvider
*/
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Category/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Category/CollectionTest.php
new file mode 100644
index 0000000000000..a81a2e2684b5a
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Category/CollectionTest.php
@@ -0,0 +1,65 @@
+collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ \Magento\Catalog\Model\ResourceModel\Category\Collection::class
+ );
+ }
+
+ protected function setDown()
+ {
+ /* Refresh stores memory cache after store deletion */
+ \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
+ \Magento\Store\Model\StoreManagerInterface::class
+ )->reinitStores();
+ }
+
+ /**
+ * @magentoAppIsolation enabled
+ * @magentoDbIsolation enabled
+ * @magentoDataFixture Magento/Catalog/Model/ResourceModel/_files/category_multiple_stores.php
+ */
+ public function testJoinUrlRewriteOnDefault()
+ {
+ $categories = $this->collection->joinUrlRewrite()->addPathFilter('1/2/3');
+ $this->assertCount(1, $categories);
+ /** @var $category \Magento\Catalog\Model\Category */
+ $category = $categories->getFirstItem();
+ $this->assertStringEndsWith('category.html', $category->getUrl());
+ }
+
+ /**
+ * @magentoAppIsolation enabled
+ * @magentoDbIsolation enabled
+ * @magentoDataFixture Magento/Catalog/Model/ResourceModel/_files/category_multiple_stores.php
+ */
+ public function testJoinUrlRewriteNotOnDefaultStore()
+ {
+ $store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->create(\Magento\Store\Model\Store::class);
+ $storeId = $store->load('second_category_store', 'code')->getId();
+ $categories = $this->collection->setStoreId($storeId)->joinUrlRewrite()->addPathFilter('1/2/3');
+ $this->assertCount(1, $categories);
+ /** @var $category \Magento\Catalog\Model\Category */
+ $category = $categories->getFirstItem();
+ $this->assertContains('category-3-on-2', $category->getUrl());
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/_files/category_multiple_stores.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/_files/category_multiple_stores.php
new file mode 100644
index 0000000000000..90bf630000e72
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/_files/category_multiple_stores.php
@@ -0,0 +1,66 @@
+create(
+ \Magento\Catalog\Model\CategoryFactory::class
+);
+/** @var \Magento\Catalog\Model\CategoryRepository $repository */
+$repository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ \Magento\Catalog\Model\CategoryRepository::class
+);
+/** @var \Magento\Store\Model\StoreManagerInterface $storeManager */
+$storeManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ \Magento\Store\Model\StoreManagerInterface::class
+);
+/** @var \Magento\Store\Model\Store $store */
+$store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Store\Model\Store::class);
+if (!$store->load('second_category_store', 'code')->getId()) {
+ $websiteId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
+ \Magento\Store\Model\StoreManagerInterface::class
+ )->getWebsite()->getId();
+ $groupId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
+ \Magento\Store\Model\StoreManagerInterface::class
+ )->getWebsite()->getDefaultGroupId();
+
+ $store->setCode(
+ 'second_category_store'
+ )->setWebsiteId(
+ $websiteId
+ )->setGroupId(
+ $groupId
+ )->setName(
+ 'Fixture Store'
+ )->setSortOrder(
+ 10
+ )->setIsActive(
+ 1
+ );
+ $store->save();
+}
+
+/* Refresh stores memory cache */
+\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
+ \Magento\Store\Model\StoreManagerInterface::class
+)->reinitStores();
+
+/** @var \Magento\Catalog\Model\Category $newCategory */
+$newCategory = $factory->create();
+$newCategory
+ ->setName('Category')
+ ->setParentId(2)
+ ->setLevel(2)
+ ->setPath('1/2/3')
+ ->setAvailableSortBy('name')
+ ->setDefaultSortBy('name')
+ ->setIsActive(true)
+ ->setPosition(1);
+$repository->save($newCategory);
+$currentStoreId = $storeManager->getStore()->getId();
+$storeManager->setCurrentStore($storeManager->getStore($store->getId()));
+$newCategory->setUrlKey('category-3-on-2');
+$repository->save($newCategory);
+$storeManager->setCurrentStore($storeManager->getStore($currentStoreId));
diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_with_product_links_data.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_with_product_links_data.php
index 040acf3b431a0..10ba3d30fab3b 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_with_product_links_data.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_with_product_links_data.php
@@ -7,7 +7,7 @@
require dirname(dirname(__DIR__)) . '/Catalog/_files/category.php';
/** Create fixture store */
require dirname(dirname(__DIR__)) . '/Store/_files/second_store.php';
-/** Create product with mulselect attribute */
+/** Create product with multiselect attribute */
require dirname(dirname(__DIR__)) . '/Catalog/_files/products_with_multiselect_attribute.php';
$productModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product');
diff --git a/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFilesTest.php b/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFilesTest.php
new file mode 100644
index 0000000000000..7df19684e1dac
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFilesTest.php
@@ -0,0 +1,92 @@
+get(\Magento\Framework\Filesystem::class);
+ /** @var \Magento\Cms\Helper\Wysiwyg\Images $imagesHelper */
+ $this->imagesHelper = $objectManager->get(\Magento\Cms\Helper\Wysiwyg\Images::class);
+ $this->mediaDirectory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
+ $this->fullDirectoryPath = $this->imagesHelper->getStorageRoot() . '/' . $directoryName;
+ $this->mediaDirectory->create($this->mediaDirectory->getRelativePath($this->fullDirectoryPath));
+ $filePath = $this->fullDirectoryPath . DIRECTORY_SEPARATOR . $this->fileName;
+ $fixtureDir = realpath(__DIR__ . '/../../../../../Catalog/_files');
+ copy($fixtureDir . '/' . $this->fileName, $filePath);
+ $this->model = $objectManager->get(\Magento\Cms\Controller\Adminhtml\Wysiwyg\Images\DeleteFiles::class);
+ }
+
+ /**
+ * Execute method with correct directory path and file name to check that files under WYSIWYG media directory
+ * can be removed.
+ *
+ * @return void
+ */
+ public function testExecute()
+ {
+ $this->model->getRequest()->setMethod('POST')
+ ->setPostValue('files', [$this->imagesHelper->idEncode($this->fileName)]);
+ $this->model->getStorage()->getSession()->setCurrentPath($this->fullDirectoryPath);
+ $this->model->execute();
+ $this->assertFalse(
+ $this->mediaDirectory->isExist(
+ $this->mediaDirectory->getRelativePath($this->fullDirectoryPath . '/' . $this->fileName)
+ )
+ );
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public static function tearDownAfterClass()
+ {
+ $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->get(\Magento\Framework\Filesystem::class);
+ /** @var \Magento\Framework\Filesystem\Directory\WriteInterface $directory */
+ $directory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
+ if ($directory->isExist('wysiwyg')) {
+ $directory->delete('wysiwyg');
+ }
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFolderTest.php b/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFolderTest.php
new file mode 100644
index 0000000000000..a7fc01af1fb98
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFolderTest.php
@@ -0,0 +1,84 @@
+get(\Magento\Framework\Filesystem::class);
+ $this->mediaDirectory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
+ /** @var \Magento\Cms\Helper\Wysiwyg\Images $imagesHelper */
+ $this->imagesHelper = $objectManager->get(\Magento\Cms\Helper\Wysiwyg\Images::class);
+ $this->fullDirectoryPath = $this->imagesHelper->getStorageRoot();
+ $this->model = $objectManager->get(\Magento\Cms\Controller\Adminhtml\Wysiwyg\Images\DeleteFolder::class);
+ }
+
+ /**
+ * Execute method with correct directory path to check that directories under WYSIWYG media directory can
+ * be removed.
+ *
+ * @return void
+ */
+ public function testExecute()
+ {
+ $directoryName = DIRECTORY_SEPARATOR . 'NewDirectory';
+ $this->mediaDirectory->create(
+ $this->mediaDirectory->getRelativePath($this->fullDirectoryPath . $directoryName)
+ );
+ $this->model->getRequest()->setParams(['node' => $this->imagesHelper->idEncode($directoryName)]);
+ $this->model->execute();
+ $this->assertFalse(
+ $this->mediaDirectory->isExist(
+ $this->mediaDirectory->getRelativePath($this->fullDirectoryPath . $directoryName)
+ )
+ );
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public static function tearDownAfterClass()
+ {
+ $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->get(\Magento\Framework\Filesystem::class);
+ /** @var \Magento\Framework\Filesystem\Directory\WriteInterface $directory */
+ $directory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
+ if ($directory->isExist('wysiwyg')) {
+ $directory->delete('wysiwyg');
+ }
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/NewFolderTest.php b/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/NewFolderTest.php
new file mode 100644
index 0000000000000..2a2d140a81722
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/NewFolderTest.php
@@ -0,0 +1,81 @@
+get(\Magento\Framework\Filesystem::class);
+ $this->mediaDirectory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
+ /** @var \Magento\Cms\Helper\Wysiwyg\Images $imagesHelper */
+ $imagesHelper = $objectManager->get(\Magento\Cms\Helper\Wysiwyg\Images::class);
+ $this->fullDirectoryPath = $imagesHelper->getStorageRoot();
+ $this->model = $objectManager->get(\Magento\Cms\Controller\Adminhtml\Wysiwyg\Images\NewFolder::class);
+ }
+
+ /**
+ * Execute method with correct directory path to check that new folder can be created under WYSIWYG media directory.
+ *
+ * @return void
+ */
+ public function testExecute()
+ {
+ $this->model->getRequest()->setMethod('POST')
+ ->setPostValue('name', $this->dirName);
+ $this->model->getStorage()->getSession()->setCurrentPath($this->fullDirectoryPath);
+ $this->model->execute();
+ $this->assertTrue(
+ $this->mediaDirectory->isExist(
+ $this->mediaDirectory->getRelativePath($this->fullDirectoryPath . DIRECTORY_SEPARATOR . $this->dirName)
+ )
+ );
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public static function tearDownAfterClass()
+ {
+ $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->get(\Magento\Framework\Filesystem::class);
+ /** @var \Magento\Framework\Filesystem\Directory\WriteInterface $directory */
+ $directory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
+ if ($directory->isExist('wysiwyg')) {
+ $directory->delete('wysiwyg');
+ }
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/UploadTest.php b/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/UploadTest.php
new file mode 100644
index 0000000000000..da6aa69bf4c65
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/UploadTest.php
@@ -0,0 +1,97 @@
+get(\Magento\Framework\Filesystem::class);
+ /** @var \Magento\Cms\Helper\Wysiwyg\Images $imagesHelper */
+ $imagesHelper = $objectManager->get(\Magento\Cms\Helper\Wysiwyg\Images::class);
+ $this->mediaDirectory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
+ $this->fullDirectoryPath = $imagesHelper->getStorageRoot() . DIRECTORY_SEPARATOR . $directoryName;
+ $this->mediaDirectory->create($this->mediaDirectory->getRelativePath($this->fullDirectoryPath));
+ $this->model = $objectManager->get(\Magento\Cms\Controller\Adminhtml\Wysiwyg\Images\Upload::class);
+ $fixtureDir = realpath(__DIR__ . '/../../../../../Catalog/_files');
+ $tmpFile = __DIR__ . DIRECTORY_SEPARATOR . $this->fileName;
+ copy($fixtureDir . DIRECTORY_SEPARATOR . $this->fileName, $tmpFile);
+ $_FILES = [
+ 'image' => [
+ 'name' => $this->fileName,
+ 'type' => 'image/png',
+ 'tmp_name' => $tmpFile,
+ 'error' => 0,
+ 'size' => filesize($fixtureDir),
+ ],
+ ];
+ }
+
+ /**
+ * Execute method with correct directory path and file name to check that file can be uploaded to the directory
+ * located under WYSIWYG media.
+ *
+ * @return void
+ */
+ public function testExecute()
+ {
+ $this->model->getRequest()->setParams(['type' => 'image/png']);
+ $this->model->getStorage()->getSession()->setCurrentPath($this->fullDirectoryPath);
+ $this->model->execute();
+ $this->assertTrue(
+ $this->mediaDirectory->isExist(
+ $this->mediaDirectory->getRelativePath(
+ $this->fullDirectoryPath . DIRECTORY_SEPARATOR . $this->fileName
+ )
+ )
+ );
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public static function tearDownAfterClass()
+ {
+ $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->get(\Magento\Framework\Filesystem::class);
+ /** @var \Magento\Framework\Filesystem\Directory\WriteInterface $directory */
+ $directory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
+ if ($directory->isExist('wysiwyg')) {
+ $directory->delete('wysiwyg');
+ }
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/delete_association.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/delete_association.php
index 0ccced2cbae0b..2b01fca898241 100644
--- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/delete_association.php
+++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/delete_association.php
@@ -5,7 +5,7 @@
*/
/** @var $product \Magento\Catalog\Model\Product */
-$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product');
+$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class);
$product->load(1001);
$product->setAssociatedProductIds([20]);
$product->save();
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Api/AddressRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Customer/Api/AddressRepositoryTest.php
index d6dcfde668930..a664a714ec340 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Api/AddressRepositoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Api/AddressRepositoryTest.php
@@ -14,6 +14,7 @@
*
* @SuppressWarnings(PHPMD.TooManyMethods)
* @SuppressWarnings(PHPMD.ExcessivePublicCount)
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class AddressRepositoryTest extends \PHPUnit_Framework_TestCase
{
@@ -35,11 +36,13 @@ class AddressRepositoryTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
- $this->repository = $this->_objectManager->create('Magento\Customer\Api\AddressRepositoryInterface');
- $this->_addressFactory = $this->_objectManager->create('Magento\Customer\Api\Data\AddressInterfaceFactory');
- $this->dataObjectHelper = $this->_objectManager->create('Magento\Framework\Api\DataObjectHelper');
+ $this->repository = $this->_objectManager->create(\Magento\Customer\Api\AddressRepositoryInterface::class);
+ $this->_addressFactory = $this->_objectManager->create(
+ \Magento\Customer\Api\Data\AddressInterfaceFactory::class
+ );
+ $this->dataObjectHelper = $this->_objectManager->create(\Magento\Framework\Api\DataObjectHelper::class);
- $regionFactory = $this->_objectManager->create('Magento\Customer\Api\Data\RegionInterfaceFactory');
+ $regionFactory = $this->_objectManager->create(\Magento\Customer\Api\Data\RegionInterfaceFactory::class);
$region = $regionFactory->create();
$region->setRegionCode('AL')
->setRegion('Alabama')
@@ -79,7 +82,7 @@ protected function tearDown()
{
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
/** @var \Magento\Customer\Model\CustomerRegistry $customerRegistry */
- $customerRegistry = $objectManager->get('Magento\Customer\Model\CustomerRegistry');
+ $customerRegistry = $objectManager->get(\Magento\Customer\Model\CustomerRegistry::class);
$customerRegistry->remove(1);
}
@@ -197,15 +200,59 @@ public function testSaveNewInvalidAddress()
->setId(null)
->setFirstname(null)
->setLastname(null)
- ->setCustomerId(1);
+ ->setCustomerId(1)
+ ->setRegionId($invalidRegion = 10354);
try {
$this->repository->save($address);
} catch (InputException $exception) {
- $this->assertEquals('One or more input exceptions have occurred.', $exception->getMessage());
+ $this->assertEquals(
+ InputException::DEFAULT_MESSAGE,
+ $exception->getMessage()
+ );
$errors = $exception->getErrors();
- $this->assertCount(2, $errors);
- $this->assertEquals('firstname is a required field.', $errors[0]->getLogMessage());
- $this->assertEquals('lastname is a required field.', $errors[1]->getLogMessage());
+ $this->assertCount(3, $errors);
+ $this->assertEquals(
+ 'firstname is a required field.',
+ $errors[0]->getLogMessage()
+ );
+ $this->assertEquals(
+ 'lastname is a required field.',
+ $errors[1]->getLogMessage()
+ );
+ $this->assertEquals(
+ __(
+ 'Invalid value of "%value" provided for the %fieldName field.',
+ ['fieldName'=>'regionId', 'value' => $invalidRegion]
+ ),
+ $errors[2]->getLogMessage()
+ );
+ }
+
+ $address->setCountryId($invalidCountry = 'invalid_id');
+ try {
+ $this->repository->save($address);
+ } catch (InputException $exception) {
+ $this->assertEquals(
+ InputException::DEFAULT_MESSAGE,
+ $exception->getMessage()
+ );
+ $errors = $exception->getErrors();
+ $this->assertCount(3, $errors);
+ $this->assertEquals(
+ 'firstname is a required field.',
+ $errors[0]->getLogMessage()
+ );
+ $this->assertEquals(
+ 'lastname is a required field.',
+ $errors[1]->getLogMessage()
+ );
+ $this->assertEquals(
+ __(
+ 'Invalid value of "%value" provided for the %fieldName field.',
+ ['fieldName'=>'countryId', 'value' => $invalidCountry]
+ ),
+ $errors[2]->getLogMessage()
+ );
}
}
@@ -304,7 +351,7 @@ public function testDeleteAddressFromCustomerBadAddressId()
public function testSearchAddresses($filters, $filterGroup, $expectedResult)
{
/** @var \Magento\Framework\Api\SearchCriteriaBuilder $searchBuilder */
- $searchBuilder = $this->_objectManager->create('Magento\Framework\Api\SearchCriteriaBuilder');
+ $searchBuilder = $this->_objectManager->create(\Magento\Framework\Api\SearchCriteriaBuilder::class);
foreach ($filters as $filter) {
$searchBuilder->addFilters([$filter]);
}
@@ -334,13 +381,16 @@ public function testSearchAddresses($filters, $filterGroup, $expectedResult)
}
}
+ /**
+ * @return array
+ */
public function searchAddressDataProvider()
{
/**
* @var \Magento\Framework\Api\FilterBuilder $filterBuilder
*/
$filterBuilder = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
- ->create('Magento\Framework\Api\FilterBuilder');
+ ->create(\Magento\Framework\Api\FilterBuilder::class);
return [
'Address with postcode 75477' => [
[$filterBuilder->setField('postcode')->setValue('75477')->create()],
@@ -357,7 +407,7 @@ public function searchAddressDataProvider()
null,
[
1 => ['city' => 'CityM', 'postcode' => 75477, 'firstname' => 'John'],
- 2 => ['city' => 'CityX', 'postcode' => 47676, 'firstname' => 'John']
+ 2 => ['city' => 'CityX', 'postcode' => 47676, 'firstname' => 'John'],
],
],
'Addresses with postcode of either 75477 or 47676' => [
@@ -368,7 +418,7 @@ public function searchAddressDataProvider()
],
[
1 => ['city' => 'CityM', 'postcode' => 75477, 'firstname' => 'John'],
- 2 => ['city' => 'CityX', 'postcode' => 47676, 'firstname' => 'John']
+ 2 => ['city' => 'CityX', 'postcode' => 47676, 'firstname' => 'John'],
],
],
'Addresses with postcode greater than 0' => [
@@ -376,7 +426,7 @@ public function searchAddressDataProvider()
null,
[
1 => ['city' => 'CityM', 'postcode' => 75477, 'firstname' => 'John'],
- 2 => ['city' => 'CityX', 'postcode' => 47676, 'firstname' => 'John']
+ 2 => ['city' => 'CityX', 'postcode' => 47676, 'firstname' => 'John'],
],
]
];
@@ -391,7 +441,7 @@ private function _createFirstAddress()
{
$address = $this->_addressFactory->create();
$this->dataObjectHelper->mergeDataObjects(
- '\Magento\Customer\Api\Data\AddressInterface',
+ \Magento\Customer\Api\Data\AddressInterface::class,
$address,
$this->_expectedAddresses[0]
);
@@ -409,7 +459,7 @@ private function _createSecondAddress()
{
$address = $this->_addressFactory->create();
$this->dataObjectHelper->mergeDataObjects(
- '\Magento\Customer\Api\Data\AddressInterface',
+ \Magento\Customer\Api\Data\AddressInterface::class,
$address,
$this->_expectedAddresses[1]
);
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Address/Renderer/DefaultRendererTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Address/Renderer/DefaultRendererTest.php
index c9736dfd684d8..ccf9d9957efb7 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Block/Address/Renderer/DefaultRendererTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Address/Renderer/DefaultRendererTest.php
@@ -56,7 +56,7 @@ public function renderArrayDataProvider()
[
$addressAttributes,
AttributeDataFactory::OUTPUT_FORMAT_PDF,
- "John Smith|\n\nGreen str, 67\n\n\n\n\nCityM,|\nAlabama, 75477|\nUnited States|\nT: 3468676|\n|\n|"
+ "John Smith|\n\nGreen str, 67|\n\n\n\nCityM, Alabama, 75477|\nUnited States|\nT: 3468676|\n|\n|"
],
[
$addressAttributes,
@@ -112,7 +112,7 @@ public function renderDataProvider()
[
$address,
AttributeDataFactory::OUTPUT_FORMAT_PDF,
- "John Smith|\n\nGreen str, 67\n\n\n\n\nCityM,|\nAlabama, 75477|
+ "John Smith|\n\nGreen str, 67|\n\n\n\nCityM, Alabama, 75477|
United States|\nT: 3468676|\n|\n|"
],
[
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/GroupManagementTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/GroupManagementTest.php
index 2f1242029026b..4e6509633b914 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/GroupManagementTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/GroupManagementTest.php
@@ -15,7 +15,7 @@
class GroupManagementTest extends \PHPUnit_Framework_TestCase
{
/**
- * @var \Magento\Framework\ObjectManagerInterface
+ * @var \Magento\TestFramework\ObjectManager
*/
protected $objectManager;
@@ -42,13 +42,13 @@ public function testGetDefaultGroupWithStoreId($testGroup, $storeId)
}
/**
- * @magentoDataFixture Magento/Store/_files/core_second_third_fixturestore.php
+ * @magentoDataFixture Magento/Store/_files/core_fixturestore.php
*/
public function testGetDefaultGroupWithNonDefaultStoreId()
{
/** @var \Magento\Store\Model\StoreManagerInterface $storeManager */
$storeManager = Bootstrap::getObjectManager()->get('Magento\Store\Model\StoreManagerInterface');
- $nonDefaultStore = $storeManager->getStore('secondstore');
+ $nonDefaultStore = $storeManager->getStore('fixturestore');
$nonDefaultStoreId = $nonDefaultStore->getId();
/** @var \Magento\Framework\App\MutableScopeConfig $scopeConfig */
$scopeConfig = $this->objectManager->get('Magento\Framework\App\MutableScopeConfig');
@@ -56,7 +56,7 @@ public function testGetDefaultGroupWithNonDefaultStoreId()
\Magento\Customer\Model\GroupManagement::XML_PATH_DEFAULT_ID,
2,
ScopeInterface::SCOPE_STORE,
- 'secondstore'
+ 'fixturestore'
);
$testGroup = ['id' => 2, 'code' => 'Wholesale', 'tax_class_id' => 3, 'tax_class_name' => 'Retail Customer'];
$this->assertDefaultGroupMatches($testGroup, $nonDefaultStoreId);
diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Filesystem/DirectoryResolverTest.php b/dev/tests/integration/testsuite/Magento/Framework/App/Filesystem/DirectoryResolverTest.php
new file mode 100644
index 0000000000000..c5e9f33c51a6c
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Framework/App/Filesystem/DirectoryResolverTest.php
@@ -0,0 +1,85 @@
+objectManager = Bootstrap::getObjectManager();
+ $this->directoryResolver = $this->objectManager
+ ->create(\Magento\Framework\App\Filesystem\DirectoryResolver::class);
+ /** @var \Magento\Framework\Filesystem $filesystem */
+ $filesystem = $this->objectManager->create(\Magento\Framework\Filesystem::class);
+ $this->directory = $filesystem->getDirectoryWrite(\Magento\Framework\App\Filesystem\DirectoryList::MEDIA);
+ }
+
+ /**
+ * @param string $path
+ * @param string $directoryConfig
+ * @param bool $expectation
+ * @dataProvider validatePathDataProvider
+ * @magentoAppIsolation enabled
+ */
+ public function testValidatePath($path, $directoryConfig, $expectation)
+ {
+ $path = $this->directory->getAbsolutePath($path);
+ $this->assertEquals($expectation, $this->directoryResolver->validatePath($path, $directoryConfig));
+ }
+
+ /**
+ * @expectedException \Magento\Framework\Exception\FileSystemException
+ * @magentoAppIsolation enabled
+ */
+ public function testValidatePathWithException()
+ {
+ $path = $this->directory->getAbsolutePath();
+ $this->directoryResolver->validatePath($path, 'wrong_dir');
+ }
+
+ /**
+ * @return array
+ */
+ public function validatePathDataProvider()
+ {
+ return [
+ [
+ '/',
+ DirectoryList::MEDIA,
+ true,
+ ],
+ [
+ '/../../pub/',
+ DirectoryList::MEDIA,
+ false,
+ ],
+ ];
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Data/Form/Element/FieldsetTest.php b/dev/tests/integration/testsuite/Magento/Framework/Data/Form/Element/FieldsetTest.php
index fc26b7b520abf..2f93cabbdd501 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Data/Form/Element/FieldsetTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Data/Form/Element/FieldsetTest.php
@@ -246,7 +246,7 @@ public function getSubFieldsetDataProvider()
$fieldsetField = $textField;
$fieldsetField[1] = 'fieldset';
$advancedFieldsetFld = $fieldsetField;
- // set isAdvenced flag
+ // set isAdvanced flag
$advancedFieldsetFld[4] = true;
$result = [[[$fieldsetField, $textField, $advancedFieldsetFld], 1]];
return $result;
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Mview/View/ChangelogTest.php b/dev/tests/integration/testsuite/Magento/Framework/Mview/View/ChangelogTest.php
index 8af3c8cfe1b7a..73b4d6a637ce5 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Mview/View/ChangelogTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Mview/View/ChangelogTest.php
@@ -126,14 +126,14 @@ public function testGetList()
$this->assertEquals(0, $this->model->getVersion());
//the same that a table is empty
$changelogName = $this->resource->getTableName($this->model->getName());
- $testChengelogData = [
+ $testChangelogData = [
['version_id' => 1, 'entity_id' => 1],
['version_id' => 2, 'entity_id' => 1],
['version_id' => 3, 'entity_id' => 2],
['version_id' => 4, 'entity_id' => 3],
['version_id' => 5, 'entity_id' => 1],
];
- foreach ($testChengelogData as $data) {
+ foreach ($testChangelogData as $data) {
$this->connection->insert($changelogName, $data);
}
$this->assertEquals(5, $this->model->getVersion());
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Session/SessionManagerTest.php b/dev/tests/integration/testsuite/Magento/Framework/Session/SessionManagerTest.php
index 6f5d84be3f56c..8b781ba05401e 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Session/SessionManagerTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Session/SessionManagerTest.php
@@ -9,6 +9,8 @@
}
namespace Magento\Framework\Session {
+
+ use Magento\Framework\App\State;
// @codingStandardsIgnoreEnd
/**
@@ -34,6 +36,11 @@ function headers_sent()
return call_user_func_array('\headers_sent', func_get_args());
}
+ /**
+ * Class to test session manager.
+ *
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ */
class SessionManagerTest extends \PHPUnit_Framework_TestCase
{
/**
@@ -56,6 +63,16 @@ class SessionManagerTest extends \PHPUnit_Framework_TestCase
*/
protected $objectManager;
+ /**
+ * @var \Magento\Framework\App\RequestInterface
+ */
+ private $request;
+
+ /**
+ * @var State|\PHPUnit_Framework_MockObject_MockObject
+ */
+ private $appState;
+
protected function setUp()
{
$this->sessionName = 'frontEndSession';
@@ -65,21 +82,31 @@ protected function setUp()
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
- /** @var \Magento\Framework\Session\SidResolverInterface $sidResolver */
- $this->_sidResolver = $this->objectManager->get('Magento\Framework\Session\SidResolverInterface');
+ $this->appState = $this->getMockBuilder(State::class)
+ ->setMethods(['getAreaCode'])
+ ->disableOriginalConstructor()
+ ->getMock();
- $this->request = $this->objectManager->get('Magento\Framework\App\RequestInterface');
+ /** @var \Magento\Framework\Session\SidResolver $sidResolver */
+ $this->_sidResolver = $this->objectManager->create(
+ \Magento\Framework\Session\SidResolver::class,
+ [
+ 'appState' => $this->appState
+ ]
+ );
+
+ $this->request = $this->objectManager->get(\Magento\Framework\App\RequestInterface::class);
/** @var \Magento\Framework\Session\SessionManager _model */
$this->_model = $this->objectManager->create(
- 'Magento\Framework\Session\SessionManager',
+ \Magento\Framework\Session\SessionManager::class,
[
- $this->objectManager->get('Magento\Framework\App\Request\Http'),
+ $this->objectManager->get(\Magento\Framework\App\Request\Http::class),
$this->_sidResolver,
- $this->objectManager->get('Magento\Framework\Session\Config\ConfigInterface'),
- $this->objectManager->get('Magento\Framework\Session\SaveHandlerInterface'),
- $this->objectManager->get('Magento\Framework\Session\ValidatorInterface'),
- $this->objectManager->get('Magento\Framework\Session\StorageInterface')
+ $this->objectManager->get(\Magento\Framework\Session\Config\ConfigInterface::class),
+ $this->objectManager->get(\Magento\Framework\Session\SaveHandlerInterface::class),
+ $this->objectManager->get(\Magento\Framework\Session\ValidatorInterface::class),
+ $this->objectManager->get(\Magento\Framework\Session\StorageInterface::class)
]
);
}
@@ -135,6 +162,9 @@ public function testDestroy()
public function testSetSessionId()
{
$sessionId = $this->_model->getSessionId();
+ $this->appState->expects($this->atLeastOnce())
+ ->method('getAreaCode')
+ ->willReturn(\Magento\Framework\App\Area::AREA_FRONTEND);
$this->_model->setSessionId($this->_sidResolver->getSid($this->_model));
$this->assertEquals($sessionId, $this->_model->getSessionId());
@@ -147,6 +177,9 @@ public function testSetSessionId()
*/
public function testSetSessionIdFromParam()
{
+ $this->appState->expects($this->atLeastOnce())
+ ->method('getAreaCode')
+ ->willReturn(\Magento\Framework\App\Area::AREA_FRONTEND);
$this->assertNotEquals('test_id', $this->_model->getSessionId());
$this->request->getQuery()->set($this->_sidResolver->getSessionIdQueryParam($this->_model), 'test-id');
$this->_model->setSessionId($this->_sidResolver->getSid($this->_model));
@@ -180,7 +213,6 @@ public function testIsValidForHost()
$this->_model->destroy();
}
-
/**
* @expectedException \Magento\Framework\Exception\SessionException
* @expectedExceptionMessage Area code not set: Area code must be set before starting a session.
@@ -197,14 +229,14 @@ public function testStartAreaNotSet()
* @var \Magento\Framework\Session\SessionManager _model
*/
$this->_model = new \Magento\Framework\Session\SessionManager(
- $this->objectManager->get('Magento\Framework\App\Request\Http'),
+ $this->objectManager->get(\Magento\Framework\App\Request\Http::class),
$this->_sidResolver,
- $this->objectManager->get('Magento\Framework\Session\Config\ConfigInterface'),
- $this->objectManager->get('Magento\Framework\Session\SaveHandlerInterface'),
- $this->objectManager->get('Magento\Framework\Session\ValidatorInterface'),
- $this->objectManager->get('Magento\Framework\Session\StorageInterface'),
- $this->objectManager->get('Magento\Framework\Stdlib\CookieManagerInterface'),
- $this->objectManager->get('Magento\Framework\Stdlib\Cookie\CookieMetadataFactory'),
+ $this->objectManager->get(\Magento\Framework\Session\Config\ConfigInterface::class),
+ $this->objectManager->get(\Magento\Framework\Session\SaveHandlerInterface::class),
+ $this->objectManager->get(\Magento\Framework\Session\ValidatorInterface::class),
+ $this->objectManager->get(\Magento\Framework\Session\StorageInterface::class),
+ $this->objectManager->get(\Magento\Framework\Stdlib\CookieManagerInterface::class),
+ $this->objectManager->get(\Magento\Framework\Stdlib\Cookie\CookieMetadataFactory::class),
$appState
);
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Session/SidResolverTest.php b/dev/tests/integration/testsuite/Magento/Framework/Session/SidResolverTest.php
index 651286707222e..91e7fea0d2021 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Session/SidResolverTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Session/SidResolverTest.php
@@ -5,6 +5,7 @@
*/
namespace Magento\Framework\Session;
+use Magento\Framework\App\State;
use Zend\Stdlib\Parameters;
class SidResolverTest extends \PHPUnit_Framework_TestCase
@@ -49,34 +50,45 @@ class SidResolverTest extends \PHPUnit_Framework_TestCase
*/
protected $request;
+ /**
+ * @var State|\PHPUnit_Framework_MockObject_MockObject
+ */
+ private $appState;
+
protected function setUp()
{
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
/** @var \Magento\Framework\Session\Generic _model */
- $this->session = $objectManager->get('Magento\Framework\Session\Generic');
+ $this->session = $objectManager->get(\Magento\Framework\Session\Generic::class);
$this->scopeConfig = $this->getMockBuilder(
- 'Magento\Framework\App\Config\ScopeConfigInterface'
+ \Magento\Framework\App\Config\ScopeConfigInterface::class
)->setMethods(
['getValue']
)->disableOriginalConstructor()->getMockForAbstractClass();
$this->urlBuilder = $this->getMockBuilder(
- 'Magento\Framework\Url'
+ \Magento\Framework\Url::class
)->setMethods(
['isOwnOriginUrl']
)->disableOriginalConstructor()->getMockForAbstractClass();
- $this->request = $objectManager->get('Magento\Framework\App\RequestInterface');
+ $this->request = $objectManager->get(\Magento\Framework\App\RequestInterface::class);
+
+ $this->appState = $this->getMockBuilder(State::class)
+ ->setMethods(['getAreaCode'])
+ ->disableOriginalConstructor()
+ ->getMock();
$this->model = $objectManager->create(
- 'Magento\Framework\Session\SidResolver',
+ \Magento\Framework\Session\SidResolver::class,
[
'scopeConfig' => $this->scopeConfig,
'urlBuilder' => $this->urlBuilder,
'sidNameMap' => [$this->customSessionName => $this->customSessionQueryParam],
'request' => $this->request,
+ 'appState' => $this->appState,
]
);
}
@@ -95,6 +107,10 @@ public function tearDown()
*/
public function testGetSid($sid, $useFrontedSid, $isOwnOriginUrl, $testSid)
{
+ $this->appState->expects($this->atLeastOnce())
+ ->method('getAreaCode')
+ ->willReturn(\Magento\Framework\App\Area::AREA_FRONTEND);
+
$this->scopeConfig->expects(
$this->any()
)->method(
diff --git a/dev/tests/integration/testsuite/Magento/Framework/TranslateCachingTest.php b/dev/tests/integration/testsuite/Magento/Framework/TranslateCachingTest.php
index 2d68951eaec81..6b58e8d8bf109 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/TranslateCachingTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/TranslateCachingTest.php
@@ -48,7 +48,7 @@ public function testLoadDataCaching()
/** @var \Magento\Framework\Translate $model */
$model = $this->objectManager->get('Magento\Framework\Translate');
- $model->loadData(\Magento\Framework\App\Area::AREA_FRONTEND); // this is supposed to cache the fixture
+ $model->loadData(\Magento\Framework\App\Area::AREA_FRONTEND, true); // this is supposed to cache the fixture
$this->assertEquals('Fixture Db Translation', new Phrase('Fixture String'));
/** @var \Magento\Translation\Model\ResourceModel\StringUtils $translateString */
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/LayoutDirectivesTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/LayoutDirectivesTest.php
index 2334daeea47c5..f51b90175311e 100755
--- a/dev/tests/integration/testsuite/Magento/Framework/View/LayoutDirectivesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/LayoutDirectivesTest.php
@@ -198,6 +198,18 @@ public function testRemove()
$this->assertTrue($layout->isBlock('child_block2'));
}
+ /**
+ * @magentoAppIsolation enabled
+ */
+ public function testRemoveCancellation()
+ {
+ $layout = $this->_getLayoutModel('remove_cancellation.xml');
+ $this->assertTrue($layout->isContainer('container1'));
+ $this->assertTrue($layout->isBlock('child_block1'));
+ $this->assertTrue($layout->isBlock('no_name2'));
+ $this->assertFalse($layout->getBlock('not_exist'));
+ }
+
/**
* @magentoAppIsolation enabled
*/
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/_files/layout_directives_test/remove_cancellation.xml b/dev/tests/integration/testsuite/Magento/Framework/View/_files/layout_directives_test/remove_cancellation.xml
new file mode 100644
index 0000000000000..4e73e625aa5ce
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/_files/layout_directives_test/remove_cancellation.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dev/tests/integration/testsuite/Magento/Quote/Model/Quote/AddressTest.php b/dev/tests/integration/testsuite/Magento/Quote/Model/Quote/AddressTest.php
index c05a717ccd917..a3e09a921ca93 100644
--- a/dev/tests/integration/testsuite/Magento/Quote/Model/Quote/AddressTest.php
+++ b/dev/tests/integration/testsuite/Magento/Quote/Model/Quote/AddressTest.php
@@ -221,7 +221,7 @@ public function testImportCustomerAddressDataWithCustomer()
->setLastname('Doe')
->setTelephone('123456')
->setPostcode('12345')
- ->setCountryId(1)
+ ->setCountryId('US')
->setCity($city)
->setStreet([$street]);
$addressData = $addressRepository->save($addressData);
diff --git a/dev/tests/integration/testsuite/Magento/Search/Model/SearchEngine/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Search/Model/SearchEngine/ConfigTest.php
index a1561bac90a22..2036a02766321 100644
--- a/dev/tests/integration/testsuite/Magento/Search/Model/SearchEngine/ConfigTest.php
+++ b/dev/tests/integration/testsuite/Magento/Search/Model/SearchEngine/ConfigTest.php
@@ -17,7 +17,7 @@ protected function setUp()
$xmlPath = __DIR__ . '/../../_files/search_engine.xml';
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
- // Clear out the clache
+ // Clear out the cache
$cacheManager = $objectManager->create('Magento\Framework\App\Cache\Manager');
/** @var \Magento\Framework\App\Cache\Manager $cacheManager */
$cacheManager->clean($cacheManager->getAvailableTypes());
diff --git a/dev/tests/static/framework/Magento/Sniffs/Less/ZeroUnitsSniff.php b/dev/tests/static/framework/Magento/Sniffs/Less/ZeroUnitsSniff.php
index ec47f338e4731..d838af96f656f 100644
--- a/dev/tests/static/framework/Magento/Sniffs/Less/ZeroUnitsSniff.php
+++ b/dev/tests/static/framework/Magento/Sniffs/Less/ZeroUnitsSniff.php
@@ -25,7 +25,7 @@ class ZeroUnitsSniff implements PHP_CodeSniffer_Sniff
const CSS_PROPERTY_UNIT_REM = 'rem';
/**
- * List of available CSS Propery units
+ * List of available CSS Property units
*
* @var array
*/
diff --git a/dev/tests/static/testsuite/Magento/Test/Less/LiveCodeTest.php b/dev/tests/static/testsuite/Magento/Test/Less/LiveCodeTest.php
index 1148c2af9ed15..02654a606a74f 100644
--- a/dev/tests/static/testsuite/Magento/Test/Less/LiveCodeTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Less/LiveCodeTest.php
@@ -43,7 +43,7 @@ public static function setUpBeforeClass()
*/
public function testCodeStyle()
{
- $reportFile = self::$reportDir . '/less_report.txt';
+ $reportFile = self::$reportDir . '/csless_report.txt';
$wrapper = new LessWrapper();
$codeSniffer = new CodeSniffer(realpath(__DIR__ . '/_files/lesscs'), $reportFile, $wrapper);
@@ -57,10 +57,11 @@ public function testCodeStyle()
$result = $codeSniffer->run($this->filterFiles($fileList));
+ $report = file_exists($reportFile) ? file_get_contents($reportFile) : "";
$this->assertEquals(
0,
$result,
- "PHP Code Sniffer has found {$result} error(s): See detailed report in {$reportFile}"
+ "PHP Code Sniffer has found {$result} error(s): " . PHP_EOL . $report
);
}
diff --git a/dev/tests/static/testsuite/Magento/Test/Less/_files/whitelist/common.txt b/dev/tests/static/testsuite/Magento/Test/Less/_files/whitelist/common.txt
index 4e4fbefd7871d..b956b972bc5a3 100644
--- a/dev/tests/static/testsuite/Magento/Test/Less/_files/whitelist/common.txt
+++ b/dev/tests/static/testsuite/Magento/Test/Less/_files/whitelist/common.txt
@@ -1,2 +1,2 @@
-theme * /
-library * /
\ No newline at end of file
+# Format: or simply
+* * /
\ No newline at end of file
diff --git a/lib/internal/GnuFreeFont/FreeSerif.ttf b/lib/internal/GnuFreeFont/FreeSerif.ttf
new file mode 100644
index 0000000000000..889c594f6674e
Binary files /dev/null and b/lib/internal/GnuFreeFont/FreeSerif.ttf differ
diff --git a/lib/internal/GnuFreeFont/FreeSerifBold.ttf b/lib/internal/GnuFreeFont/FreeSerifBold.ttf
new file mode 100644
index 0000000000000..49112d3a92c96
Binary files /dev/null and b/lib/internal/GnuFreeFont/FreeSerifBold.ttf differ
diff --git a/lib/internal/GnuFreeFont/FreeSerifItalic.ttf b/lib/internal/GnuFreeFont/FreeSerifItalic.ttf
new file mode 100644
index 0000000000000..4ea68896dc3d3
Binary files /dev/null and b/lib/internal/GnuFreeFont/FreeSerifItalic.ttf differ
diff --git a/lib/internal/Magento/Framework/App/Cache/Frontend/Factory.php b/lib/internal/Magento/Framework/App/Cache/Frontend/Factory.php
index 58f18f2b5c745..69f4bc1f0042d 100644
--- a/lib/internal/Magento/Framework/App/Cache/Frontend/Factory.php
+++ b/lib/internal/Magento/Framework/App/Cache/Frontend/Factory.php
@@ -68,7 +68,6 @@ class Factory
*/
protected $_backendOptions = [
'hashed_directory_level' => 1,
- 'hashed_directory_umask' => 0777,
'file_name_prefix' => 'mage',
];
diff --git a/lib/internal/Magento/Framework/App/DeploymentConfig.php b/lib/internal/Magento/Framework/App/DeploymentConfig.php
index 0eebc1ca40a34..66c7ad00df1a7 100644
--- a/lib/internal/Magento/Framework/App/DeploymentConfig.php
+++ b/lib/internal/Magento/Framework/App/DeploymentConfig.php
@@ -115,7 +115,7 @@ public function resetData()
}
/**
- * Check if data from deploy files is avaiable
+ * Check if data from deploy files is available
*
* @return bool
*/
diff --git a/lib/internal/Magento/Framework/App/Filesystem/DirectoryResolver.php b/lib/internal/Magento/Framework/App/Filesystem/DirectoryResolver.php
new file mode 100644
index 0000000000000..26aefda834f9d
--- /dev/null
+++ b/lib/internal/Magento/Framework/App/Filesystem/DirectoryResolver.php
@@ -0,0 +1,46 @@
+directoryList = $directoryList;
+ }
+
+ /**
+ * Validate path.
+ *
+ * Gets real path for directory provided in parameters and compares it with specified root directory.
+ * Will return TRUE if real path of provided value contains root directory path and FALSE if not.
+ * Throws the \Magento\Framework\Exception\FileSystemException in case when directory path is absent
+ * in Directories configuration.
+ *
+ * @param string $path
+ * @param string $directoryConfig
+ * @return bool
+ * @throws \Magento\Framework\Exception\FileSystemException
+ */
+ public function validatePath($path, $directoryConfig = DirectoryList::MEDIA)
+ {
+ $realPath = realpath($path);
+ $root = $this->directoryList->getPath($directoryConfig);
+
+ return strpos($realPath, $root) === 0;
+ }
+}
diff --git a/lib/internal/Magento/Framework/App/StaticResource.php b/lib/internal/Magento/Framework/App/StaticResource.php
index b7c1f0d869409..56f1c2ef3bcd0 100644
--- a/lib/internal/Magento/Framework/App/StaticResource.php
+++ b/lib/internal/Magento/Framework/App/StaticResource.php
@@ -127,9 +127,12 @@ protected function parsePath($path)
{
$path = ltrim($path, '/');
$parts = explode('/', $path, 6);
- if (count($parts) < 5) {
+ if (count($parts) < 5 || mb_strpos($path, '..') !== false) {
+ //Checking that path contains all required parts and is not above
+ //static folder.
throw new \InvalidArgumentException("Requested path '$path' is wrong.");
}
+
$result = [];
$result['area'] = $parts[0];
$result['theme'] = $parts[1] . '/' . $parts[2];
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/StaticResourceTest.php b/lib/internal/Magento/Framework/App/Test/Unit/StaticResourceTest.php
index b494f07a291c2..36c2e9bc4efae 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/StaticResourceTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/StaticResourceTest.php
@@ -9,12 +9,17 @@
namespace Magento\Framework\App\Test\Unit;
use Magento\Framework\App\Bootstrap;
-use Magento\Framework\Filesystem;
+use Magento\Framework\App\State;
+/**
+ * Tests Magento\Framework\App\StaticResource.
+ *
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ */
class StaticResourceTest extends \PHPUnit_Framework_TestCase
{
/**
- * @var \Magento\Framework\App\State|\PHPUnit_Framework_MockObject_MockObject
+ * @var State|\PHPUnit_Framework_MockObject_MockObject
*/
private $state;
@@ -60,15 +65,15 @@ class StaticResourceTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->state = $this->getMock('Magento\Framework\App\State', [], [], '', false);
- $this->response = $this->getMock('Magento\MediaStorage\Model\File\Storage\Response', [], [], '', false);
- $this->request = $this->getMock('Magento\Framework\App\Request\Http', [], [], '', false);
- $this->publisher = $this->getMock('Magento\Framework\App\View\Asset\Publisher', [], [], '', false);
- $this->assetRepo = $this->getMock('Magento\Framework\View\Asset\Repository', [], [], '', false);
- $this->moduleList = $this->getMock('Magento\Framework\Module\ModuleList', [], [], '', false);
- $this->objectManager = $this->getMockForAbstractClass('Magento\Framework\ObjectManagerInterface');
+ $this->state = $this->getMock(State::class, [], [], '', false);
+ $this->response = $this->getMock(\Magento\MediaStorage\Model\File\Storage\Response::class, [], [], '', false);
+ $this->request = $this->getMock(\Magento\Framework\App\Request\Http::class, [], [], '', false);
+ $this->publisher = $this->getMock(\Magento\Framework\App\View\Asset\Publisher::class, [], [], '', false);
+ $this->assetRepo = $this->getMock(\Magento\Framework\View\Asset\Repository::class, [], [], '', false);
+ $this->moduleList = $this->getMock(\Magento\Framework\Module\ModuleList::class, [], [], '', false);
+ $this->objectManager = $this->getMockForAbstractClass(\Magento\Framework\ObjectManagerInterface::class);
$this->configLoader = $this->getMock(
- 'Magento\Framework\App\ObjectManager\ConfigLoader', [], [], '', false
+ \Magento\Framework\App\ObjectManager\ConfigLoader::class, [], [], '', false
);
$this->object = new \Magento\Framework\App\StaticResource(
$this->state,
@@ -79,7 +84,7 @@ protected function setUp()
$this->moduleList,
$this->objectManager,
$this->configLoader,
- $this->getMockForAbstractClass('\Magento\Framework\View\DesignInterface')
+ $this->getMockForAbstractClass(\Magento\Framework\View\DesignInterface::class)
);
}
@@ -87,7 +92,7 @@ public function testLaunchProductionMode()
{
$this->state->expects($this->once())
->method('getMode')
- ->will($this->returnValue(\Magento\Framework\App\State::MODE_PRODUCTION));
+ ->will($this->returnValue(State::MODE_PRODUCTION));
$this->response->expects($this->once())
->method('setHttpResponseCode')
->with(404);
@@ -135,7 +140,7 @@ public function testLaunch(
->method('has')
->with($requestedModule)
->will($this->returnValue($moduleExists));
- $asset = $this->getMockForAbstractClass('\Magento\Framework\View\Asset\LocalInterface');
+ $asset = $this->getMockForAbstractClass(\Magento\Framework\View\Asset\LocalInterface::class);
$asset->expects($this->once())->method('getSourceFile')->will($this->returnValue('resource/file.css'));
$this->assetRepo->expects($this->once())
->method('createAsset')
@@ -155,7 +160,7 @@ public function launchDataProvider()
{
return [
'developer mode with non-modular resource' => [
- \Magento\Framework\App\State::MODE_DEVELOPER,
+ State::MODE_DEVELOPER,
'area/Magento/theme/locale/dir/file.js',
'dir',
false,
@@ -163,7 +168,7 @@ public function launchDataProvider()
['area' => 'area', 'locale' => 'locale', 'module' => '', 'theme' => 'Magento/theme'],
],
'default mode with modular resource' => [
- \Magento\Framework\App\State::MODE_DEFAULT,
+ State::MODE_DEFAULT,
'area/Magento/theme/locale/Namespace_Module/dir/file.js',
'Namespace_Module',
true,
@@ -183,7 +188,7 @@ public function testLaunchWrongPath()
{
$this->state->expects($this->once())
->method('getMode')
- ->will($this->returnValue(\Magento\Framework\App\State::MODE_DEVELOPER));
+ ->will($this->returnValue(State::MODE_DEVELOPER));
$this->request->expects($this->once())
->method('get')
->with('resource')
@@ -200,4 +205,24 @@ public function testCatchExceptionDeveloperMode()
$this->response->expects($this->once())->method('sendResponse');
$this->assertTrue($this->object->catchException($bootstrap, $exception));
}
+
+ /**
+ * @expectedException \InvalidArgumentException
+ */
+ public function testLaunchPathAbove()
+ {
+ $this->state->expects($this->once())
+ ->method('getMode')
+ ->will($this->returnValue(State::MODE_DEVELOPER));
+ $this->request->expects($this->once())
+ ->method('get')
+ ->with('resource')
+ ->will(
+ $this->returnValue(
+ 'frontend/..\..\folder_above'
+ . '/././Magento_Ui/template/messages.html'
+ )
+ );
+ $this->object->launch();
+ }
}
diff --git a/lib/internal/Magento/Framework/Console/Cli.php b/lib/internal/Magento/Framework/Console/Cli.php
index a0327ebe1202c..288657cd6c613 100644
--- a/lib/internal/Magento/Framework/Console/Cli.php
+++ b/lib/internal/Magento/Framework/Console/Cli.php
@@ -17,6 +17,7 @@
use Magento\Framework\Shell\ComplexParameter;
use Magento\Setup\Console\CompilerPreparation;
use \Magento\Framework\App\ProductMetadata;
+use Magento\Framework\App\State;
/**
* Magento 2 CLI Application. This is the hood for all command line tools supported by Magento
@@ -47,6 +48,11 @@ class Cli extends SymfonyApplication
*/
private $initException;
+ /**
+ * @var \Magento\Framework\ObjectManagerInterface
+ */
+ private $objectManager;
+
/**
* @param string $name application name
* @param string $version application version
@@ -56,15 +62,7 @@ public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
{
$this->serviceManager = \Zend\Mvc\Application::init(require BP . '/setup/config/application.config.php')
->getServiceManager();
- $generationDirectoryAccess = new GenerationDirectoryAccess($this->serviceManager);
- if (!$generationDirectoryAccess->check()) {
- $output = new ConsoleOutput();
- $output->writeln(
- 'Command line user does not have read and write permissions on var/generation directory. Please'
- . ' address this issue before using Magento command line. '
- );
- exit(0);
- }
+
/**
* Temporary workaround until the compiler is able to clear the generation directory
* @todo remove after MAGETWO-44493 resolved
@@ -74,6 +72,21 @@ public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
$compilerPreparation->handleCompilerEnvironment();
}
+ $bootstrapParam = new ComplexParameter(self::INPUT_KEY_BOOTSTRAP);
+ $params = $bootstrapParam->mergeFromArgv($_SERVER, $_SERVER);
+ $params[Bootstrap::PARAM_REQUIRE_MAINTENANCE] = null;
+ $bootstrap = Bootstrap::create(BP, $params);
+ $this->objectManager = $bootstrap->getObjectManager();
+
+ if ($this->checkGenerationDirectoryAccess()) {
+ $output = new ConsoleOutput();
+ $output->writeln(
+ 'Command line user does not have read and write permissions on var/generation directory. Please'
+ . ' address this issue before using Magento command line. '
+ );
+ exit(0);
+ }
+
if ($version == 'UNKNOWN') {
$directoryList = new DirectoryList(BP);
$composerJsonFinder = new ComposerJsonFinder($directoryList);
@@ -83,6 +96,22 @@ public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
parent::__construct($name, $version);
}
+ /**
+ * Check generation directory access.
+ *
+ * Skip and return true if production mode is enabled.
+ *
+ * @return bool
+ */
+ private function checkGenerationDirectoryAccess()
+ {
+ $generationDirectoryAccess = new GenerationDirectoryAccess($this->serviceManager);
+ /** @var State $state */
+ $state = $this->objectManager->create(State::class);
+
+ return $state->getMode() !== State::MODE_PRODUCTION && !$generationDirectoryAccess->check();
+ }
+
/**
* Process an error happened during initialization of commands, if any
*
@@ -121,31 +150,25 @@ protected function getApplicationCommands()
{
$commands = [];
try {
- $bootstrapParam = new ComplexParameter(self::INPUT_KEY_BOOTSTRAP);
- $params = $bootstrapParam->mergeFromArgv($_SERVER, $_SERVER);
- $params[Bootstrap::PARAM_REQUIRE_MAINTENANCE] = null;
- $bootstrap = Bootstrap::create(BP, $params);
- $objectManager = $bootstrap->getObjectManager();
-
// Specialized setup command list available before and after M2 install
if (class_exists('Magento\Setup\Console\CommandList')
&& class_exists('Magento\Setup\Model\ObjectManagerProvider')
) {
/** @var \Magento\Setup\Model\ObjectManagerProvider $omProvider */
$omProvider = $this->serviceManager->get(\Magento\Setup\Model\ObjectManagerProvider::class);
- $omProvider->setObjectManager($objectManager);
+ $omProvider->setObjectManager($this->objectManager);
$setupCommandList = new \Magento\Setup\Console\CommandList($this->serviceManager);
$commands = array_merge($commands, $setupCommandList->getCommands());
}
// Allowing instances of all modular commands only after M2 install
- if ($objectManager->get(\Magento\Framework\App\DeploymentConfig::class)->isAvailable()) {
+ if ($this->objectManager->get(\Magento\Framework\App\DeploymentConfig::class)->isAvailable()) {
/** @var \Magento\Framework\Console\CommandListInterface $commandList */
- $commandList = $objectManager->create(\Magento\Framework\Console\CommandListInterface::class);
+ $commandList = $this->objectManager->create(\Magento\Framework\Console\CommandListInterface::class);
$commands = array_merge($commands, $commandList->getCommands());
}
- $commands = array_merge($commands, $this->getVendorCommands($objectManager));
+ $commands = array_merge($commands, $this->getVendorCommands($this->objectManager));
} catch (\Exception $e) {
$this->initException = $e;
}
diff --git a/lib/internal/Magento/Framework/DB/Adapter/AdapterInterface.php b/lib/internal/Magento/Framework/DB/Adapter/AdapterInterface.php
index 5cba5bd3e8058..c576a060730ea 100644
--- a/lib/internal/Magento/Framework/DB/Adapter/AdapterInterface.php
+++ b/lib/internal/Magento/Framework/DB/Adapter/AdapterInterface.php
@@ -492,6 +492,13 @@ public function insertForce($table, array $bind);
/**
* Updates table rows with specified data based on a WHERE clause.
*
+ * The $where parameter in this instance can be a single WHERE clause or an array containing a multiple. In all
+ * instances, a WHERE clause can be a string or an instance of {@see Zend_Db_Expr}. In the event you use an array,
+ * you may specify the clause as the key and a value to be bound to it as the value. E.g., ['amt > ?' => $amt]
+ *
+ * If the $where parameter is an array of multiple clauses, they will be joined by AND, with each clause wrapped in
+ * parenthesis. If you wish to use an OR, you must give a single clause that is an instance of {@see Zend_Db_Expr}
+ *
* @param mixed $table The table to update.
* @param array $bind Column-value pairs.
* @param mixed $where UPDATE WHERE clause(s).
@@ -928,7 +935,6 @@ public function getDateExtractSql($date, $unit);
*/
public function getTableName($tableName);
-
/**
* Build a trigger name based on table name and trigger details
*
diff --git a/lib/internal/Magento/Framework/Data/Form/Element/Date.php b/lib/internal/Magento/Framework/Data/Form/Element/Date.php
index ef85876521d23..c4661c92e8c49 100644
--- a/lib/internal/Magento/Framework/Data/Form/Element/Date.php
+++ b/lib/internal/Magento/Framework/Data/Form/Element/Date.php
@@ -167,6 +167,8 @@ public function getElementHtml()
'buttonImage' => $this->getImage(),
'buttonText' => 'Select Date',
'disabled' => $this->getDisabled(),
+ 'minDate' => $this->getMinDate(),
+ 'maxDate' => $this->getMaxDate(),
],
]
)
diff --git a/lib/internal/Magento/Framework/Encryption/Encryptor.php b/lib/internal/Magento/Framework/Encryption/Encryptor.php
index c79233b62fb61..0a20bfe11873f 100644
--- a/lib/internal/Magento/Framework/Encryption/Encryptor.php
+++ b/lib/internal/Magento/Framework/Encryption/Encryptor.php
@@ -143,7 +143,7 @@ public function validateCipher($version)
public function getHash($password, $salt = false, $version = self::HASH_VERSION_LATEST)
{
if ($salt === false) {
- return $this->hash($password);
+ return $this->hash($password, $version);
}
if ($salt === true) {
$salt = self::DEFAULT_SALT_LENGTH;
@@ -155,7 +155,7 @@ public function getHash($password, $salt = false, $version = self::HASH_VERSION_
return implode(
self::DELIMITER,
[
- $this->hash($salt . $password),
+ $this->hash($salt . $password, $version),
$salt,
$version
]
diff --git a/lib/internal/Magento/Framework/Encryption/Test/Unit/EncryptorTest.php b/lib/internal/Magento/Framework/Encryption/Test/Unit/EncryptorTest.php
index 7031cdace2e97..4fdbd558dafd3 100644
--- a/lib/internal/Magento/Framework/Encryption/Test/Unit/EncryptorTest.php
+++ b/lib/internal/Magento/Framework/Encryption/Test/Unit/EncryptorTest.php
@@ -207,4 +207,32 @@ public function testValidateKey()
$this->assertEquals($expectedEncryptedData, $actualEncryptedData);
$this->assertEquals($crypt->decrypt($expectedEncryptedData), $actual->decrypt($actualEncryptedData));
}
+
+ public function testUseSpecifiedHashingAlgoDataProvider()
+ {
+ return [
+ ['password', 'salt', Encryptor::HASH_VERSION_MD5,
+ '67a1e09bb1f83f5007dc119c14d663aa:salt:0'],
+ ['password', 'salt', Encryptor::HASH_VERSION_SHA256,
+ '13601bda4ea78e55a07b98866d2be6be0744e3866f13c00c811cab608a28f322:salt:1'],
+ ['password', false, Encryptor::HASH_VERSION_MD5,
+ '5f4dcc3b5aa765d61d8327deb882cf99'],
+ ['password', false, Encryptor::HASH_VERSION_SHA256,
+ '5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8']
+ ];
+ }
+
+ /**
+ * @dataProvider testUseSpecifiedHashingAlgoDataProvider
+ *
+ * @param $password
+ * @param $salt
+ * @param $hashAlgo
+ * @param $expected
+ */
+ public function testGetHashMustUseSpecifiedHashingAlgo($password, $salt, $hashAlgo, $expected)
+ {
+ $hash = $this->_model->getHash($password, $salt, $hashAlgo);
+ $this->assertEquals($expected, $hash);
+ }
}
diff --git a/lib/internal/Magento/Framework/Escaper.php b/lib/internal/Magento/Framework/Escaper.php
index 0971082bb999e..532fe19023a5d 100644
--- a/lib/internal/Magento/Framework/Escaper.php
+++ b/lib/internal/Magento/Framework/Escaper.php
@@ -67,7 +67,20 @@ public function escapeJsQuote($data, $quote = '\'')
}
} else {
$result = str_replace($quote, '\\' . $quote, $data);
+ //Preventing XSS attacks by inserting script tags in JS inside
+ //an HTML document.
+ $result = str_replace(
+ '',
+ '<' . $quote . ' + ' . $quote . '/script>',
+ $result
+ );
+ $result = str_replace(
+ '