Skip to content

Commit 0bbc990

Browse files
author
Stanislav Idolov
authored
Merge branch '2.4-develop' into patch-1
2 parents 205c088 + 849b6f0 commit 0bbc990

File tree

760 files changed

+24283
-4867
lines changed

Some content is hidden

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

760 files changed

+24283
-4867
lines changed

app/autoload.php

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,48 @@
55
* Copyright © Magento, Inc. All rights reserved.
66
* See COPYING.txt for license details.
77
*/
8+
declare(strict_types=1);
9+
810
use Magento\Framework\Autoload\AutoloaderRegistry;
911
use Magento\Framework\Autoload\ClassLoaderWrapper;
1012

1113
/**
1214
* Shortcut constant for the root directory
1315
*/
14-
define('BP', dirname(__DIR__));
16+
\define('BP', \dirname(__DIR__));
1517

16-
define('VENDOR_PATH', BP . '/app/etc/vendor_path.php');
18+
\define('VENDOR_PATH', BP . '/app/etc/vendor_path.php');
1719

18-
if (!file_exists(VENDOR_PATH)) {
20+
if (!\is_readable(VENDOR_PATH)) {
1921
throw new \Exception(
2022
'We can\'t read some files that are required to run the Magento application. '
2123
. 'This usually means file permissions are set incorrectly.'
2224
);
2325
}
2426

25-
$vendorDir = require VENDOR_PATH;
26-
$vendorAutoload = BP . "/{$vendorDir}/autoload.php";
27+
$vendorAutoload = (
28+
static function (): ?string {
29+
$vendorDir = require VENDOR_PATH;
30+
31+
$vendorAutoload = BP . "/{$vendorDir}/autoload.php";
32+
if (\is_readable($vendorAutoload)) {
33+
return $vendorAutoload;
34+
}
35+
36+
$vendorAutoload = "{$vendorDir}/autoload.php";
37+
if (\is_readable($vendorAutoload)) {
38+
return $vendorAutoload;
39+
}
40+
41+
return null;
42+
}
43+
)();
2744

28-
/* 'composer install' validation */
29-
if (file_exists($vendorAutoload)) {
30-
$composerAutoloader = include $vendorAutoload;
31-
} else if (file_exists("{$vendorDir}/autoload.php")) {
32-
$vendorAutoload = "{$vendorDir}/autoload.php";
33-
$composerAutoloader = include $vendorAutoload;
34-
} else {
45+
if ($vendorAutoload === null) {
3546
throw new \Exception(
3647
'Vendor autoload is not found. Please run \'composer install\' under application root directory.'
3748
);
3849
}
3950

51+
$composerAutoloader = include $vendorAutoload;
4052
AutoloaderRegistry::registerAutoloader(new ClassLoaderWrapper($composerAutoloader));
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminCheckAnalyticsTrackingTest">
12+
<annotations>
13+
<stories value="AdminAnalytics Check Tracking."/>
14+
<title value="AdminAnalytics Check Tracking."/>
15+
<description value="AdminAnalytics Check Tracking."/>
16+
<severity value="MINOR"/>
17+
<testCaseId value="MC-36869"/>
18+
</annotations>
19+
<before>
20+
<actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/>
21+
<magentoCLI command="config:set admin/usage/enabled 1" stepKey="enableAdminUsageTracking"/>
22+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanInvalidatedCaches">
23+
<argument name="tags" value="config full_page"/>
24+
</actionGroup>
25+
<reloadPage stepKey="pageReload"/>
26+
</before>
27+
<after>
28+
<magentoCLI command="config:set admin/usage/enabled 0" stepKey="disableAdminUsageTracking"/>
29+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
30+
</after>
31+
32+
<waitForPageLoad stepKey="waitForPageReloaded"/>
33+
<seeInPageSource html="var adminAnalyticsMetadata =" stepKey="seeInPageSource"/>
34+
</test>
35+
</tests>

app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Price.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ protected function _getCurrencyList()
162162
/**
163163
* Retrieve filter value
164164
*
165-
* @param null $index
165+
* @param string|null $index
166166
* @return array|null
167167
*/
168168
public function getValue($index = null)
@@ -194,11 +194,11 @@ public function getCondition()
194194
$rate = $this->_getRate($displayCurrency, $this->_getColumnCurrencyCode());
195195

196196
if (isset($value['from'])) {
197-
$value['from'] *= $rate;
197+
$value['from'] = (float) $value['from'] * $rate;
198198
}
199199

200200
if (isset($value['to'])) {
201-
$value['to'] *= $rate;
201+
$value['to'] = (float) $value['to'] * $rate;
202202
}
203203

204204
$this->prepareRates($displayCurrency);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminNavigateToEmailToFriendSettingsActionGroup">
12+
<amOnPage url="{{AdminConfigurationEmailToFriendPage.url}}" stepKey="navigateToPersistencePage"/>
13+
<conditionalClick selector="{{AdminEmailToFriendSection.DefaultLayoutsTab}}" dependentSelector="{{AdminEmailToFriendSection.CheckIfTabExpand}}" visible="true" stepKey="clickTab"/>
14+
</actionGroup>
15+
</actionGroups>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertAdminEmailToFriendOptionsAvailableActionGroup">
12+
<seeElement stepKey="seeEmailTemplateInput" selector="{{AdminEmailToFriendSection.emailTemplate}}"/>
13+
<seeElement stepKey="seeAllowForGuestsInput" selector="{{AdminEmailToFriendSection.allowForGuests}}"/>
14+
<seeElement stepKey="seeMaxRecipientsInput" selector="{{AdminEmailToFriendSection.maxRecipients}}"/>
15+
<seeElement stepKey="seeMaxPerHourInput" selector="{{AdminEmailToFriendSection.maxPerHour}}"/>
16+
<seeElement stepKey="seeLimitSendingBy" selector="{{AdminEmailToFriendSection.limitSendingBy}}"/>
17+
</actionGroup>
18+
</actionGroups>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertAdminPageIs404ActionGroup">
12+
<annotations>
13+
<description>Validates that the '404 Error' message is present in the current Admin Page Header.</description>
14+
</annotations>
15+
16+
<see userInput="404 Error" selector="{{AdminHeaderSection.pageHeading}}" stepKey="see404PageHeading"/>
17+
</actionGroup>
18+
</actionGroups>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
11+
<page name="AdminConfigurationEmailToFriendPage" url="admin/system_config/edit/section/sendfriend/" module="Catalog" area="admin">
12+
<section name="AdminEmailToFriendSection"/>
13+
</page>
14+
</pages>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminCatalogEmailToFriendSettingsTest">
12+
<annotations>
13+
<features value="Backend"/>
14+
<stories value="Enable Email To A Friend Functionality"/>
15+
<title value="Admin should be able to manage settings of Email To A Friend Functionality"/>
16+
<description value="Admin should be able to enable Email To A Friend functionality in Magento Admin backend and see additional options"/>
17+
<group value="backend"/>
18+
<severity value="MINOR"></severity>
19+
<testCaseId value="MC-35895"/>
20+
</annotations>
21+
22+
<before>
23+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
24+
<magentoCLI stepKey="enableSendFriend" command="config:set sendfriend/email/enabled 1"/>
25+
<magentoCLI stepKey="cacheClean" command="cache:clean config"/>
26+
</before>
27+
<after>
28+
<magentoCLI stepKey="disableSendFriend" command="config:set sendfriend/email/enabled 0"/>
29+
<magentoCLI stepKey="cacheClean" command="cache:clean config"/>
30+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
31+
</after>
32+
33+
<actionGroup ref="AdminNavigateToEmailToFriendSettingsActionGroup" stepKey="navigateToSendFriendSettings"/>
34+
<actionGroup ref="AssertAdminEmailToFriendOptionsAvailableActionGroup" stepKey="assertOptions"/>
35+
</test>
36+
</tests>

app/code/Magento/Backend/Test/Mftf/Test/AdminDashboardWithChartsTest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@
6464
<waitForLoadingMaskToDisappear stepKey="waitForLoadingCheckoutPageWithShippingMethod"/>
6565
<click selector="{{CheckoutShippingMethodsSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/>
6666
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask1"/>
67-
<waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNextButton"/>
68-
<click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickNext"/>
67+
<actionGroup ref="StorefrontCheckoutClickNextButtonActionGroup" stepKey="clickNext"/>
6968
<!-- Checkout select Check/Money Order payment -->
7069
<comment userInput="Select Check/Money payment" stepKey="checkoutSelectCheckMoneyPayment"/>
7170
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/>
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
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\Backend\Test\Unit\Block\Widget\Grid\Column\Filter;
9+
10+
use Magento\Backend\Block\Context;
11+
use Magento\Backend\Block\Widget\Grid\Column;
12+
use Magento\Backend\Block\Widget\Grid\Column\Filter\Price;
13+
use Magento\Framework\App\RequestInterface;
14+
use Magento\Framework\DB\Helper;
15+
use Magento\Directory\Model\Currency;
16+
use Magento\Directory\Model\Currency\DefaultLocator;
17+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
18+
use PHPUnit\Framework\MockObject\MockObject;
19+
use PHPUnit\Framework\TestCase;
20+
21+
class PriceTest extends TestCase
22+
{
23+
/** @var RequestInterface|MockObject */
24+
private $requestMock;
25+
26+
/** @var Context|MockObject */
27+
private $context;
28+
29+
/** @var Helper|MockObject */
30+
private $helper;
31+
32+
/** @var Currency|MockObject */
33+
private $currency;
34+
35+
/** @var DefaultLocator|MockObject */
36+
private $currencyLocator;
37+
38+
/** @var Column|MockObject */
39+
private $columnMock;
40+
41+
/** @var Price */
42+
private $blockPrice;
43+
44+
protected function setUp(): void
45+
{
46+
$this->requestMock = $this->getMockForAbstractClass(RequestInterface::class);
47+
48+
$this->context = $this->createMock(Context::class);
49+
$this->context->expects($this->any())->method('getRequest')->willReturn($this->requestMock);
50+
51+
$this->helper = $this->createMock(Helper::class);
52+
53+
$this->currency = $this->getMockBuilder(Currency::class)
54+
->disableOriginalConstructor()
55+
->setMethods(['getAnyRate'])
56+
->getMock();
57+
58+
$this->currencyLocator = $this->createMock(DefaultLocator::class);
59+
60+
$this->columnMock = $this->getMockBuilder(Column::class)
61+
->disableOriginalConstructor()
62+
->setMethods(['getCurrencyCode'])
63+
->getMock();
64+
65+
$helper = new ObjectManager($this);
66+
67+
$this->blockPrice = $helper->getObject(Price::class, [
68+
'context' => $this->context,
69+
'resourceHelper' => $this->helper,
70+
'currencyModel' => $this->currency,
71+
'currencyLocator' => $this->currencyLocator
72+
]);
73+
$this->blockPrice->setColumn($this->columnMock);
74+
}
75+
76+
public function testGetCondition()
77+
{
78+
$this->currencyLocator->expects(
79+
$this->any()
80+
)->method(
81+
'getDefaultCurrency'
82+
)->with(
83+
$this->requestMock
84+
)->willReturn(
85+
'defaultCurrency'
86+
);
87+
88+
$this->currency->expects($this->at(0))
89+
->method('getAnyRate')
90+
->with('defaultCurrency')
91+
->willReturn(1.0);
92+
93+
$testValue = [
94+
'value' => [
95+
'from' => '1234a',
96+
]
97+
];
98+
99+
$this->blockPrice->addData($testValue);
100+
$this->assertEquals(['from' => 1234], $this->blockPrice->getCondition());
101+
}
102+
}

0 commit comments

Comments
 (0)