Skip to content

Commit 9c8f4b7

Browse files
ENGCOM-4765: Spelling Mistake in Setup > Patch #22339
- Merge Pull Request #22339 from sudhanshu-bajaj/magento2:correct-spelling - Merged commits: 1. ef5d001 2. 2d8c598 3. 432334e
2 parents c132a2a + 432334e commit 9c8f4b7

File tree

52 files changed

+1924
-167
lines changed

Some content is hidden

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

52 files changed

+1924
-167
lines changed

app/code/Magento/ConfigurableProduct/Setup/Patch/Data/InstallInitialConfigurableAttributes.php

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66

77
namespace Magento\ConfigurableProduct\Setup\Patch\Data;
88

9+
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
910
use Magento\Eav\Setup\EavSetup;
1011
use Magento\Eav\Setup\EavSetupFactory;
11-
use Magento\Framework\App\ResourceConnection;
1212
use Magento\Framework\Setup\ModuleDataSetupInterface;
1313
use Magento\Framework\Setup\Patch\DataPatchInterface;
1414
use Magento\Framework\Setup\Patch\PatchVersionInterface;
15-
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
1615

1716
/**
1817
* Class InstallInitialConfigurableAttributes
18+
*
1919
* @package Magento\ConfigurableProduct\Setup\Patch
2020
*/
2121
class InstallInitialConfigurableAttributes implements DataPatchInterface, PatchVersionInterface
@@ -24,6 +24,7 @@ class InstallInitialConfigurableAttributes implements DataPatchInterface, PatchV
2424
* @var ModuleDataSetupInterface
2525
*/
2626
private $moduleDataSetup;
27+
2728
/**
2829
* @var EavSetupFactory
2930
*/
@@ -43,7 +44,7 @@ public function __construct(
4344
}
4445

4546
/**
46-
* {@inheritdoc}
47+
* @inheritdoc
4748
*/
4849
public function apply()
4950
{
@@ -64,40 +65,43 @@ public function apply()
6465
'color'
6566
];
6667
foreach ($attributes as $attributeCode) {
67-
$relatedProductTypes = explode(
68-
',',
69-
$eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $attributeCode, 'apply_to')
70-
);
71-
if (!in_array(Configurable::TYPE_CODE, $relatedProductTypes)) {
72-
$relatedProductTypes[] = Configurable::TYPE_CODE;
73-
$eavSetup->updateAttribute(
74-
\Magento\Catalog\Model\Product::ENTITY,
75-
$attributeCode,
76-
'apply_to',
77-
implode(',', $relatedProductTypes)
68+
$attribute = $eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $attributeCode, 'apply_to');
69+
if ($attribute) {
70+
$relatedProductTypes = explode(
71+
',',
72+
$attribute
7873
);
74+
if (!in_array(Configurable::TYPE_CODE, $relatedProductTypes)) {
75+
$relatedProductTypes[] = Configurable::TYPE_CODE;
76+
$eavSetup->updateAttribute(
77+
\Magento\Catalog\Model\Product::ENTITY,
78+
$attributeCode,
79+
'apply_to',
80+
implode(',', $relatedProductTypes)
81+
);
82+
}
7983
}
8084
}
8185
}
8286

8387
/**
84-
* {@inheritdoc}
88+
* @inheritdoc
8589
*/
8690
public static function getDependencies()
8791
{
8892
return [];
8993
}
9094

9195
/**
92-
* {@inheritdoc}
96+
* @inheritdoc
9397
*/
9498
public static function getVersion()
9599
{
96100
return '2.0.0';
97101
}
98102

99103
/**
100-
* {@inheritdoc}
104+
* @inheritdoc
101105
*/
102106
public function getAliases()
103107
{

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,6 @@ public function initiatePasswordReset($email, $template, $websiteId = null)
624624
* @param string $rpToken
625625
* @throws ExpiredException
626626
* @throws NoSuchEntityException
627-
*
628627
* @return CustomerInterface
629628
* @throws LocalizedException
630629
*/
@@ -703,7 +702,12 @@ public function resetPassword($email, $resetToken, $newPassword)
703702
$customerSecure->setRpTokenCreatedAt(null);
704703
$customerSecure->setPasswordHash($this->createPasswordHash($newPassword));
705704
$this->destroyCustomerSessions($customer->getId());
706-
$this->sessionManager->destroy();
705+
if ($this->sessionManager->isSessionExists()) {
706+
//delete old session and move data to the new session
707+
//use this instead of $this->sessionManager->regenerateId because last one doesn't delete old session
708+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
709+
session_regenerate_id(true);
710+
}
707711
$this->customerRepository->save($customer);
708712

709713
return true;
@@ -1564,6 +1568,7 @@ private function getEmailNotification()
15641568

15651569
/**
15661570
* Destroy all active customer sessions by customer id (current session will not be destroyed).
1571+
*
15671572
* Customer sessions which should be deleted are collecting from the "customer_visitor" table considering
15681573
* configured session lifetime.
15691574
*

app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontCustomerActionGroup.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
1111
<actionGroup name="CustomerLogoutStorefrontByMenuItemsActionGroup">
12-
<conditionalClick selector="{{StorefrontPanelHeaderSection.customerWelcome}}"
13-
dependentSelector="{{StorefrontPanelHeaderSection.customerWelcomeMenu}}"
12+
<conditionalClick selector="{{StorefrontPanelHeaderSection.customerWelcomeMenu}}"
13+
dependentSelector="{{StorefrontPanelHeaderSection.customerLogoutLink}}"
1414
visible="false"
1515
stepKey="clickHeaderCustomerMenuButton" />
1616
<click selector="{{StorefrontPanelHeaderSection.customerLogoutLink}}" stepKey="clickSignOutButton" />

app/code/Magento/Customer/Test/Mftf/Section/StorefrontPanelHeaderSection.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
<element name="welcomeMessage" type="text" selector="header>.panel .greet.welcome" />
1616
<element name="createAnAccountLink" type="select" selector="//div[@class='panel wrapper']//li/a[contains(.,'Create an Account')]" timeout="30"/>
1717
<element name="notYouLink" type="button" selector=".greet.welcome span a"/>
18-
<element name="customerWelcome" type="text" selector=".panel.header .customer-welcome"/>
19-
<element name="customerWelcomeMenu" type="text" selector=".panel.header .customer-welcome .customer-menu"/>
18+
<element name="customerWelcome" type="text" selector=".panel.header .greet.welcome"/>
19+
<element name="customerWelcomeMenu" type="text" selector=".panel.header .customer-welcome .customer-name"/>
2020
<element name="customerLoginLink" type="button" selector=".panel.header .header.links .authorization-link a" timeout="30"/>
2121
<element name="customerLogoutLink" type="text" selector=".panel.header .customer-welcome .customer-menu .authorization-link a" timeout="30"/>
2222
</section>

app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,8 +1238,7 @@ public function testInitiatePasswordResetEmailReminder()
12381238

12391239
$storeId = 1;
12401240

1241-
mt_srand(mt_rand() + (100000000 * (float)microtime()) % PHP_INT_MAX);
1242-
$hash = md5(uniqid(microtime() . mt_rand(0, mt_getrandmax()), true));
1241+
$hash = hash('sha256', microtime() . random_int(PHP_INT_MIN, PHP_INT_MAX));
12431242

12441243
$this->emailNotificationMock->expects($this->once())
12451244
->method('passwordReminder')
@@ -1263,8 +1262,7 @@ public function testInitiatePasswordResetEmailReset()
12631262
$templateIdentifier = 'Template Identifier';
12641263
$sender = 'Sender';
12651264

1266-
mt_srand(mt_rand() + (100000000 * (float)microtime()) % PHP_INT_MAX);
1267-
$hash = md5(uniqid(microtime() . mt_rand(0, mt_getrandmax()), true));
1265+
$hash = hash('sha256', microtime() . random_int(PHP_INT_MIN, PHP_INT_MAX));
12681266

12691267
$this->emailNotificationMock->expects($this->once())
12701268
->method('passwordResetConfirmation')
@@ -1288,8 +1286,7 @@ public function testInitiatePasswordResetNoTemplate()
12881286
$templateIdentifier = 'Template Identifier';
12891287
$sender = 'Sender';
12901288

1291-
mt_srand(mt_rand() + (100000000 * (float)microtime()) % PHP_INT_MAX);
1292-
$hash = md5(uniqid(microtime() . mt_rand(0, mt_getrandmax()), true));
1289+
$hash = hash('sha256', microtime() . random_int(PHP_INT_MIN, PHP_INT_MAX));
12931290

12941291
$this->prepareInitiatePasswordReset($email, $templateIdentifier, $sender, $storeId, $customerId, $hash);
12951292

@@ -1610,7 +1607,7 @@ function ($string) {
16101607
$this->customerSecure->expects($this->once())->method('setRpTokenCreatedAt')->with(null);
16111608
$this->customerSecure->expects($this->any())->method('setPasswordHash')->willReturn(null);
16121609

1613-
$this->sessionManager->expects($this->atLeastOnce())->method('destroy');
1610+
$this->sessionManager->method('isSessionExists')->willReturn(false);
16141611
$this->sessionManager->expects($this->atLeastOnce())->method('getSessionId');
16151612
$visitor = $this->getMockBuilder(\Magento\Customer\Model\Visitor::class)
16161613
->disableOriginalConstructor()

app/code/Magento/Customer/view/frontend/templates/account/customer.phtml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
data-toggle="dropdown"
1717
data-trigger-keypress-button="true"
1818
data-bind="scope: 'customer'">
19-
<span data-bind="text: customer().fullname"></span>
2019
<button type="button"
2120
class="action switch"
2221
tabindex="-1"

app/code/Magento/Downloadable/Observer/SaveDownloadableOrderItemObserver.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
use Magento\Store\Model\ScopeInterface;
1010

1111
/**
12+
* Saves data from order to purchased links.
13+
*
1214
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1315
*/
1416
class SaveDownloadableOrderItemObserver implements ObserverInterface
@@ -92,9 +94,15 @@ public function execute(\Magento\Framework\Event\Observer $observer)
9294
if ($purchasedLink->getId()) {
9395
return $this;
9496
}
97+
$storeId = $orderItem->getOrder()->getStoreId();
98+
$orderStatusToEnableItem = $this->_scopeConfig->getValue(
99+
\Magento\Downloadable\Model\Link\Purchased\Item::XML_PATH_ORDER_ITEM_STATUS,
100+
ScopeInterface::SCOPE_STORE,
101+
$storeId
102+
);
95103
if (!$product) {
96104
$product = $this->_createProductModel()->setStoreId(
97-
$orderItem->getOrder()->getStoreId()
105+
$storeId
98106
)->load(
99107
$orderItem->getProductId()
100108
);
@@ -150,6 +158,8 @@ public function execute(\Magento\Framework\Event\Observer $observer)
150158
)->setNumberOfDownloadsBought(
151159
$numberOfDownloads
152160
)->setStatus(
161+
\Magento\Sales\Model\Order\Item::STATUS_PENDING == $orderStatusToEnableItem ?
162+
\Magento\Downloadable\Model\Link\Purchased\Item::LINK_STATUS_AVAILABLE :
153163
\Magento\Downloadable\Model\Link\Purchased\Item::LINK_STATUS_PENDING
154164
)->setCreatedAt(
155165
$orderItem->getCreatedAt()
@@ -165,6 +175,8 @@ public function execute(\Magento\Framework\Event\Observer $observer)
165175
}
166176

167177
/**
178+
* Create purchased model.
179+
*
168180
* @return \Magento\Downloadable\Model\Link\Purchased
169181
*/
170182
protected function _createPurchasedModel()
@@ -173,6 +185,8 @@ protected function _createPurchasedModel()
173185
}
174186

175187
/**
188+
* Create product model.
189+
*
176190
* @return \Magento\Catalog\Model\Product
177191
*/
178192
protected function _createProductModel()
@@ -181,6 +195,8 @@ protected function _createProductModel()
181195
}
182196

183197
/**
198+
* Create purchased item model.
199+
*
184200
* @return \Magento\Downloadable\Model\Link\Purchased\Item
185201
*/
186202
protected function _createPurchasedItemModel()
@@ -189,6 +205,8 @@ protected function _createPurchasedItemModel()
189205
}
190206

191207
/**
208+
* Create items collection.
209+
*
192210
* @return \Magento\Downloadable\Model\ResourceModel\Link\Purchased\Item\Collection
193211
*/
194212
protected function _createItemsCollection()

app/code/Magento/NewRelicReporting/Model/Module/Collect.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
use Magento\NewRelicReporting\Model\Config;
1212
use Magento\NewRelicReporting\Model\Module;
1313

14+
/**
15+
* Class for collecting data for the report
16+
*/
1417
class Collect
1518
{
1619
/**
@@ -92,7 +95,6 @@ protected function getAllModules()
9295
* @param string $active
9396
* @param string $setupVersion
9497
* @param string $state
95-
*
9698
* @return array
9799
*/
98100
protected function getNewModuleChanges($moduleName, $active, $setupVersion, $state)
@@ -277,9 +279,7 @@ public function getModuleData($refresh = true)
277279
$changes = array_diff($module, $changeTest);
278280
$changesCleanArray = $this->getCleanChangesArray($changes);
279281

280-
if (count($changesCleanArray) > 0 ||
281-
($this->moduleManager->isOutputEnabled($changeTest['name']) &&
282-
$module['setup_version'] != null)) {
282+
if (!empty($changesCleanArray)) {
283283
$data = [
284284
'entity_id' => $changeTest['entity_id'],
285285
'name' => $changeTest['name'],

app/code/Magento/NewRelicReporting/Test/Unit/Model/Module/CollectTest.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,6 @@ public function testGetModuleDataWithoutRefresh()
162162
->method('getNames')
163163
->willReturn($enabledModulesMockArray);
164164

165-
$this->moduleManagerMock->expects($this->any())->method('isOutputEnabled')->will(
166-
$this->returnValue(false)
167-
);
168-
169165
$this->assertInternalType(
170166
'array',
171167
$this->model->getModuleData()
@@ -256,10 +252,6 @@ public function testGetModuleDataRefresh($data)
256252
->method('getNames')
257253
->willReturn($enabledModulesMockArray);
258254

259-
$this->moduleManagerMock->expects($this->any())->method('isOutputEnabled')->will(
260-
$this->returnValue(true)
261-
);
262-
263255
$this->assertInternalType(
264256
'array',
265257
$this->model->getModuleData()
@@ -350,10 +342,6 @@ public function testGetModuleDataRefreshOrStatement($data)
350342
->method('getNames')
351343
->willReturn($enabledModulesMockArray);
352344

353-
$this->moduleManagerMock->expects($this->any())->method('isOutputEnabled')->will(
354-
$this->returnValue(true)
355-
);
356-
357345
$this->assertInternalType(
358346
'array',
359347
$this->model->getModuleData()

app/code/Magento/Quote/Model/Quote/Item/Compare.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ protected function getOptionValues($value)
5050
if (is_string($value) && $this->jsonValidator->isValid($value)) {
5151
$value = $this->serializer->unserialize($value);
5252
if (is_array($value)) {
53-
unset($value['qty'], $value['uenc']);
53+
unset($value['qty'], $value['uenc'], $value['related_product'], $value['item']);
5454
$value = array_filter($value, function ($optionValue) {
5555
return !empty($optionValue);
5656
});
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\QuoteGraphQl\Model\Resolver;
9+
10+
use Magento\Framework\Exception\LocalizedException;
11+
use Magento\Framework\GraphQl\Config\Element\Field;
12+
use Magento\Framework\GraphQl\Query\ResolverInterface;
13+
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
14+
use Magento\Quote\Model\Quote;
15+
use Magento\QuoteGraphQl\Model\Cart\GetCartForUser;
16+
17+
/**
18+
* @inheritdoc
19+
*/
20+
class CartEmail implements ResolverInterface
21+
{
22+
/**
23+
* @var GetCartForUser
24+
*/
25+
private $getCartForUser;
26+
27+
/**
28+
* @param GetCartForUser $getCartForUser
29+
*/
30+
public function __construct(
31+
GetCartForUser $getCartForUser
32+
) {
33+
$this->getCartForUser = $getCartForUser;
34+
}
35+
36+
/**
37+
* @inheritdoc
38+
*/
39+
public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)
40+
{
41+
if (!isset($value['model'])) {
42+
throw new LocalizedException(__('"model" value should be specified'));
43+
}
44+
/** @var Quote $cart */
45+
$cart = $value['model'];
46+
47+
return $cart->getCustomerEmail();
48+
}
49+
}

0 commit comments

Comments
 (0)