Skip to content

Commit

Permalink
Merge branch '2.3-develop' into 2.3-qwerty
Browse files Browse the repository at this point in the history
  • Loading branch information
dvoskoboinikov committed Apr 25, 2019
2 parents 621db01 + ad779f2 commit cd01b7d
Show file tree
Hide file tree
Showing 312 changed files with 7,834 additions and 1,667 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ public function validate(array $validationSubject): ResultInterface
if (isset($transactionResponse['messages']['message']['code'])) {
$errorCodes[] = $transactionResponse['messages']['message']['code'];
$errorMessages[] = $transactionResponse['messages']['message']['text'];
} elseif ($transactionResponse['messages']['message']) {
} elseif (isset($transactionResponse['messages']['message'])) {
foreach ($transactionResponse['messages']['message'] as $message) {
$errorCodes[] = $message['code'];
$errorMessages[] = $message['description'];
}
} elseif (isset($transactionResponse['errors'])) {
foreach ($transactionResponse['errors'] as $message) {
$errorCodes[] = $message['errorCode'];
$errorMessages[] = $message['errorCode'];
$errorMessages[] = $message['errorText'];
}
}

Expand All @@ -85,8 +85,10 @@ private function isResponseCodeAnError(array $transactionResponse): bool
?? $transactionResponse['errors'][0]['errorCode']
?? null;

return in_array($transactionResponse['responseCode'], [self::RESPONSE_CODE_APPROVED, self::RESPONSE_CODE_HELD])
&& $code
return !in_array($transactionResponse['responseCode'], [
self::RESPONSE_CODE_APPROVED, self::RESPONSE_CODE_HELD
])
|| $code
&& !in_array(
$code,
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

/**
* Tests for the transaction response validator
*/
class TransactionResponseValidatorTest extends TestCase
{
private const RESPONSE_CODE_APPROVED = 1;
private const RESPONSE_CODE_HELD = 4;
private const RESPONSE_CODE_DENIED = 2;
private const RESPONSE_REASON_CODE_APPROVED = 1;
private const RESPONSE_REASON_CODE_PENDING_REVIEW_AUTHORIZED = 252;
private const RESPONSE_REASON_CODE_PENDING_REVIEW = 253;
private const ERROR_CODE_AVS_MISMATCH = 27;

/**
* @var ResultInterfaceFactory|MockObject
Expand Down Expand Up @@ -86,16 +91,6 @@ public function testValidateScenarios($transactionResponse, $isValid, $errorCode
public function scenarioProvider()
{
return [
// This validator only cares about successful edge cases so test for default behavior
[
[
'responseCode' => 'foo',
],
true,
[],
[]
],

// Test for acceptable reason codes
[
[
Expand Down Expand Up @@ -208,6 +203,29 @@ public function scenarioProvider()
['foo'],
['bar']
],
[
[
'responseCode' => self::RESPONSE_CODE_DENIED,
'errors' => [
[
'errorCode' => self::ERROR_CODE_AVS_MISMATCH,
'errorText' => 'bar'
]
]
],
false,
[self::ERROR_CODE_AVS_MISMATCH],
['bar']
],
// This validator only cares about successful edge cases so test for default behavior
[
[
'responseCode' => 'foo',
],
false,
[],
[]
],
];
}
}
26 changes: 12 additions & 14 deletions app/code/Magento/Backend/Block/Dashboard/Graph.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ public function __construct(
\Magento\Backend\Helper\Dashboard\Data $dashboardData,
array $data = []
) {
$this->_dashboardData = $dashboardData;
parent::__construct($context, $collectionFactory, $data);
$this->_dashboardData = $dashboardData;
}

/**
Expand All @@ -131,7 +131,7 @@ protected function _getTabTemplate()
/**
* Set data rows
*
* @param array $rows
* @param string $rows
* @return void
*/
public function setDataRows($rows)
Expand All @@ -155,15 +155,14 @@ public function addSeries($seriesId, array $options)
* Get series
*
* @param string $seriesId
* @return array|false
* @return array|bool
*/
public function getSeries($seriesId)
{
if (isset($this->_allSeries[$seriesId])) {
return $this->_allSeries[$seriesId];
} else {
return false;
}
return false;
}

/**
Expand Down Expand Up @@ -308,7 +307,7 @@ public function getChartUrl($directUrl = true)

if ($minvalue >= 0 && $maxvalue >= 0) {
if ($maxvalue > 10) {
$p = pow(10, $this->_getPow($maxvalue));
$p = pow(10, $this->_getPow((int) $maxvalue));
$maxy = ceil($maxvalue / $p) * $p;
$yLabels = range($miny, $maxy, $p);
} else {
Expand Down Expand Up @@ -349,7 +348,7 @@ public function getChartUrl($directUrl = true)
$indexid = 0;
foreach ($this->_axisLabels as $idx => $labels) {
if ($idx == 'x') {
$this->formatAxisLabelDate($idx, $timezoneLocal);
$this->formatAxisLabelDate((string) $idx, (string) $timezoneLocal);
$tmpstring = implode('|', $this->_axisLabels[$idx]);
$valueBuffer[] = $indexid . ":|" . $tmpstring;
} elseif ($idx == 'y') {
Expand All @@ -369,13 +368,12 @@ public function getChartUrl($directUrl = true)
foreach ($params as $name => $value) {
$p[] = $name . '=' . urlencode($value);
}
return self::API_URL . '?' . implode('&', $p);
} else {
$gaData = urlencode(base64_encode(json_encode($params)));
$gaHash = $this->_dashboardData->getChartDataHash($gaData);
$params = ['ga' => $gaData, 'h' => $gaHash];
return $this->getUrl('adminhtml/*/tunnel', ['_query' => $params]);
return (string) self::API_URL . '?' . implode('&', $p);
}
$gaData = urlencode(base64_encode(json_encode($params)));
$gaHash = $this->_dashboardData->getChartDataHash($gaData);
$params = ['ga' => $gaData, 'h' => $gaHash];
return $this->getUrl('adminhtml/*/tunnel', ['_query' => $params]);
}

/**
Expand All @@ -394,7 +392,7 @@ private function formatAxisLabelDate($idx, $timezoneLocal)
switch ($this->getDataHelper()->getParam('period')) {
case '24h':
$this->_axisLabels[$idx][$_index] = $this->_localeDate->formatDateTime(
$period->setTime($period->format('H'), 0, 0),
$period->setTime((int) $period->format('H'), 0, 0),
\IntlDateFormatter::NONE,
\IntlDateFormatter::SHORT
);
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,19 @@
<?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="AdminDashboardSection">
<element name="dashboardDiagramContent" type="button" selector="#diagram_tab_content"/>
<element name="dashboardDiagramOrderContentTab" type="block" selector="#diagram_tab_orders_content"/>
<element name="dashboardDiagramAmounts" type="button" selector="#diagram_tab_amounts"/>
<element name="dashboardDiagramAmountsContentTab" type="block" selector="#diagram_tab_amounts_content"/>
<element name="dashboardDiagramTotals" type="text" selector="#diagram_tab_amounts_content"/>
<element name="dashboardTotals" type="text" selector="//*[@class='dashboard-totals-label' and contains(text(), '{{columnName}}')]/../*[@class='dashboard-totals-value']" parameterized="true"/>
</section>
</sections>
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>
Loading

0 comments on commit cd01b7d

Please sign in to comment.