Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/mtf-eol' into MC-4466
Browse files Browse the repository at this point in the history
  • Loading branch information
tomreece committed Apr 30, 2019
2 parents c0f9e27 + 90e46d4 commit 2fa4514
Show file tree
Hide file tree
Showing 454 changed files with 13,510 additions and 2,336 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4136,7 +4136,7 @@ Tests:
* Moved Multishipping functionality to newly created module Multishipping
* Extracted Product duplication behavior from Product model to Product\Copier model
* Replaced event "catalog_model_product_duplicate" with composite Product\Copier model
* Replaced event "catalog_product_prepare_save" with controller product initialization helper that can be customozed via plugins
* Replaced event "catalog_product_prepare_save" with controller product initialization helper that can be customized via plugins
* Consolidated Authorize.Net functionality in single module Authorizenet
* Eliminated dependency of Sales module on Shipping and Usa modules
* Eliminated dependency of Shipping module on Customer module
Expand Down Expand Up @@ -4335,7 +4335,7 @@ Tests:
* Fixed order placing with virtual product using Express Checkout
* Fixed the error during order placement with Recurring profile payment
* Fixed wrong redirect after customer registration during multishipping checkout
* Fixed inability to crate shipping labels
* Fixed inability to create shipping labels
* Fixed inability to switch language, if the default language is English
* Fixed an issue with incorrect XML appearing in cache after some actions on the frontend
* Fixed product export
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Please review the [Code Contributions guide](https://devdocs.magento.com/guides/

## Reporting Security Issues

To report security vulnerabilities in Magento software or web sites, please create a Bugcrowd researcher account [there](https://bugcrowd.com/magento) to submit and follow-up your issue. Learn more about reporting security issues [here](https://magento.com/security/reporting-magento-security-issue).
To report security vulnerabilities or learn more about reporting security issues in Magento software or web sites visit the [Magento Bug Bounty Program](https://hackerone.com/magento) on hackerone. Please create a hackerone account [there](https://hackerone.com/magento) to submit and follow-up your issue.

Stay up-to-date on the latest security news and patches for Magento by signing up for [Security Alert Notifications](https://magento.com/security/sign-up).

Expand Down
4 changes: 3 additions & 1 deletion app/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
* Environment initialization
*/
error_reporting(E_ALL);
stream_wrapper_unregister('phar');
if (in_array('phar', \stream_get_wrappers())) {
stream_wrapper_unregister('phar');
}
#ini_set('display_errors', 1);

/* PHP version validation */
Expand Down
159 changes: 66 additions & 93 deletions app/code/Magento/Backend/Block/Dashboard/Graph.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Backend\Block\Dashboard;

/**
Expand All @@ -15,7 +17,7 @@ class Graph extends \Magento\Backend\Block\Dashboard\AbstractDashboard
/**
* Api URL
*/
const API_URL = 'http://chart.apis.google.com/chart';
const API_URL = 'https://image-charts.com/chart';

/**
* All series
Expand Down Expand Up @@ -76,6 +78,7 @@ class Graph extends \Magento\Backend\Block\Dashboard\AbstractDashboard
/**
* Google chart api data encoding
*
* @deprecated since the Google Image Charts API not accessible from March 14, 2019
* @var string
*/
protected $_encoding = 'e';
Expand Down Expand Up @@ -187,11 +190,12 @@ public function getChartUrl($directUrl = true)
{
$params = [
'cht' => 'lc',
'chf' => 'bg,s,ffffff',
'chco' => 'ef672f',
'chls' => '7',
'chxs' => '0,676056,15,0,l,676056|1,676056,15,0,l,676056',
'chm' => 'h,f2ebde,0,0:1:.1,1,-1',
'chf' => 'bg,s,f4f4f4|c,lg,90,ffffff,0.1,ededed,0',
'chm' => 'B,f4d4b2,0,0,0',
'chco' => 'db4814',
'chxs' => '0,0,11|1,0,11',
'chma' => '15,15,15,15'
];

$this->_allSeries = $this->getRowsData($this->_dataRows);
Expand Down Expand Up @@ -279,20 +283,11 @@ public function getChartUrl($directUrl = true)
$this->_axisLabels['x'] = $dates;
$this->_allSeries = $datas;

//Google encoding values
if ($this->_encoding == "s") {
// simple encoding
$params['chd'] = "s:";
$dataDelimiter = "";
$dataSetdelimiter = ",";
$dataMissing = "_";
} else {
// extended encoding
$params['chd'] = "e:";
$dataDelimiter = "";
$dataSetdelimiter = ",";
$dataMissing = "__";
}
// Image-Charts Awesome data format values
$params['chd'] = "a:";
$dataDelimiter = ",";
$dataSetdelimiter = "|";
$dataMissing = "_";

// process each string in the array, and find the max length
$localmaxvalue = [0];
Expand All @@ -306,7 +301,6 @@ public function getChartUrl($directUrl = true)
$minvalue = min($localminvalue);

// default values
$yrange = 0;
$yLabels = [];
$miny = 0;
$maxy = 0;
Expand All @@ -321,52 +315,21 @@ public function getChartUrl($directUrl = true)
$maxy = ceil($maxvalue + 1);
$yLabels = range($miny, $maxy, 1);
}
$yrange = $maxy;
$yorigin = 0;
}

$chartdata = [];

foreach ($this->getAllSeries() as $index => $serie) {
$thisdataarray = $serie;
if ($this->_encoding == "s") {
// SIMPLE ENCODING
for ($j = 0; $j < sizeof($thisdataarray); $j++) {
$currentvalue = $thisdataarray[$j];
if (is_numeric($currentvalue)) {
$ylocation = round(
(strlen($this->_simpleEncoding) - 1) * ($yorigin + $currentvalue) / $yrange
);
$chartdata[] = substr($this->_simpleEncoding, $ylocation, 1) . $dataDelimiter;
} else {
$chartdata[] = $dataMissing . $dataDelimiter;
}
}
} else {
// EXTENDED ENCODING
for ($j = 0; $j < sizeof($thisdataarray); $j++) {
$currentvalue = $thisdataarray[$j];
if (is_numeric($currentvalue)) {
if ($yrange) {
$ylocation = 4095 * ($yorigin + $currentvalue) / $yrange;
} else {
$ylocation = 0;
}
$firstchar = floor($ylocation / 64);
$secondchar = $ylocation % 64;
$mappedchar = substr(
$this->_extendedEncoding,
$firstchar,
1
) . substr(
$this->_extendedEncoding,
$secondchar,
1
);
$chartdata[] = $mappedchar . $dataDelimiter;
} else {
$chartdata[] = $dataMissing . $dataDelimiter;
}
$count = count($thisdataarray);
for ($j = 0; $j < $count; $j++) {
$currentvalue = $thisdataarray[$j];
if (is_numeric($currentvalue)) {
$ylocation = $yorigin + $currentvalue;
$chartdata[] = $ylocation . $dataDelimiter;
} else {
$chartdata[] = $dataMissing . $dataDelimiter;
}
}
$chartdata[] = $dataSetdelimiter;
Expand All @@ -381,45 +344,13 @@ public function getChartUrl($directUrl = true)

$valueBuffer = [];

if (sizeof($this->_axisLabels) > 0) {
if (count($this->_axisLabels) > 0) {
$params['chxt'] = implode(',', array_keys($this->_axisLabels));
$indexid = 0;
foreach ($this->_axisLabels as $idx => $labels) {
if ($idx == 'x') {
/**
* Format date
*/
foreach ($this->_axisLabels[$idx] as $_index => $_label) {
if ($_label != '') {
$period = new \DateTime($_label, new \DateTimeZone($timezoneLocal));
switch ($this->getDataHelper()->getParam('period')) {
case '24h':
$this->_axisLabels[$idx][$_index] = $this->_localeDate->formatDateTime(
$period->setTime($period->format('H'), 0, 0),
\IntlDateFormatter::NONE,
\IntlDateFormatter::SHORT
);
break;
case '7d':
case '1m':
$this->_axisLabels[$idx][$_index] = $this->_localeDate->formatDateTime(
$period,
\IntlDateFormatter::SHORT,
\IntlDateFormatter::NONE
);
break;
case '1y':
case '2y':
$this->_axisLabels[$idx][$_index] = date('m/Y', strtotime($_label));
break;
}
} else {
$this->_axisLabels[$idx][$_index] = '';
}
}

$this->formatAxisLabelDate($idx, $timezoneLocal);
$tmpstring = implode('|', $this->_axisLabels[$idx]);

$valueBuffer[] = $indexid . ":|" . $tmpstring;
} elseif ($idx == 'y') {
$valueBuffer[] = $indexid . ":|" . implode('|', $yLabels);
Expand Down Expand Up @@ -447,6 +378,46 @@ public function getChartUrl($directUrl = true)
}
}

/**
* Format dates for axis labels
*
* @param string $idx
* @param string $timezoneLocal
*
* @return void
*/
private function formatAxisLabelDate($idx, $timezoneLocal)
{
foreach ($this->_axisLabels[$idx] as $_index => $_label) {
if ($_label != '') {
$period = new \DateTime($_label, new \DateTimeZone($timezoneLocal));
switch ($this->getDataHelper()->getParam('period')) {
case '24h':
$this->_axisLabels[$idx][$_index] = $this->_localeDate->formatDateTime(
$period->setTime($period->format('H'), 0, 0),
\IntlDateFormatter::NONE,
\IntlDateFormatter::SHORT
);
break;
case '7d':
case '1m':
$this->_axisLabels[$idx][$_index] = $this->_localeDate->formatDateTime(
$period,
\IntlDateFormatter::SHORT,
\IntlDateFormatter::NONE
);
break;
case '1y':
case '2y':
$this->_axisLabels[$idx][$_index] = date('m/Y', strtotime($_label));
break;
}
} else {
$this->_axisLabels[$idx][$_index] = '';
}
}
}

/**
* Get rows data
*
Expand Down Expand Up @@ -540,6 +511,8 @@ protected function getHeight()
}

/**
* Sets data helper
*
* @param \Magento\Backend\Helper\Dashboard\AbstractDashboard $dataHelper
* @return void
*/
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="AssertAdminDashboardPageIsVisibleActionGroup">
<seeInCurrentUrl url="{{AdminDashboardPage.url}}" stepKey="seeDashboardUrl"/>
<see userInput="Dashboard" selector="{{AdminHeaderSection.pageTitle}}" stepKey="seeDashboardTitle"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<argument name="message" type="string" defaultValue="The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later." />
<argument name="messageType" type="string" defaultValue="error" />
</arguments>

<waitForElementVisible selector="{{AdminLoginMessagesSection.messageByType(messageType)}}" stepKey="waitForAdminLoginFormMessage" />
<see userInput="{{message}}" selector="{{AdminLoginMessagesSection.messageByType(messageType)}}" stepKey="verifyMessage" />
</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="AdminForgotPasswordPage" url="admin/auth/forgotpassword/" area="admin" module="Magento_Backend">
<section name="AdminForgotPasswordFormSection"/>
</page>
</pages>
1 change: 1 addition & 0 deletions app/code/Magento/Backend/Test/Mftf/Page/AdminLoginPage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
<page name="AdminLoginPage" url="admin" area="admin" module="Magento_Backend">
<section name="AdminLoginMessagesSection"/>
<section name="AdminLoginFormSection"/>
</page>
</pages>
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.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminForgotPasswordFormSection">
<element name="email" type="input" selector="#login-form input[name='email']"/>
<element name="retrievePasswordButton" type="button" selector="#login-form button[type='submit']" timeout="30"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
<element name="username" type="input" selector="#username"/>
<element name="password" type="input" selector="#login"/>
<element name="signIn" type="button" selector=".actions .action-primary" timeout="30"/>
<element name="forgotPasswordLink" type="button" selector=".action-forgotpassword" timeout="10"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?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="AdminUserLoginWithStoreCodeInUrlTest">
<annotations>
<features value="Backend"/>
<title value="Admin panel should be accessible with Add Store Code to URL setting enabled"/>
<description value="Admin panel should be accessible with Add Store Code to URL setting enabled"/>
<testCaseId value="MC-14279" />
<group value="backend"/>
<group value="mtf_migrated"/>
</annotations>
<before>
<magentoCLI command="config:set {{StorefrontEnableAddStoreCodeToUrls.path}} {{StorefrontEnableAddStoreCodeToUrls.value}}" stepKey="addStoreCodeToUrlEnable"/>
</before>
<after>
<magentoCLI command="config:set {{StorefrontDisableAddStoreCodeToUrls.path}} {{StorefrontDisableAddStoreCodeToUrls.value}}" stepKey="addStoreCodeToUrlDisable"/>
</after>

<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
<actionGroup ref="AssertAdminDashboardPageIsVisibleActionGroup" stepKey="seeDashboardPage"/>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ public function execute()
$this->_coreRegistry->register('backup_manager', $backupManager);

if ($this->getRequest()->getParam('maintenance_mode')) {
if (!$this->maintenanceMode->set(true)) {
$this->maintenanceMode->set(true);

if (!$this->maintenanceMode->isOn()) {
$response->setError(
__(
'You need more permissions to activate maintenance mode right now.'
Expand Down
Loading

0 comments on commit 2fa4514

Please sign in to comment.