Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/2.3-develop' into PR#631
Browse files Browse the repository at this point in the history
# Conflicts:
#	app/code/Magento/QuoteGraphQl/Model/Resolver/UpdateCartItems.php
  • Loading branch information
naydav committed Apr 29, 2019
2 parents 035f602 + 3ccf676 commit 0cd4e02
Show file tree
Hide file tree
Showing 339 changed files with 7,005 additions and 2,940 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<block class="Magento\Backend\Block\Widget\Grid" name="adminhtml.notification.container.grid" as="grid">
<arguments>
<argument name="id" xsi:type="string">notificationGrid</argument>
<argument name="dataSource" xsi:type="object">Magento\AdminNotification\Model\ResourceModel\Grid\Collection</argument>
<argument name="dataSource" xsi:type="object" shared="false">Magento\AdminNotification\Model\ResourceModel\Grid\Collection</argument>
<argument name="default_dir" xsi:type="string">DESC</argument>
<argument name="default_sort" xsi:type="string">date_added</argument>
<argument name="save_parameters_in_session" xsi:type="string">1</argument>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<block class="Magento\AdvancedSearch\Block\Adminhtml\Search\Grid" name="search.edit.grid" as="grid">
<arguments>
<argument name="id" xsi:type="string">catalog_search_grid</argument>
<argument name="dataSource" xsi:type="object">Magento\AdvancedSearch\Model\ResourceModel\Search\Grid\Collection</argument>
<argument name="dataSource" xsi:type="object" shared="false">Magento\AdvancedSearch\Model\ResourceModel\Search\Grid\Collection</argument>
<argument name="default_sort" xsi:type="string">name</argument>
<argument name="default_dir" xsi:type="string">ASC</argument>
<argument name="save_parameters_in_session" xsi:type="string">1</argument>
Expand Down
14 changes: 12 additions & 2 deletions app/code/Magento/Authorization/Model/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,29 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritDoc
*
* @SuppressWarnings(PHPMD.SerializationAware)
* @deprecated Do not use PHP serialization.
*/
public function __sleep()
{
trigger_error('Using PHP serialization is deprecated', E_USER_DEPRECATED);

$properties = parent::__sleep();
return array_diff($properties, ['_resource', '_resourceCollection']);
}

/**
* {@inheritdoc}
* @inheritDoc
*
* @SuppressWarnings(PHPMD.SerializationAware)
* @deprecated Do not use PHP serialization.
*/
public function __wakeup()
{
trigger_error('Using PHP serialization is deprecated', E_USER_DEPRECATED);

parent::__wakeup();
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$this->_resource = $objectManager->get(\Magento\Authorization\Model\ResourceModel\Role::class);
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
Loading

0 comments on commit 0cd4e02

Please sign in to comment.