Skip to content

Commit

Permalink
387-Test coverage of getting IDs of CMS page/blocks by GraphQL API
Browse files Browse the repository at this point in the history
Merge remote-tracking branch 'origin/2.3-develop' into 387-test-coverage-cms-page

# Conflicts:
#	app/code/Magento/CmsGraphQl/etc/schema.graphqls
  • Loading branch information
atwixfirster committed Apr 30, 2019
2 parents f4a4a34 + 93a8162 commit aae7428
Show file tree
Hide file tree
Showing 1,019 changed files with 29,811 additions and 6,345 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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Welcome to Magento 2 installation! We're glad you chose to install Magento 2, a cutting-edge, feature-rich eCommerce solution that gets results.

## Magento System Requirements
[Magento System Requirements](https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements2.html).
[Magento System Requirements](https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements.html).

## Install Magento

Expand Down 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
<entity name="AdminMenuSystem">
<data key="pageTitle">System</data>
<data key="title">Notifications</data>
<data key="dataUiId">magento-backend-system</data>
</entity>
<entity name="AdminMenuSystemOtherSettingsNotifications">
<data key="pageTitle">Notifications</data>
<data key="title">Notifications</data>
<data key="dataUiId">magento-adminnotification-system-adminnotification</data>
</entity>
</entities>
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="AdminSystemNotificationNavigateMenuTest">
<annotations>
<features value="AdminNotification"/>
<stories value="Menu Navigation"/>
<title value="Admin system notification navigate menu test"/>
<description value="Admin should be able to navigate to System > Notifications"/>
<severity value="CRITICAL"/>
<testCaseId value="MC-14125"/>
<group value="menu"/>
<group value="mtf_migrated"/>
</annotations>
<before>
<actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/>
</before>
<after>
<actionGroup ref="logout" stepKey="logout"/>
</after>
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToSystemNotificationPage">
<argument name="menuUiId" value="{{AdminMenuSystem.dataUiId}}"/>
<argument name="submenuUiId" value="{{AdminMenuSystemOtherSettingsNotifications.dataUiId}}"/>
</actionGroup>
<actionGroup ref="AdminAssertPageTitleActionGroup" stepKey="seePageTitle">
<argument name="title" value="{{AdminMenuSystemOtherSettingsNotifications.pageTitle}}"/>
</actionGroup>
</test>
</tests>
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
21 changes: 21 additions & 0 deletions app/code/Magento/Analytics/Test/Mftf/Data/AdminMenuData.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
<entity name="AdminMenuReports">
<data key="pageTitle">Reports</data>
<data key="title">Reports</data>
<data key="dataUiId">magento-reports-report</data>
</entity>
<entity name="AdminMenuReportsBusinessIntelligenceAdvancedReporting">
<data key="pageTitle">AdvancedReporting</data>
<data key="title">AdvancedReporting</data>
<data key="dataUiId">magento-analytics-advanced-reporting</data>
</entity>
</entities>
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="AdminAdvancedReportingNavigateMenuTest">
<annotations>
<features value="Analytics"/>
<stories value="Menu Navigation"/>
<title value="Admin advanced reporting navigate menu test"/>
<description value="Admin should be able to navigate through advanced reporting admin menu to BI reports page"/>
<severity value="CRITICAL"/>
<testCaseId value="MC-14152"/>
<group value="menu"/>
<group value="mtf_migrated"/>
</annotations>
<before>
<actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/>
</before>
<after>
<actionGroup ref="logout" stepKey="logout"/>
</after>
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateAdvancedReportingPage">
<argument name="menuUiId" value="{{AdminMenuReports.dataUiId}}"/>
<argument name="submenuUiId" value="{{AdminMenuReportsBusinessIntelligenceAdvancedReporting.dataUiId}}"/>
</actionGroup>
<switchToNextTab stepKey="switchToNewTab"/>
<seeInCurrentUrl url="advancedreporting.rjmetrics.com/report" stepKey="seeAssertAdvancedReportingPageUrl"/>
</test>
</tests>
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,
[],
[]
],
];
}
}
Loading

0 comments on commit aae7428

Please sign in to comment.