Skip to content

Commit

Permalink
Merge branch '2.4-develop' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav Idolov authored Aug 27, 2020
2 parents 205c088 + 849b6f0 commit 0bbc990
Show file tree
Hide file tree
Showing 760 changed files with 24,283 additions and 4,867 deletions.
36 changes: 24 additions & 12 deletions app/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,48 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

use Magento\Framework\Autoload\AutoloaderRegistry;
use Magento\Framework\Autoload\ClassLoaderWrapper;

/**
* Shortcut constant for the root directory
*/
define('BP', dirname(__DIR__));
\define('BP', \dirname(__DIR__));

define('VENDOR_PATH', BP . '/app/etc/vendor_path.php');
\define('VENDOR_PATH', BP . '/app/etc/vendor_path.php');

if (!file_exists(VENDOR_PATH)) {
if (!\is_readable(VENDOR_PATH)) {
throw new \Exception(
'We can\'t read some files that are required to run the Magento application. '
. 'This usually means file permissions are set incorrectly.'
);
}

$vendorDir = require VENDOR_PATH;
$vendorAutoload = BP . "/{$vendorDir}/autoload.php";
$vendorAutoload = (
static function (): ?string {
$vendorDir = require VENDOR_PATH;

$vendorAutoload = BP . "/{$vendorDir}/autoload.php";
if (\is_readable($vendorAutoload)) {
return $vendorAutoload;
}

$vendorAutoload = "{$vendorDir}/autoload.php";
if (\is_readable($vendorAutoload)) {
return $vendorAutoload;
}

return null;
}
)();

/* 'composer install' validation */
if (file_exists($vendorAutoload)) {
$composerAutoloader = include $vendorAutoload;
} else if (file_exists("{$vendorDir}/autoload.php")) {
$vendorAutoload = "{$vendorDir}/autoload.php";
$composerAutoloader = include $vendorAutoload;
} else {
if ($vendorAutoload === null) {
throw new \Exception(
'Vendor autoload is not found. Please run \'composer install\' under application root directory.'
);
}

$composerAutoloader = include $vendorAutoload;
AutoloaderRegistry::registerAutoloader(new ClassLoaderWrapper($composerAutoloader));
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminCheckAnalyticsTrackingTest">
<annotations>
<stories value="AdminAnalytics Check Tracking."/>
<title value="AdminAnalytics Check Tracking."/>
<description value="AdminAnalytics Check Tracking."/>
<severity value="MINOR"/>
<testCaseId value="MC-36869"/>
</annotations>
<before>
<actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/>
<magentoCLI command="config:set admin/usage/enabled 1" stepKey="enableAdminUsageTracking"/>
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanInvalidatedCaches">
<argument name="tags" value="config full_page"/>
</actionGroup>
<reloadPage stepKey="pageReload"/>
</before>
<after>
<magentoCLI command="config:set admin/usage/enabled 0" stepKey="disableAdminUsageTracking"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>

<waitForPageLoad stepKey="waitForPageReloaded"/>
<seeInPageSource html="var adminAnalyticsMetadata =" stepKey="seeInPageSource"/>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ protected function _getCurrencyList()
/**
* Retrieve filter value
*
* @param null $index
* @param string|null $index
* @return array|null
*/
public function getValue($index = null)
Expand Down Expand Up @@ -194,11 +194,11 @@ public function getCondition()
$rate = $this->_getRate($displayCurrency, $this->_getColumnCurrencyCode());

if (isset($value['from'])) {
$value['from'] *= $rate;
$value['from'] = (float) $value['from'] * $rate;
}

if (isset($value['to'])) {
$value['to'] *= $rate;
$value['to'] = (float) $value['to'] * $rate;
}

$this->prepareRates($displayCurrency);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminNavigateToEmailToFriendSettingsActionGroup">
<amOnPage url="{{AdminConfigurationEmailToFriendPage.url}}" stepKey="navigateToPersistencePage"/>
<conditionalClick selector="{{AdminEmailToFriendSection.DefaultLayoutsTab}}" dependentSelector="{{AdminEmailToFriendSection.CheckIfTabExpand}}" visible="true" stepKey="clickTab"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AssertAdminEmailToFriendOptionsAvailableActionGroup">
<seeElement stepKey="seeEmailTemplateInput" selector="{{AdminEmailToFriendSection.emailTemplate}}"/>
<seeElement stepKey="seeAllowForGuestsInput" selector="{{AdminEmailToFriendSection.allowForGuests}}"/>
<seeElement stepKey="seeMaxRecipientsInput" selector="{{AdminEmailToFriendSection.maxRecipients}}"/>
<seeElement stepKey="seeMaxPerHourInput" selector="{{AdminEmailToFriendSection.maxPerHour}}"/>
<seeElement stepKey="seeLimitSendingBy" selector="{{AdminEmailToFriendSection.limitSendingBy}}"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AssertAdminPageIs404ActionGroup">
<annotations>
<description>Validates that the '404 Error' message is present in the current Admin Page Header.</description>
</annotations>

<see userInput="404 Error" selector="{{AdminHeaderSection.pageHeading}}" stepKey="see404PageHeading"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
<page name="AdminConfigurationEmailToFriendPage" url="admin/system_config/edit/section/sendfriend/" module="Catalog" area="admin">
<section name="AdminEmailToFriendSection"/>
</page>
</pages>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminCatalogEmailToFriendSettingsTest">
<annotations>
<features value="Backend"/>
<stories value="Enable Email To A Friend Functionality"/>
<title value="Admin should be able to manage settings of Email To A Friend Functionality"/>
<description value="Admin should be able to enable Email To A Friend functionality in Magento Admin backend and see additional options"/>
<group value="backend"/>
<severity value="MINOR"></severity>
<testCaseId value="MC-35895"/>
</annotations>

<before>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
<magentoCLI stepKey="enableSendFriend" command="config:set sendfriend/email/enabled 1"/>
<magentoCLI stepKey="cacheClean" command="cache:clean config"/>
</before>
<after>
<magentoCLI stepKey="disableSendFriend" command="config:set sendfriend/email/enabled 0"/>
<magentoCLI stepKey="cacheClean" command="cache:clean config"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>

<actionGroup ref="AdminNavigateToEmailToFriendSettingsActionGroup" stepKey="navigateToSendFriendSettings"/>
<actionGroup ref="AssertAdminEmailToFriendOptionsAvailableActionGroup" stepKey="assertOptions"/>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@
<waitForLoadingMaskToDisappear stepKey="waitForLoadingCheckoutPageWithShippingMethod"/>
<click selector="{{CheckoutShippingMethodsSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/>
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask1"/>
<waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNextButton"/>
<click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickNext"/>
<actionGroup ref="StorefrontCheckoutClickNextButtonActionGroup" stepKey="clickNext"/>
<!-- Checkout select Check/Money Order payment -->
<comment userInput="Select Check/Money payment" stepKey="checkoutSelectCheckMoneyPayment"/>
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Backend\Test\Unit\Block\Widget\Grid\Column\Filter;

use Magento\Backend\Block\Context;
use Magento\Backend\Block\Widget\Grid\Column;
use Magento\Backend\Block\Widget\Grid\Column\Filter\Price;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\DB\Helper;
use Magento\Directory\Model\Currency;
use Magento\Directory\Model\Currency\DefaultLocator;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

class PriceTest extends TestCase
{
/** @var RequestInterface|MockObject */
private $requestMock;

/** @var Context|MockObject */
private $context;

/** @var Helper|MockObject */
private $helper;

/** @var Currency|MockObject */
private $currency;

/** @var DefaultLocator|MockObject */
private $currencyLocator;

/** @var Column|MockObject */
private $columnMock;

/** @var Price */
private $blockPrice;

protected function setUp(): void
{
$this->requestMock = $this->getMockForAbstractClass(RequestInterface::class);

$this->context = $this->createMock(Context::class);
$this->context->expects($this->any())->method('getRequest')->willReturn($this->requestMock);

$this->helper = $this->createMock(Helper::class);

$this->currency = $this->getMockBuilder(Currency::class)
->disableOriginalConstructor()
->setMethods(['getAnyRate'])
->getMock();

$this->currencyLocator = $this->createMock(DefaultLocator::class);

$this->columnMock = $this->getMockBuilder(Column::class)
->disableOriginalConstructor()
->setMethods(['getCurrencyCode'])
->getMock();

$helper = new ObjectManager($this);

$this->blockPrice = $helper->getObject(Price::class, [
'context' => $this->context,
'resourceHelper' => $this->helper,
'currencyModel' => $this->currency,
'currencyLocator' => $this->currencyLocator
]);
$this->blockPrice->setColumn($this->columnMock);
}

public function testGetCondition()
{
$this->currencyLocator->expects(
$this->any()
)->method(
'getDefaultCurrency'
)->with(
$this->requestMock
)->willReturn(
'defaultCurrency'
);

$this->currency->expects($this->at(0))
->method('getAnyRate')
->with('defaultCurrency')
->willReturn(1.0);

$testValue = [
'value' => [
'from' => '1234a',
]
];

$this->blockPrice->addData($testValue);
$this->assertEquals(['from' => 1234], $this->blockPrice->getCondition());
}
}
Loading

0 comments on commit 0bbc990

Please sign in to comment.