= /* @escapeNotVerified */ __('Ordered') ?> | @@ -116,7 +125,7 @@- canShowPriceInfo($_item)): ?> + canShowPriceInfo($_item) || $shipTogether): ?> canEditQty()) : ?> getItem(); +$items = array_merge([$parentItem], $parentItem->getChildrenItems()); +$index = 0; +$prevOptionId = ''; ?> -getItem() ?> -getChildrenItems()); ?> - - + - - - getItemOptions() || $parentItem->getDescription() || $this->helper('Magento\GiftMessage\Helper\Message')->isMessagesAllowed('order_item', $parentItem) && $parentItem->getGiftMessageId()): ?> - + getItemOptions() + || $parentItem->getDescription() + || $this->helper('Magento\GiftMessage\Helper\Message')->isMessagesAllowed('order_item', $parentItem) + && $parentItem->getGiftMessageId()): ?> + - + - getParentItem()): ?> - getSelectionAttributes($_item) ?> - + getParentItem()): ?> + getSelectionAttributes($item) ?> + | ||||||||
---|---|---|---|---|---|---|---|---|---|
= /* @escapeNotVerified */ $attributes['option_label'] ?> | += $block->escapeHtml($attributes['option_label']); ?> | ||||||||
- = $block->escapeHtml($_item->getName()) ?> + | |||||||||
+ = $block->escapeHtml($item->getName()); ?> | -= $block->getValueHtml($_item) ?> | ++ = $block->getValueHtml($item); ?> + | -= /* @escapeNotVerified */ $block->prepareSku($_item->getSku()) ?> | -- getParentItem()): ?> - = $block->getItemPriceHtml() ?> + | + = /* @noEscape */ $block->prepareSku($item->getSku()); ?> + | ++ getParentItem()): ?> + = /* @noEscape */ $block->getItemPriceHtml(); ?> | -+ |
getParentItem() && $block->isChildCalculated()) ||
- (!$_item->getParentItem() && !$block->isChildCalculated()) || ($_item->getQtyShipped() > 0 && $_item->getParentItem() && $block->isShipmentSeparately())):?>
+ ($item->getParentItem() && $block->isChildCalculated()) ||
+ (!$item->getParentItem() && !$block->isChildCalculated()) ||
+ ($item->getQtyShipped() > 0 && $item->getParentItem() && $block->isShipmentSeparately())): ?>
|
- getParentItem()): ?> - = $block->getItemRowTotalHtml() ?> + getParentItem()): ?> + = /* @noEscape */ $block->getItemRowTotalHtml(); ?> @@ -103,33 +119,38 @@ |
- getItemOptions()): ?> + getItemOptions()): ?> | - = $block->escapeHtml($_item->getDescription()) ?> + = $block->escapeHtml($item->getDescription()); ?>
- {{trans "Confirm Your Account"}} + {{trans "Confirm Your Account"}} |
= $block->escapeHtml(__('You have no other address entries in your address book.')) ?>
- -{{trans 'You can check the status of your order by logging into your account.' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}
diff --git a/app/code/Magento/Sales/view/frontend/email/creditmemo_update_guest.html b/app/code/Magento/Sales/view/frontend/email/creditmemo_update_guest.html index bc7c079d7f2..b7411d80d2b 100644 --- a/app/code/Magento/Sales/view/frontend/email/creditmemo_update_guest.html +++ b/app/code/Magento/Sales/view/frontend/email/creditmemo_update_guest.html @@ -10,7 +10,7 @@ "var creditmemo.increment_id":"Credit Memo Id", "var billing.getName()":"Guest Customer Name", "var order.increment_id":"Order Id", -"var order.getStatusLabel()":"Order Status" +"var order.getFrontendStatusLabel()":"Order Status" } @--> {{template config_path="design/email/header_template"}} @@ -23,7 +23,7 @@ "Your order #%increment_id has been updated with a status of %order_status." increment_id=$order.increment_id - order_status=$order.getStatusLabel() + order_status=$order.getFrontendStatusLabel() |raw}}diff --git a/app/code/Magento/Sales/view/frontend/email/invoice_update.html b/app/code/Magento/Sales/view/frontend/email/invoice_update.html index cafdd65ff52..4043e59f9d7 100644 --- a/app/code/Magento/Sales/view/frontend/email/invoice_update.html +++ b/app/code/Magento/Sales/view/frontend/email/invoice_update.html @@ -11,7 +11,7 @@ "var comment":"Invoice Comment", "var invoice.increment_id":"Invoice Id", "var order.increment_id":"Order Id", -"var order.getStatusLabel()":"Order Status" +"var order.getFrontendStatusLabel()":"Order Status" } @--> {{template config_path="design/email/header_template"}} @@ -24,7 +24,7 @@ "Your order #%increment_id has been updated with a status of %order_status." increment_id=$order.increment_id - order_status=$order.getStatusLabel() + order_status=$order.getFrontendStatusLabel() |raw}}
{{trans 'You can check the status of your order by logging into your account.' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}
diff --git a/app/code/Magento/Sales/view/frontend/email/invoice_update_guest.html b/app/code/Magento/Sales/view/frontend/email/invoice_update_guest.html index fafb533301e..40cdec7fb4c 100644 --- a/app/code/Magento/Sales/view/frontend/email/invoice_update_guest.html +++ b/app/code/Magento/Sales/view/frontend/email/invoice_update_guest.html @@ -10,7 +10,7 @@ "var comment":"Invoice Comment", "var invoice.increment_id":"Invoice Id", "var order.increment_id":"Order Id", -"var order.getStatusLabel()":"Order Status" +"var order.getFrontendStatusLabel()":"Order Status" } @--> {{template config_path="design/email/header_template"}} @@ -23,7 +23,7 @@ "Your order #%increment_id has been updated with a status of %order_status." increment_id=$order.increment_id - order_status=$order.getStatusLabel() + order_status=$order.getFrontendStatusLabel() |raw}}diff --git a/app/code/Magento/Sales/view/frontend/email/order_update.html b/app/code/Magento/Sales/view/frontend/email/order_update.html index a709a9ed8a7..a8f0068b70e 100644 --- a/app/code/Magento/Sales/view/frontend/email/order_update.html +++ b/app/code/Magento/Sales/view/frontend/email/order_update.html @@ -10,7 +10,7 @@ "var order.getCustomerName()":"Customer Name", "var comment":"Order Comment", "var order.increment_id":"Order Id", -"var order.getStatusLabel()":"Order Status" +"var order.getFrontendStatusLabel()":"Order Status" } @--> {{template config_path="design/email/header_template"}} @@ -23,7 +23,7 @@ "Your order #%increment_id has been updated with a status of %order_status." increment_id=$order.increment_id - order_status=$order.getStatusLabel() + order_status=$order.getFrontendStatusLabel() |raw}}
{{trans 'You can check the status of your order by logging into your account.' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}
diff --git a/app/code/Magento/Sales/view/frontend/email/order_update_guest.html b/app/code/Magento/Sales/view/frontend/email/order_update_guest.html index 5a39b01810c..749fa3b60ad 100644 --- a/app/code/Magento/Sales/view/frontend/email/order_update_guest.html +++ b/app/code/Magento/Sales/view/frontend/email/order_update_guest.html @@ -9,7 +9,7 @@ "var billing.getName()":"Guest Customer Name", "var comment":"Order Comment", "var order.increment_id":"Order Id", -"var order.getStatusLabel()":"Order Status" +"var order.getFrontendStatusLabel()":"Order Status" } @--> {{template config_path="design/email/header_template"}} @@ -22,7 +22,7 @@ "Your order #%increment_id has been updated with a status of %order_status." increment_id=$order.increment_id - order_status=$order.getStatusLabel() + order_status=$order.getFrontendStatusLabel() |raw}}diff --git a/app/code/Magento/Sales/view/frontend/email/shipment_update.html b/app/code/Magento/Sales/view/frontend/email/shipment_update.html index 6d9efc37004..9d1c9328754 100644 --- a/app/code/Magento/Sales/view/frontend/email/shipment_update.html +++ b/app/code/Magento/Sales/view/frontend/email/shipment_update.html @@ -10,7 +10,7 @@ "var order.getCustomerName()":"Customer Name", "var comment":"Order Comment", "var order.increment_id":"Order Id", -"var order.getStatusLabel()":"Order Status", +"var order.getFrontendStatusLabel()":"Order Status", "var shipment.increment_id":"Shipment Id" } @--> {{template config_path="design/email/header_template"}} @@ -24,7 +24,7 @@ "Your order #%increment_id has been updated with a status of %order_status." increment_id=$order.increment_id - order_status=$order.getStatusLabel() + order_status=$order.getFrontendStatusLabel() |raw}}
{{trans 'You can check the status of your order by logging into your account.' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}
diff --git a/app/code/Magento/Sales/view/frontend/email/shipment_update_guest.html b/app/code/Magento/Sales/view/frontend/email/shipment_update_guest.html index 4896a00b7bc..0d2dccd3377 100644 --- a/app/code/Magento/Sales/view/frontend/email/shipment_update_guest.html +++ b/app/code/Magento/Sales/view/frontend/email/shipment_update_guest.html @@ -9,7 +9,7 @@ "var billing.getName()":"Guest Customer Name", "var comment":"Order Comment", "var order.increment_id":"Order Id", -"var order.getStatusLabel()":"Order Status", +"var order.getFrontendStatusLabel()":"Order Status", "var shipment.increment_id":"Shipment Id" } @--> {{template config_path="design/email/header_template"}} @@ -23,7 +23,7 @@ "Your order #%increment_id has been updated with a status of %order_status." increment_id=$order.increment_id - order_status=$order.getStatusLabel() + order_status=$order.getFrontendStatusLabel() |raw}}
diff --git a/app/code/Magento/Sales/view/frontend/templates/email/shipment/track.phtml b/app/code/Magento/Sales/view/frontend/templates/email/shipment/track.phtml
index 9f7146ab084..f1cd5f2b998 100644
--- a/app/code/Magento/Sales/view/frontend/templates/email/shipment/track.phtml
+++ b/app/code/Magento/Sales/view/frontend/templates/email/shipment/track.phtml
@@ -9,22 +9,23 @@
?>
getShipment() ?>
getOrder() ?>
-getAllTracks()): ?>
-
-
= /* @escapeNotVerified */ __('Shipped By') ?> | = /* @escapeNotVerified */ __('Tracking Number') ?> |
---|---|
= $block->escapeHtml($_item->getTitle()) ?>: | -= $block->escapeHtml($_item->getNumber()) ?> | -
* $adapter->quoteIdentifier('myschema.mytable')
*
@@ -721,7 +725,8 @@ public function disallowDdlCache();
/**
* Reset cached DDL data from cache
- * if table name is null - reset all cached DDL data
+ *
+ * If table name is null - reset all cached DDL data
*
* @param string $tableName
* @param string $schemaName OPTIONAL
@@ -741,6 +746,7 @@ public function saveDdlCache($tableCacheKey, $ddlType, $data);
/**
* Load DDL data from cache
+ *
* Return false if cache does not exists
*
* @param string $tableCacheKey the table cache key
@@ -784,6 +790,7 @@ public function prepareSqlCondition($fieldName, $condition);
/**
* Prepare value for save in column
+ *
* Return converted to column data type value
*
* @param array $column the column describe array
@@ -813,6 +820,7 @@ public function getIfNullSql($expression, $value = 0);
/**
* Generate fragment of SQL, that combine together (concatenate) the results from data array
+ *
* All arguments in data must be quoted
*
* @param array $data
@@ -823,6 +831,7 @@ public function getConcatSql(array $data, $separator = null);
/**
* Generate fragment of SQL that returns length of character string
+ *
* The string argument must be quoted
*
* @param string $string
@@ -931,6 +940,7 @@ public function getDateExtractSql($date, $unit);
/**
* Retrieve valid table name
+ *
* Check table name length and allowed symbols
*
* @param string $tableName
@@ -950,6 +960,7 @@ public function getTriggerName($tableName, $time, $event);
/**
* Retrieve valid index name
+ *
* Check index name length and allowed symbols
*
* @param string $tableName
@@ -961,6 +972,7 @@ public function getIndexName($tableName, $fields, $indexType = '');
/**
* Retrieve valid foreign key name
+ *
* Check foreign key name length and allowed symbols
*
* @param string $priTableName
@@ -1047,6 +1059,7 @@ public function supportStraightJoin();
/**
* Adds order by random to select object
+ *
* Possible using integer field for optimization
*
* @param \Magento\Framework\DB\Select $select
@@ -1074,6 +1087,7 @@ public function getPrimaryKeyName($tableName, $schemaName = null);
/**
* Converts fetched blob into raw binary PHP data.
+ *
* Some DB drivers return blobs as hex-coded strings, so we need to process them.
*
* @param mixed $value
@@ -1114,6 +1128,8 @@ public function dropTrigger($triggerName, $schemaName = null);
public function getTables($likeCondition = null);
/**
+ * Generates case SQL fragment
+ *
* Generate fragment of SQL, that check value against multiple condition cases
* and return different result depends on them
*
diff --git a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php
index 86266ec23fe..90186707177 100644
--- a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php
+++ b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php
@@ -2915,6 +2915,7 @@ public function endSetup()
* - array("gteq" => $greaterOrEqualValue)
* - array("lteq" => $lessOrEqualValue)
* - array("finset" => $valueInSet)
+ * - array("nfinset" => $valueNotInSet)
* - array("regexp" => $regularExpression)
* - array("seq" => $stringValue)
* - array("sneq" => $stringValue)
@@ -2944,6 +2945,7 @@ public function prepareSqlCondition($fieldName, $condition)
'gteq' => "{{fieldName}} >= ?",
'lteq' => "{{fieldName}} <= ?",
'finset' => "FIND_IN_SET(?, {{fieldName}})",
+ 'nfinset' => "NOT FIND_IN_SET(?, {{fieldName}})",
'regexp' => "{{fieldName}} REGEXP ?",
'from' => "{{fieldName}} >= ?",
'to' => "{{fieldName}} <= ?",
diff --git a/lib/internal/Magento/Framework/Data/Collection.php b/lib/internal/Magento/Framework/Data/Collection.php
index 9c789e81913..dbafc9734e0 100644
--- a/lib/internal/Magento/Framework/Data/Collection.php
+++ b/lib/internal/Magento/Framework/Data/Collection.php
@@ -7,6 +7,7 @@
use Magento\Framework\Data\Collection\EntityFactoryInterface;
use Magento\Framework\Option\ArrayInterface;
+use Magento\Framework\Exception\InputException;
/**
* Data collection
@@ -234,12 +235,20 @@ protected function _setIsLoaded($flag = true)
* Get current collection page
*
* @param int $displacement
+ * @throws \Magento\Framework\Exception\InputException
* @return int
*/
public function getCurPage($displacement = 0)
{
if ($this->_curPage + $displacement < 1) {
return 1;
+ } elseif ($this->_curPage > $this->getLastPageNumber() && $displacement === 0) {
+ throw new InputException(
+ __(
+ 'currentPage value %1 specified is greater than the %2 page(s) available.',
+ [$this->_curPage, $this->getLastPageNumber()]
+ )
+ );
} elseif ($this->_curPage + $displacement > $this->getLastPageNumber()) {
return $this->getLastPageNumber();
} else {
diff --git a/lib/internal/Magento/Framework/Data/Form/Element/AbstractElement.php b/lib/internal/Magento/Framework/Data/Form/Element/AbstractElement.php
index a8451e43ade..3638ff921fa 100644
--- a/lib/internal/Magento/Framework/Data/Form/Element/AbstractElement.php
+++ b/lib/internal/Magento/Framework/Data/Form/Element/AbstractElement.php
@@ -201,6 +201,8 @@ public function setType($type)
}
/**
+ * Set form.
+ *
* @param AbstractForm $form
* @return $this
*/
@@ -238,6 +240,7 @@ public function getHtmlAttributes()
'onchange',
'disabled',
'readonly',
+ 'autocomplete',
'tabindex',
'placeholder',
'data-form-part',
@@ -326,6 +329,8 @@ public function getRenderer()
}
/**
+ * Get Ui Id.
+ *
* @param null|string $suffix
* @return string
*/
diff --git a/lib/internal/Magento/Framework/Data/Form/Element/Date.php b/lib/internal/Magento/Framework/Data/Form/Element/Date.php
index c519ecfed4c..897617e560b 100644
--- a/lib/internal/Magento/Framework/Data/Form/Element/Date.php
+++ b/lib/internal/Magento/Framework/Data/Form/Element/Date.php
@@ -151,7 +151,7 @@ public function getValueInstance()
*/
public function getElementHtml()
{
- $this->addClass('admin__control-text input-text');
+ $this->addClass('admin__control-text input-text input-date');
$dateFormat = $this->getDateFormat() ?: $this->getFormat();
$timeFormat = $this->getTimeFormat();
if (empty($dateFormat)) {
diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/CollectionTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/CollectionTest.php
index 5608959c110..80c256d8553 100644
--- a/lib/internal/Magento/Framework/Data/Test/Unit/CollectionTest.php
+++ b/lib/internal/Magento/Framework/Data/Test/Unit/CollectionTest.php
@@ -5,6 +5,9 @@
*/
namespace Magento\Framework\Data\Test\Unit;
+/**
+ * Class for Collection test.
+ */
class CollectionTest extends \PHPUnit\Framework\TestCase
{
/**
@@ -12,6 +15,9 @@ class CollectionTest extends \PHPUnit\Framework\TestCase
*/
protected $_model;
+ /**
+ * Set up.
+ */
protected function setUp()
{
$this->_model = new \Magento\Framework\Data\Collection(
@@ -19,6 +25,11 @@ protected function setUp()
);
}
+ /**
+ * Test for method removeAllItems.
+ *
+ * @return void
+ */
public function testRemoveAllItems()
{
$this->_model->addItem(new \Magento\Framework\DataObject());
@@ -30,6 +41,7 @@ public function testRemoveAllItems()
/**
* Test loadWithFilter()
+ *
* @return void
*/
public function testLoadWithFilter()
@@ -42,6 +54,8 @@ public function testLoadWithFilter()
}
/**
+ * Test for method etItemObjectClass
+ *
* @dataProvider setItemObjectClassDataProvider
*/
public function testSetItemObjectClass($class)
@@ -51,6 +65,8 @@ public function testSetItemObjectClass($class)
}
/**
+ * Data provider.
+ *
* @return array
*/
public function setItemObjectClassDataProvider()
@@ -59,6 +75,8 @@ public function setItemObjectClassDataProvider()
}
/**
+ * Test for method setItemObjectClass with exception.
+ *
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage Incorrect_ClassName does not extend \Magento\Framework\DataObject
*/
@@ -67,12 +85,22 @@ public function testSetItemObjectClassException()
$this->_model->setItemObjectClass('Incorrect_ClassName');
}
+ /**
+ * Test for method addFilter.
+ *
+ * @return void
+ */
public function testAddFilter()
{
$this->_model->addFilter('field1', 'value');
$this->assertEquals('field1', $this->_model->getFilter('field1')->getData('field'));
}
+ /**
+ * Test for method getFilters.
+ *
+ * @return void
+ */
public function testGetFilters()
{
$this->_model->addFilter('field1', 'value');
@@ -81,12 +109,22 @@ public function testGetFilters()
$this->assertEquals('field2', $this->_model->getFilter(['field1', 'field2'])[1]->getData('field'));
}
+ /**
+ * Test for method get non existion filters.
+ *
+ * @return void
+ */
public function testGetNonExistingFilters()
{
$this->assertEmpty($this->_model->getFilter([]));
$this->assertEmpty($this->_model->getFilter('non_existing_filter'));
}
+ /**
+ * Test for lag.
+ *
+ * @return void
+ */
public function testFlag()
{
$this->_model->setFlag('flag_name', 'flag_value');
@@ -95,12 +133,35 @@ public function testFlag()
$this->assertNull($this->_model->getFlag('non_existing_flag'));
}
+ /**
+ * Test for method getCurPage.
+ *
+ * @return void
+ */
public function testGetCurPage()
{
- $this->_model->setCurPage(10);
+ $this->_model->setCurPage(1);
$this->assertEquals(1, $this->_model->getCurPage());
}
+ /**
+ * Test for getCurPage with exception.
+ *
+ * @expectedException \Magento\Framework\Exception\StateException
+ * @return void
+ */
+ public function testGetCurPageWithException()
+ {
+ $this->_model->setCurPage(10);
+ $this->expectException(\Magento\Framework\Exception\InputException::class);
+ $this->_model->getCurPage();
+ }
+
+ /**
+ * Test for method possibleFlowWithItem.
+ *
+ * @return void
+ */
public function testPossibleFlowWithItem()
{
$firstItemMock = $this->createPartialMock(
@@ -168,6 +229,11 @@ public function testPossibleFlowWithItem()
$this->assertEquals([], $this->_model->getItems());
}
+ /**
+ * Test for method eachCallsMethodOnEachItemWithNoArgs.
+ *
+ * @return void
+ */
public function testEachCallsMethodOnEachItemWithNoArgs()
{
for ($i = 0; $i < 3; $i++) {
@@ -177,7 +243,12 @@ public function testEachCallsMethodOnEachItemWithNoArgs()
}
$this->_model->each('testCallback');
}
-
+
+ /**
+ * Test for method eachCallsMethodOnEachItemWithArgs.
+ *
+ * @return void
+ */
public function testEachCallsMethodOnEachItemWithArgs()
{
for ($i = 0; $i < 3; $i++) {
@@ -188,6 +259,11 @@ public function testEachCallsMethodOnEachItemWithArgs()
$this->_model->each('testCallback', ['a', 'b', 'c']);
}
+ /**
+ * Test for method callsClosureWithEachItemAndNoArgs.
+ *
+ * @return void
+ */
public function testCallsClosureWithEachItemAndNoArgs()
{
for ($i = 0; $i < 3; $i++) {
@@ -200,6 +276,11 @@ public function testCallsClosureWithEachItemAndNoArgs()
});
}
+ /**
+ * Test for method callsClosureWithEachItemAndArgs.
+ *
+ * @return void
+ */
public function testCallsClosureWithEachItemAndArgs()
{
for ($i = 0; $i < 3; $i++) {
@@ -212,6 +293,11 @@ public function testCallsClosureWithEachItemAndArgs()
}, ['a', 'b', 'c']);
}
+ /**
+ * Test for method callsCallableArrayWithEachItemNoArgs.
+ *
+ * @return void
+ */
public function testCallsCallableArrayWithEachItemNoArgs()
{
$mockCallbackObject = $this->getMockBuilder('DummyEachCallbackInstance')
@@ -230,6 +316,11 @@ public function testCallsCallableArrayWithEachItemNoArgs()
$this->_model->each([$mockCallbackObject, 'testObjCallback']);
}
+ /**
+ * Test for method callsCallableArrayWithEachItemAndArgs.
+ *
+ * @return void
+ */
public function testCallsCallableArrayWithEachItemAndArgs()
{
$mockCallbackObject = $this->getMockBuilder('DummyEachCallbackInstance')
diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/AbstractElementTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/AbstractElementTest.php
index e29b1dcf441..a85c1f4aa45 100644
--- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/AbstractElementTest.php
+++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/AbstractElementTest.php
@@ -195,6 +195,7 @@ public function testGetHtmlAttributes()
'onchange',
'disabled',
'readonly',
+ 'autocomplete',
'tabindex',
'placeholder',
'data-form-part',
diff --git a/lib/internal/Magento/Framework/Encryption/Encryptor.php b/lib/internal/Magento/Framework/Encryption/Encryptor.php
index 676feac5ed0..791e6d72b95 100644
--- a/lib/internal/Magento/Framework/Encryption/Encryptor.php
+++ b/lib/internal/Magento/Framework/Encryption/Encryptor.php
@@ -9,6 +9,7 @@
namespace Magento\Framework\Encryption;
use Magento\Framework\App\DeploymentConfig;
+use Magento\Framework\App\ObjectManager;
use Magento\Framework\Encryption\Adapter\EncryptionAdapterInterface;
use Magento\Framework\Encryption\Helper\Security;
use Magento\Framework\Math\Random;
@@ -115,20 +116,28 @@ class Encryptor implements EncryptorInterface
*/
private $random;
+ /**
+ * @var KeyValidator
+ */
+ private $keyValidator;
+
/**
* Encryptor constructor.
* @param Random $random
* @param DeploymentConfig $deploymentConfig
+ * @param KeyValidator|null $keyValidator
*/
public function __construct(
Random $random,
- DeploymentConfig $deploymentConfig
+ DeploymentConfig $deploymentConfig,
+ KeyValidator $keyValidator = null
) {
$this->random = $random;
// load all possible keys
$this->keys = preg_split('/\s+/s', trim((string)$deploymentConfig->get(self::PARAM_CRYPT_KEY)));
$this->keyVersion = count($this->keys) - 1;
+ $this->keyValidator = $keyValidator ?: ObjectManager::getInstance()->get(KeyValidator::class);
}
/**
@@ -374,8 +383,12 @@ public function decrypt($data)
*/
public function validateKey($key)
{
- if (preg_match('/\s/s', $key)) {
- throw new \Exception((string)new \Magento\Framework\Phrase('The encryption key format is invalid.'));
+ if (!$this->keyValidator->isValid($key)) {
+ throw new \Exception(
+ (string)new \Magento\Framework\Phrase(
+ 'Encryption key must be 32 character string without any white space.'
+ )
+ );
}
}
diff --git a/lib/internal/Magento/Framework/Encryption/KeyValidator.php b/lib/internal/Magento/Framework/Encryption/KeyValidator.php
new file mode 100644
index 00000000000..79d592bec2a
--- /dev/null
+++ b/lib/internal/Magento/Framework/Encryption/KeyValidator.php
@@ -0,0 +1,33 @@
+_randomGenerator = $this->createMock(\Magento\Framework\Math\Random::class);
+ $this->randomGeneratorMock = $this->createMock(\Magento\Framework\Math\Random::class);
$deploymentConfigMock = $this->createMock(\Magento\Framework\App\DeploymentConfig::class);
$deploymentConfigMock->expects($this->any())
->method('get')
->with(Encryptor::PARAM_CRYPT_KEY)
->will($this->returnValue(self::CRYPT_KEY_1));
- $this->_model = new \Magento\Framework\Encryption\Encryptor($this->_randomGenerator, $deploymentConfigMock);
+ $this->keyValidatorMock = $this->createMock(KeyValidator::class);
+ $this->encryptor = (new ObjectManager($this))->getObject(
+ \Magento\Framework\Encryption\Encryptor::class,
+ [
+ 'random' => $this->randomGeneratorMock,
+ 'deploymentConfig' => $deploymentConfigMock,
+ 'keyValidator' => $this->keyValidatorMock
+ ]
+ );
}
public function testGetHashNoSalt()
{
- $this->_randomGenerator->expects($this->never())->method('getRandomString');
+ $this->randomGeneratorMock->expects($this->never())->method('getRandomString');
$expected = '5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8';
- $actual = $this->_model->getHash('password');
+ $actual = $this->encryptor->getHash('password');
$this->assertEquals($expected, $actual);
}
public function testGetHashSpecifiedSalt()
{
- $this->_randomGenerator->expects($this->never())->method('getRandomString');
+ $this->randomGeneratorMock->expects($this->never())->method('getRandomString');
$expected = '13601bda4ea78e55a07b98866d2be6be0744e3866f13c00c811cab608a28f322:salt:1';
- $actual = $this->_model->getHash('password', 'salt');
+ $actual = $this->encryptor->getHash('password', 'salt');
$this->assertEquals($expected, $actual);
}
public function testGetHashRandomSaltDefaultLength()
{
$salt = '-----------random_salt----------';
- $this->_randomGenerator
+ $this->randomGeneratorMock
->expects($this->once())
->method('getRandomString')
->with(32)
->will($this->returnValue($salt));
$expected = 'a1c7fc88037b70c9be84d3ad12522c7888f647915db78f42eb572008422ba2fa:' . $salt . ':1';
- $actual = $this->_model->getHash('password', true);
+ $actual = $this->encryptor->getHash('password', true);
$this->assertEquals($expected, $actual);
}
public function testGetHashRandomSaltSpecifiedLength()
{
- $this->_randomGenerator
+ $this->randomGeneratorMock
->expects($this->once())
->method('getRandomString')
->with(11)
->will($this->returnValue('random_salt'));
$expected = '4c5cab8dd00137d11258f8f87b93fd17bd94c5026fc52d3c5af911dd177a2611:random_salt:1';
- $actual = $this->_model->getHash('password', 11);
+ $actual = $this->encryptor->getHash('password', 11);
$this->assertEquals($expected, $actual);
}
@@ -89,7 +103,7 @@ public function testGetHashRandomSaltSpecifiedLength()
*/
public function testValidateHash($password, $hash, $expected)
{
- $actual = $this->_model->validateHash($password, $hash);
+ $actual = $this->encryptor->validateHash($password, $hash);
$this->assertEquals($expected, $actual);
}
@@ -118,7 +132,7 @@ public function testEncryptWithEmptyKey($key)
->method('get')
->with(Encryptor::PARAM_CRYPT_KEY)
->will($this->returnValue($key));
- $model = new Encryptor($this->_randomGenerator, $deploymentConfigMock);
+ $model = new Encryptor($this->randomGeneratorMock, $deploymentConfigMock);
$value = 'arbitrary_string';
$this->assertEquals($value, $model->encrypt($value));
}
@@ -143,7 +157,7 @@ public function testDecryptWithEmptyKey($key)
->method('get')
->with(Encryptor::PARAM_CRYPT_KEY)
->will($this->returnValue($key));
- $model = new Encryptor($this->_randomGenerator, $deploymentConfigMock);
+ $model = new Encryptor($this->randomGeneratorMock, $deploymentConfigMock);
$value = 'arbitrary_string';
$this->assertEquals('', $model->decrypt($value));
}
@@ -161,7 +175,7 @@ public function testEncrypt()
// sample data to encrypt
$data = 'Mares eat oats and does eat oats, but little lambs eat ivy.';
- $actual = $this->_model->encrypt($data);
+ $actual = $this->encryptor->encrypt($data);
// Extract the initialization vector and encrypted data
$parts = explode(':', $actual, 3);
@@ -175,9 +189,9 @@ public function testEncrypt()
public function testDecrypt()
{
$message = 'Mares eat oats and does eat oats, but little lambs eat ivy.';
- $encrypted = $this->_model->encrypt($message);
+ $encrypted = $this->encryptor->encrypt($message);
- $this->assertEquals($message, $this->_model->decrypt($encrypted));
+ $this->assertEquals($message, $this->encryptor->decrypt($encrypted));
}
public function testLegacyDecrypt()
@@ -186,7 +200,7 @@ public function testLegacyDecrypt()
$data = '0:2:z3a4ACpkU35W6pV692U4ueCVQP0m0v0p:' .
'DhEG8/uKGGq92ZusqrGb6X/9+2Ng0QZ9z2UZwljgJbs5/A3LaSnqcK0oI32yjHY49QJi+Z7q1EKu2yVqB8EMpA==';
- $actual = $this->_model->decrypt($data);
+ $actual = $this->encryptor->decrypt($data);
// Extract the initialization vector and encrypted data
$parts = explode(':', $data, 4);
@@ -209,9 +223,9 @@ public function testEncryptDecryptNewKeyAdded()
->method('get')
->with(Encryptor::PARAM_CRYPT_KEY)
->will($this->returnValue(self::CRYPT_KEY_1 . "\n" . self::CRYPT_KEY_2));
- $model1 = new Encryptor($this->_randomGenerator, $deploymentConfigMock);
+ $model1 = new Encryptor($this->randomGeneratorMock, $deploymentConfigMock);
// simulate an encryption key is being added
- $model2 = new Encryptor($this->_randomGenerator, $deploymentConfigMock);
+ $model2 = new Encryptor($this->randomGeneratorMock, $deploymentConfigMock);
// sample data to encrypt
$data = 'Mares eat oats and does eat oats, but little lambs eat ivy.';
@@ -224,7 +238,8 @@ public function testEncryptDecryptNewKeyAdded()
public function testValidateKey()
{
- $this->_model->validateKey(self::CRYPT_KEY_1);
+ $this->keyValidatorMock->method('isValid')->willReturn(true);
+ $this->encryptor->validateKey(self::CRYPT_KEY_1);
}
/**
@@ -232,7 +247,8 @@ public function testValidateKey()
*/
public function testValidateKeyInvalid()
{
- $this->_model->validateKey('----- ');
+ $this->keyValidatorMock->method('isValid')->willReturn(false);
+ $this->encryptor->validateKey('----- ');
}
/**
@@ -262,7 +278,7 @@ public function useSpecifiedHashingAlgoDataProvider()
*/
public function testGetHashMustUseSpecifiedHashingAlgo($password, $salt, $hashAlgo, $expected)
{
- $hash = $this->_model->getHash($password, $salt, $hashAlgo);
+ $hash = $this->encryptor->getHash($password, $salt, $hashAlgo);
$this->assertEquals($expected, $hash);
}
}
diff --git a/lib/internal/Magento/Framework/Encryption/Test/Unit/KeyValidatorTest.php b/lib/internal/Magento/Framework/Encryption/Test/Unit/KeyValidatorTest.php
new file mode 100644
index 00000000000..85faa0aa467
--- /dev/null
+++ b/lib/internal/Magento/Framework/Encryption/Test/Unit/KeyValidatorTest.php
@@ -0,0 +1,54 @@
+keyValidator = (new ObjectManager($this))->getObject(KeyValidator::class);
+ }
+
+ /**
+ * @param $key
+ * @param bool $expected
+ * @dataProvider isValidDataProvider
+ */
+ public function testIsValid($key, $expected = true)
+ {
+ $this->assertEquals($expected, $this->keyValidator->isValid($key));
+ }
+
+ public function isValidDataProvider() : array
+ {
+ return [
+ '32 numbers' => ['12345678901234567890123456789012'],
+ '32 characters' => ['aBcdeFghIJKLMNOPQRSTUvwxYzabcdef'],
+ '32 special characters' => ['!@#$%^&*()_+~`:;"<>,.?/|*&^%$#@!'],
+ '32 combination' =>['1234eFghI1234567^&*(890123456789'],
+ 'empty string' => ['', false],
+ 'leading space' => [' 1234567890123456789012345678901', false],
+ 'tailing space' => ['1234567890123456789012345678901 ', false],
+ 'space in the middle' => ['12345678901 23456789012345678901', false],
+ 'tab in the middle' => ['12345678901 23456789012345678', false],
+ 'return in the middle' => ['12345678901
+ 23456789012345678901', false],
+ '31 characters' => ['1234567890123456789012345678901', false],
+ '33 characters' => ['123456789012345678901234567890123', false],
+ ];
+ }
+}
diff --git a/lib/internal/Magento/Framework/Escaper.php b/lib/internal/Magento/Framework/Escaper.php
index 19a9c0c1788..c4150851ec4 100644
--- a/lib/internal/Magento/Framework/Escaper.php
+++ b/lib/internal/Magento/Framework/Escaper.php
@@ -46,20 +46,6 @@ class Escaper
*/
private $escapeAsUrlAttributes = ['href'];
- /**
- * @param \Magento\Framework\ZendEscaper|null $escaper
- * @param \Psr\Log\LoggerInterface|null $logger
- */
- public function __construct(
- \Magento\Framework\ZendEscaper $escaper = null,
- \Psr\Log\LoggerInterface $logger = null
- ) {
- $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()
- ->get(\Magento\Framework\ZendEscaper::class);
- $this->logger = $logger ?? \Magento\Framework\App\ObjectManager::getInstance()
- ->get(\Psr\Log\LoggerInterface::class);
- }
-
/**
* Escape string for HTML context.
*
@@ -99,7 +85,7 @@ function ($errorNumber, $errorString) {
);
} catch (\Exception $e) {
restore_error_handler();
- $this->logger->critical($e);
+ $this->getLogger()->critical($e);
}
restore_error_handler();
@@ -229,7 +215,7 @@ private function escapeAttributeValue($name, $value)
public function escapeHtmlAttr($string, $escapeSingleQuote = true)
{
if ($escapeSingleQuote) {
- return $this->escaper->escapeHtmlAttr((string) $string);
+ return $this->getEscaper()->escapeHtmlAttr((string) $string);
}
return htmlspecialchars((string)$string, ENT_COMPAT, 'UTF-8', false);
}
@@ -254,7 +240,7 @@ public function escapeUrl($string)
*/
public function encodeUrlParam($string)
{
- return $this->escaper->escapeUrl($string);
+ return $this->getEscaper()->escapeUrl($string);
}
/**
@@ -293,7 +279,7 @@ function ($matches) {
*/
public function escapeCss($string)
{
- return $this->escaper->escapeCss($string);
+ return $this->getEscaper()->escapeCss($string);
}
/**
@@ -368,6 +354,36 @@ public function escapeQuote($data, $addSlashes = false)
return htmlspecialchars($data, ENT_QUOTES, null, false);
}
+ /**
+ * Get escaper
+ *
+ * @return \Magento\Framework\ZendEscaper
+ * @deprecated 100.2.0
+ */
+ private function getEscaper()
+ {
+ if ($this->escaper == null) {
+ $this->escaper = \Magento\Framework\App\ObjectManager::getInstance()
+ ->get(\Magento\Framework\ZendEscaper::class);
+ }
+ return $this->escaper;
+ }
+
+ /**
+ * Get logger
+ *
+ * @return \Psr\Log\LoggerInterface
+ * @deprecated 100.2.0
+ */
+ private function getLogger()
+ {
+ if ($this->logger == null) {
+ $this->logger = \Magento\Framework\App\ObjectManager::getInstance()
+ ->get(\Psr\Log\LoggerInterface::class);
+ }
+ return $this->logger;
+ }
+
/**
* Filter prohibited tags.
*
@@ -382,7 +398,7 @@ private function filterProhibitedTags(array $allowedTags): array
);
if (!empty($notAllowedTags)) {
- $this->logger->critical(
+ $this->getLogger()->critical(
'The following tag(s) are not allowed: ' . implode(', ', $notAllowedTags)
);
$allowedTags = array_diff($allowedTags, $this->notAllowedTags);
diff --git a/lib/internal/Magento/Framework/Filesystem/Directory/ReadInterface.php b/lib/internal/Magento/Framework/Filesystem/Directory/ReadInterface.php
index 61108c64dda..85d41b69326 100644
--- a/lib/internal/Magento/Framework/Filesystem/Directory/ReadInterface.php
+++ b/lib/internal/Magento/Framework/Filesystem/Directory/ReadInterface.php
@@ -89,6 +89,7 @@ public function isDirectory($path = null);
*
* @param string $path
* @return \Magento\Framework\Filesystem\File\ReadInterface
+ * @throws \Magento\Framework\Exception\FileSystemException
*/
public function openFile($path);
diff --git a/lib/internal/Magento/Framework/Filter/Template.php b/lib/internal/Magento/Framework/Filter/Template.php
index 3e5f9bcf0bd..a56a4a3edf1 100644
--- a/lib/internal/Magento/Framework/Filter/Template.php
+++ b/lib/internal/Magento/Framework/Filter/Template.php
@@ -293,7 +293,7 @@ public function templateDirective($construction)
{
// Processing of {template config_path=... [...]} statement
$templateParameters = $this->getParameters($construction[2]);
- if (!isset($templateParameters['config_path']) or !$this->getTemplateProcessor()) {
+ if (!isset($templateParameters['config_path']) || !$this->getTemplateProcessor()) {
// Not specified template or not set include processor
$replacedValue = '{Error in template processing}';
} else {
diff --git a/lib/internal/Magento/Framework/Filter/Test/Unit/StripTagsTest.php b/lib/internal/Magento/Framework/Filter/Test/Unit/StripTagsTest.php
index f0dc0d9bd78..2c42eb3d1c8 100644
--- a/lib/internal/Magento/Framework/Filter/Test/Unit/StripTagsTest.php
+++ b/lib/internal/Magento/Framework/Filter/Test/Unit/StripTagsTest.php
@@ -12,8 +12,7 @@ class StripTagsTest extends \PHPUnit\Framework\TestCase
*/
public function testStripTags()
{
- $escaper = $this->createMock(\Magento\Framework\Escaper::class);
- $stripTags = new \Magento\Framework\Filter\StripTags($escaper);
+ $stripTags = new \Magento\Framework\Filter\StripTags(new \Magento\Framework\Escaper());
$this->assertEquals('three', $stripTags->filter('
Welcome to Magento Admin, your online store headquarters.
- Click 'Agree and Set Up Magento' or read Getting Started to learn more.
+ Click 'Agree and Set Up Magento' or read Getting Started to learn more.
Terms & Agreement diff --git a/setup/view/magento/setup/readiness-check/progress.phtml b/setup/view/magento/setup/readiness-check/progress.phtml index eb9dd0ce9d1..d8e519aa8ac 100755 --- a/setup/view/magento/setup/readiness-check/progress.phtml +++ b/setup/view/magento/setup/readiness-check/progress.phtml @@ -121,7 +121,7 @@ Download and install the updater.
For additional assistance, see - updater application help.
@@ -172,7 +172,7 @@
For additional assistance, see - cron scripts help.
@@ -214,7 +214,7 @@
For additional assistance, see - component dependency help .
@@ -336,7 +336,7 @@For additional assistance, see - PHP settings check help .
@@ -392,7 +392,7 @@ @@ -413,7 +413,7 @@
The best way to resolve this is to install the correct missing extensions. The exact fix depends on our server, your host, and other system variables.
- Our PHP extension help can get you started.
+ Our PHP extension help can get you started.
For additional assistance, contact your hosting provider. @@ -477,7 +477,7 @@
@@ -500,7 +500,7 @@ The best way to resolve this is to allow write permissions for files in the following Magento directories and subdirectories. The exact fix depends on your server, your host, and other system variables.