Skip to content

Commit e9e5c74

Browse files
committed
Merge branch '2.3-develop' of https://github.com/magento/magento2ce into MAGETWO-91808
2 parents 2026ce8 + 273ee99 commit e9e5c74

File tree

61 files changed

+693
-140
lines changed

Some content is hidden

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

61 files changed

+693
-140
lines changed

app/code/Magento/Catalog/Controller/Product/Compare/Add.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,14 @@ public function execute()
3636
$productName = $this->_objectManager->get(
3737
\Magento\Framework\Escaper::class
3838
)->escapeHtml($product->getName());
39-
$this->messageManager->addSuccess(__('You added product %1 to the comparison list.', $productName));
39+
$this->messageManager->addComplexSuccessMessage(
40+
'addCompareSuccessMessage',
41+
[
42+
'product_name' => $productName,
43+
'compare_list_url' => $this->_url->getUrl('catalog/product_compare')
44+
]
45+
);
46+
4047
$this->_eventManager->dispatch('catalog_product_compare_add_product', ['product' => $product]);
4148
}
4249

app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ protected function getSelect($entityIds = null, $type = null)
456456
$specialFromExpr = "{$specialFrom} IS NULL OR {$specialFromDate} <= {$currentDate}";
457457
$specialToExpr = "{$specialTo} IS NULL OR {$specialToDate} >= {$currentDate}";
458458
$specialPriceExpr = $connection->getCheckSql(
459-
"{$specialPrice} IS NOT NULL AND {$specialFromExpr} AND {$specialToExpr}",
459+
"{$specialPrice} IS NOT NULL AND ({$specialFromExpr}) AND ({$specialToExpr})",
460460
$specialPrice,
461461
$maxUnsignedBigint
462462
);

app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductPageSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<element name="qtyInput" type="button" selector="input.input-text.qty"/>
1313
<element name="addToCartBtn" type="button" selector="button.action.tocart.primary" timeout="30"/>
1414
<element name="successMsg" type="button" selector="div.message-success"/>
15+
<element name="errorMsg" type="button" selector="div.message-error"/>
1516
<element name="alertMessage" type="text" selector=".page.messages [role=alert]"/>
1617
<element name="messagesBlock" type="text" selector=".page.messages"/>
1718
<element name="addToWishlist" type="button" selector="//a[@class='action towishlist']" timeout="30"/>

app/code/Magento/Catalog/etc/frontend/di.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,18 @@
7979
<argument name="typeId" xsi:type="string">recently_compared_product</argument>
8080
</arguments>
8181
</virtualType>
82+
<type name="Magento\Framework\View\Element\Message\MessageConfigurationsPool">
83+
<arguments>
84+
<argument name="configurationsMap" xsi:type="array">
85+
<item name="addCompareSuccessMessage" xsi:type="array">
86+
<item name="renderer" xsi:type="const">\Magento\Framework\View\Element\Message\Renderer\BlockRenderer::CODE</item>
87+
<item name="data" xsi:type="array">
88+
<item name="template" xsi:type="string">Magento_Catalog::messages/addCompareSuccessMessage.phtml</item>
89+
</item>
90+
</item>
91+
</argument>
92+
</arguments>
93+
</type>
8294
<type name="Magento\Catalog\Block\Product\View\Gallery">
8395
<arguments>
8496
<argument name="galleryImagesConfig" xsi:type="array">
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
// @codingStandardsIgnoreFile
7+
/** @var \Magento\Framework\View\Element\Template $block */
8+
?>
9+
<?= $block->escapeHtml(__(
10+
'You added product %1 to the <a href="%2">comparison list</a>.',
11+
$block->getData('product_name'),
12+
$block->getData('compare_list_url')),
13+
['a']
14+
);

app/code/Magento/Checkout/view/frontend/templates/cart/methods.phtml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
<?php $methods = $block->getMethods('methods') ?: $block->getMethods('top_methods') ?>
1515
<ul class="checkout methods items checkout-methods-items">
1616
<?php foreach ($methods as $method): ?>
17-
<?php if ($methodHtml = $block->getMethodHtml($method)): ?>
17+
<?php $methodHtml = $block->getMethodHtml($method); ?>
18+
<?php if (trim($methodHtml) !== ''): ?>
1819
<li class="item"><?= /* @escapeNotVerified */ $methodHtml ?></li>
1920
<?php endif; ?>
2021
<?php endforeach; ?>

app/code/Magento/Contact/Controller/Index/Post.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use Magento\Framework\App\Request\DataPersistorInterface;
1414
use Magento\Framework\Controller\Result\Redirect;
1515
use Magento\Framework\Exception\LocalizedException;
16-
use Magento\Framework\HTTP\PhpEnvironment\Request;
1716
use Psr\Log\LoggerInterface;
1817
use Magento\Framework\App\ObjectManager;
1918
use Magento\Framework\DataObject;
@@ -68,7 +67,7 @@ public function __construct(
6867
*/
6968
public function execute()
7069
{
71-
if (!$this->isPostRequest()) {
70+
if (!$this->getRequest()->isPost()) {
7271
return $this->resultRedirectFactory->create()->setPath('*/*/');
7372
}
7473
try {
@@ -102,16 +101,6 @@ private function sendEmail($post)
102101
);
103102
}
104103

105-
/**
106-
* @return bool
107-
*/
108-
private function isPostRequest()
109-
{
110-
/** @var Request $request */
111-
$request = $this->getRequest();
112-
return !empty($request->getPostValue());
113-
}
114-
115104
/**
116105
* @return array
117106
* @throws \Exception

app/code/Magento/Contact/Test/Unit/Controller/Index/PostTest.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ class PostTest extends \PHPUnit\Framework\TestCase
6565
*/
6666
private $mailMock;
6767

68+
/**
69+
* test setup
70+
*/
6871
protected function setUp()
6972
{
7073
$this->mailMock = $this->getMockBuilder(MailInterface::class)->getMockForAbstractClass();
@@ -78,7 +81,7 @@ protected function setUp()
7881
$this->createMock(\Magento\Framework\Message\ManagerInterface::class);
7982
$this->requestStub = $this->createPartialMock(
8083
\Magento\Framework\App\Request\Http::class,
81-
['getPostValue', 'getParams', 'getParam']
84+
['getPostValue', 'getParams', 'getParam', 'isPost']
8285
);
8386
$this->redirectResultMock = $this->createMock(\Magento\Framework\Controller\Result\Redirect::class);
8487
$this->redirectResultMock->method('setPath')->willReturnSelf();
@@ -120,13 +123,18 @@ protected function setUp()
120123
);
121124
}
122125

126+
/**
127+
* testExecuteEmptyPost
128+
*/
123129
public function testExecuteEmptyPost()
124130
{
125131
$this->stubRequestPostData([]);
126132
$this->assertSame($this->redirectResultMock, $this->controller->execute());
127133
}
128134

129135
/**
136+
* @param array $postData
137+
* @param bool $exceptionExpected
130138
* @dataProvider postDataProvider
131139
*/
132140
public function testExecutePostValidation($postData, $exceptionExpected)
@@ -159,6 +167,9 @@ public function postDataProvider()
159167
];
160168
}
161169

170+
/**
171+
* testExecuteValidPost
172+
*/
162173
public function testExecuteValidPost()
163174
{
164175
$post = ['name' => 'Name', 'comment' => 'Comment', 'email' => 'valid@mail.com', 'hideit' => null];
@@ -177,6 +188,10 @@ public function testExecuteValidPost()
177188
*/
178189
private function stubRequestPostData($post)
179190
{
191+
$this->requestStub
192+
->expects($this->once())
193+
->method('isPost')
194+
->willReturn(!empty($post));
180195
$this->requestStub->method('getPostValue')->willReturn($post);
181196
$this->requestStub->method('getParams')->willReturn($post);
182197
$this->requestStub->method('getParam')->willReturnCallback(

app/code/Magento/Customer/Block/Account/Navigation.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

78
namespace Magento\Customer\Block\Account;
89

@@ -44,12 +45,8 @@ public function getLinks()
4445
* @return int
4546
* @SuppressWarnings(PHPMD.UnusedPrivateMethod)
4647
*/
47-
private function compare(SortLinkInterface $firstLink, SortLinkInterface $secondLink)
48+
private function compare(SortLinkInterface $firstLink, SortLinkInterface $secondLink): int
4849
{
49-
if ($firstLink->getSortOrder() == $secondLink->getSortOrder()) {
50-
return 0;
51-
}
52-
53-
return ($firstLink->getSortOrder() < $secondLink->getSortOrder()) ? 1 : -1;
50+
return $secondLink->getSortOrder() <=> $firstLink->getSortOrder();
5451
}
5552
}

app/code/Magento/Customer/Model/AccountManagement.php

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ private function getAuthentication()
442442
}
443443

444444
/**
445-
* {@inheritdoc}
445+
* @inheritdoc
446446
*/
447447
public function resendConfirmation($email, $websiteId = null, $redirectUrl = '')
448448
{
@@ -465,7 +465,7 @@ public function resendConfirmation($email, $websiteId = null, $redirectUrl = '')
465465
}
466466

467467
/**
468-
* {@inheritdoc}
468+
* @inheritdoc
469469
*/
470470
public function activate($email, $confirmationKey)
471471
{
@@ -474,7 +474,7 @@ public function activate($email, $confirmationKey)
474474
}
475475

476476
/**
477-
* {@inheritdoc}
477+
* @inheritdoc
478478
*/
479479
public function activateById($customerId, $confirmationKey)
480480
{
@@ -514,7 +514,7 @@ private function activateCustomer($customer, $confirmationKey)
514514
}
515515

516516
/**
517-
* {@inheritdoc}
517+
* @inheritdoc
518518
*/
519519
public function authenticate($username, $password)
520520
{
@@ -549,7 +549,7 @@ public function authenticate($username, $password)
549549
}
550550

551551
/**
552-
* {@inheritdoc}
552+
* @inheritdoc
553553
*/
554554
public function validateResetPasswordLinkToken($customerId, $resetPasswordLinkToken)
555555
{
@@ -558,7 +558,7 @@ public function validateResetPasswordLinkToken($customerId, $resetPasswordLinkTo
558558
}
559559

560560
/**
561-
* {@inheritdoc}
561+
* @inheritdoc
562562
*/
563563
public function initiatePasswordReset($email, $template, $websiteId = null)
564564
{
@@ -611,7 +611,7 @@ private function handleUnknownTemplate($template)
611611
}
612612

613613
/**
614-
* {@inheritdoc}
614+
* @inheritdoc
615615
*/
616616
public function resetPassword($email, $resetToken, $newPassword)
617617
{
@@ -720,7 +720,7 @@ protected function getMinPasswordLength()
720720
}
721721

722722
/**
723-
* {@inheritdoc}
723+
* @inheritdoc
724724
*/
725725
public function getConfirmationStatus($customerId)
726726
{
@@ -736,7 +736,7 @@ public function getConfirmationStatus($customerId)
736736
}
737737

738738
/**
739-
* {@inheritdoc}
739+
* @inheritdoc
740740
*/
741741
public function createAccount(CustomerInterface $customer, $password = null, $redirectUrl = '')
742742
{
@@ -758,7 +758,7 @@ public function createAccount(CustomerInterface $customer, $password = null, $re
758758
}
759759

760760
/**
761-
* {@inheritdoc}
761+
* @inheritdoc
762762
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
763763
* @SuppressWarnings(PHPMD.NPathComplexity)
764764
*/
@@ -794,6 +794,11 @@ public function createAccountWithPasswordHash(CustomerInterface $customer, $hash
794794

795795
// Update 'created_in' value with actual store name
796796
if ($customer->getId() === null) {
797+
$websiteId = $customer->getWebsiteId();
798+
if ($websiteId && !$this->isCustomerInStore($websiteId, $customer->getStoreId())) {
799+
throw new LocalizedException(__('The store view is not in the associated website.'));
800+
}
801+
797802
$storeName = $this->storeManager->getStore($customer->getStoreId())->getName();
798803
$customer->setCreatedIn($storeName);
799804
}
@@ -836,7 +841,7 @@ public function createAccountWithPasswordHash(CustomerInterface $customer, $hash
836841
}
837842

838843
/**
839-
* {@inheritdoc}
844+
* @inheritdoc
840845
*/
841846
public function getDefaultBillingAddress($customerId)
842847
{
@@ -845,7 +850,7 @@ public function getDefaultBillingAddress($customerId)
845850
}
846851

847852
/**
848-
* {@inheritdoc}
853+
* @inheritdoc
849854
*/
850855
public function getDefaultShippingAddress($customerId)
851856
{
@@ -880,7 +885,7 @@ protected function sendEmailConfirmation(CustomerInterface $customer, $redirectU
880885
}
881886

882887
/**
883-
* {@inheritdoc}
888+
* @inheritdoc
884889
*/
885890
public function changePassword($email, $currentPassword, $newPassword)
886891
{
@@ -893,7 +898,7 @@ public function changePassword($email, $currentPassword, $newPassword)
893898
}
894899

895900
/**
896-
* {@inheritdoc}
901+
* @inheritdoc
897902
*/
898903
public function changePasswordById($customerId, $currentPassword, $newPassword)
899904
{
@@ -961,7 +966,7 @@ private function getEavValidator()
961966
}
962967

963968
/**
964-
* {@inheritdoc}
969+
* @inheritdoc
965970
*/
966971
public function validate(CustomerInterface $customer)
967972
{
@@ -986,7 +991,7 @@ public function validate(CustomerInterface $customer)
986991
}
987992

988993
/**
989-
* {@inheritdoc}
994+
* @inheritdoc
990995
*/
991996
public function isEmailAvailable($customerEmail, $websiteId = null)
992997
{
@@ -1002,7 +1007,7 @@ public function isEmailAvailable($customerEmail, $websiteId = null)
10021007
}
10031008

10041009
/**
1005-
* {@inheritDoc}
1010+
* @inheritDoc
10061011
*/
10071012
public function isCustomerInStore($customerWebsiteId, $storeId)
10081013
{

0 commit comments

Comments
 (0)