Skip to content

Commit f5db9f9

Browse files
committed
Merge remote-tracking branch 'origin/2.4-develop' into MCP-218
2 parents acab580 + adc70c4 commit f5db9f9

34 files changed

+884
-25
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminAwsS3ExportTaxRatesTest" extends="AdminExportTaxRatesTest">
12+
<annotations>
13+
<features value="AwsS3"/>
14+
<stories value="Export Tax"/>
15+
<title value="S3 - Export Tax Rates"/>
16+
<description value="Exports tax rates from the System > Data Transfer > Import/Export Tax Rates page, from
17+
the Tax Rule page, from the Tax Rates grid page as a .csv, and from the Tax Rates grid page as an .xml.
18+
Validates contents in downloaded file for each export area. Note that MFTF cannot simply click export and
19+
have access to the file that is downloaded in the browser due to the test not having access to the server
20+
that is running the test browser. Therefore, this test verifies that the Export button can be successfully
21+
clicked, grabs the request URL from the Export button's form, executes the request on the magento machine
22+
via a curl request, and verifies the contents of the exported file. Uses S3 for the file system."/>
23+
<severity value="MAJOR"/>
24+
<testCaseId value="MC-38621"/>
25+
<group value="importExport"/>
26+
<group value="tax"/>
27+
</annotations>
28+
29+
<before>
30+
<!-- Enable AWS S3 Remote Storage -->
31+
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.enable_options}}" stepKey="enableRemoteStorage" before="revertInitialTaxRateCA"/>
32+
</before>
33+
34+
<after>
35+
<!-- Disable AWS S3 Remote Storage -->
36+
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.disable_options}}" stepKey="disableRemoteStorage" after="logoutFromAdmin"/>
37+
</after>
38+
</test>
39+
</tests>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminAwsS3ImportTaxRatesTest" extends="AdminImportTaxRatesTest">
12+
<annotations>
13+
<features value="AwsS3"/>
14+
<stories value="Import Tax"/>
15+
<title value="S3 - Import and Update Tax Rates"/>
16+
<description value="Imports tax rates from the System > Data Transfer > Import/Export Tax Rates page and
17+
from the Tax Rule page, to create new tax rates and update existing tax rates. Verifies results on the Tax
18+
Rates grid page. Uses S3 for the file system."/>
19+
<severity value="MAJOR"/>
20+
<testCaseId value="MC-38621"/>
21+
<group value="importExport"/>
22+
<group value="tax"/>
23+
</annotations>
24+
25+
<before>
26+
<!-- Enable AWS S3 Remote Storage -->
27+
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.enable_options}}" stepKey="enableRemoteStorage" before="revertInitialTaxRateCA"/>
28+
</before>
29+
30+
<after>
31+
<!-- Disable AWS S3 Remote Storage -->
32+
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.disable_options}}" stepKey="disableRemoteStorage" after="logoutFromAdmin"/>
33+
</after>
34+
</test>
35+
</tests>
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Backend\Test\Mftf\Helper;
9+
10+
use Magento\FunctionalTestingFramework\Helper\Helper;
11+
12+
/**
13+
* Class for MFTF helpers for curl requests.
14+
*/
15+
class CurlHelpers extends Helper
16+
{
17+
/**
18+
* Assert a that a curl request's response contains an expected string
19+
*
20+
* @param string $url
21+
* @param string $expectedString
22+
* @param string $postBody
23+
* @param string $cookieName
24+
* @return void
25+
*
26+
*/
27+
public function assertCurlResponseContainsString($url, $expectedString, $postBody = null, $cookieName = 'admin'): void
28+
{
29+
$cookie = $this->getCookie($cookieName);
30+
$curlResponse = $this->getCurlResponse($url, $cookie, $postBody);
31+
$this->assertStringContainsString($expectedString, $curlResponse);
32+
}
33+
34+
/**
35+
* Sends a curl request with the provided URL & cookie. Returns the response
36+
*
37+
* @param string $url
38+
* @param string $cookie
39+
* @param string $postBody
40+
* @return string
41+
*
42+
*/
43+
private function getCurlResponse($url, $cookie = null, $postBody = null): string
44+
{
45+
// Start Session
46+
$session = curl_init($url);
47+
48+
// Set Options
49+
if ($postBody) {
50+
$data = json_decode($postBody, true);
51+
curl_setopt($session, CURLOPT_POST, true);
52+
curl_setopt($session, CURLOPT_POSTFIELDS, $data);
53+
}
54+
curl_setopt($session, CURLOPT_COOKIE, $cookie);
55+
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
56+
57+
// Execute
58+
$response = curl_exec($session);
59+
curl_close($session);
60+
61+
return $response;
62+
}
63+
64+
/**
65+
* Gets the value of the specified cookie and returns the key value pair of the cookie
66+
*
67+
* @param string $cookieName
68+
* @return string
69+
*
70+
*/
71+
private function getCookie($cookieName = 'admin'): string
72+
{
73+
try {
74+
$webDriver = $this->getModule('\Magento\FunctionalTestingFramework\Module\MagentoWebDriver');
75+
$cookieValue = $webDriver->grabCookie($cookieName);
76+
77+
return $cookieName . '=' . $cookieValue;
78+
} catch (\Exception $exception) {
79+
$this->fail($exception->getMessage());
80+
return '';
81+
}
82+
}
83+
}

app/code/Magento/Catalog/etc/db_schema.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1693,7 +1693,7 @@
16931693
<constraint xsi:type="foreign" referenceId="CAT_PRD_ENTT_MDA_GLR_VAL_TO_ENTT_ENTT_ID_CAT_PRD_ENTT_ENTT_ID"
16941694
table="catalog_product_entity_media_gallery_value_to_entity" column="entity_id"
16951695
referenceTable="catalog_product_entity" referenceColumn="entity_id" onDelete="CASCADE"/>
1696-
<constraint xsi:type="unique" referenceId="CAT_PRD_ENTT_MDA_GLR_VAL_TO_ENTT_VAL_ID_ENTT_ID">
1696+
<constraint xsi:type="primary" referenceId="CAT_PRD_ENTT_MDA_GLR_VAL_TO_ENTT_VAL_ID_ENTT_ID">
16971697
<column name="value_id"/>
16981698
<column name="entity_id"/>
16991699
</constraint>

app/code/Magento/Catalog/etc/db_schema_whitelist.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,7 @@
10201020
"entity_id": true
10211021
},
10221022
"constraint": {
1023+
"PRIMARY": true,
10231024
"FK_A6C6C8FAA386736921D3A7C4B50B1185": true,
10241025
"CAT_PRD_ENTT_MDA_GLR_VAL_TO_ENTT_ENTT_ID_CAT_PRD_ENTT_ENTT_ID": true,
10251026
"CAT_PRD_ENTT_MDA_GLR_VAL_TO_ENTT_VAL_ID_ENTT_ID": true

app/code/Magento/CatalogUrlRewrite/etc/db_schema.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
comment="category_id"/>
1616
<column xsi:type="int" name="product_id" unsigned="true" nullable="false" identity="false"
1717
comment="product_id"/>
18+
<constraint xsi:type="primary" referenceId="PRIMARY">
19+
<column name="url_rewrite_id"/>
20+
</constraint>
1821
<constraint xsi:type="foreign" referenceId="CAT_URL_REWRITE_PRD_CTGR_PRD_ID_CAT_PRD_ENTT_ENTT_ID"
1922
table="catalog_url_rewrite_product_category" column="product_id"
2023
referenceTable="catalog_product_entity" referenceColumn="entity_id" onDelete="CASCADE"/>

app/code/Magento/CatalogUrlRewrite/etc/db_schema_whitelist.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
"CATALOG_URL_REWRITE_PRODUCT_CATEGORY_CATEGORY_ID_PRODUCT_ID": true
1010
},
1111
"constraint": {
12+
"PRIMARY": true,
1213
"CAT_URL_REWRITE_PRD_CTGR_PRD_ID_CAT_PRD_ENTT_ENTT_ID": true,
1314
"FK_BB79E64705D7F17FE181F23144528FC8": true,
1415
"CAT_URL_REWRITE_PRD_CTGR_CTGR_ID_CAT_CTGR_ENTT_ENTT_ID": true,
1516
"CAT_URL_REWRITE_PRD_CTGR_CTGR_ID_SEQUENCE_CAT_CTGR_SEQUENCE_VAL": true,
1617
"CAT_URL_REWRITE_PRD_CTGR_PRD_ID_SEQUENCE_PRD_SEQUENCE_VAL": true
1718
}
1819
}
19-
}
20+
}

app/code/Magento/Integration/etc/db_schema.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
<constraint xsi:type="foreign" referenceId="OAUTH_NONCE_CONSUMER_ID_OAUTH_CONSUMER_ENTITY_ID" table="oauth_nonce"
8585
column="consumer_id" referenceTable="oauth_consumer" referenceColumn="entity_id"
8686
onDelete="CASCADE"/>
87-
<constraint xsi:type="unique" referenceId="OAUTH_NONCE_NONCE_CONSUMER_ID">
87+
<constraint xsi:type="primary" referenceId="OAUTH_NONCE_NONCE_CONSUMER_ID">
8888
<column name="nonce"/>
8989
<column name="consumer_id"/>
9090
</constraint>

app/code/Magento/Integration/etc/db_schema_whitelist.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"consumer_id": true
5555
},
5656
"constraint": {
57+
"PRIMARY": true,
5758
"OAUTH_NONCE_CONSUMER_ID_OAUTH_CONSUMER_ENTITY_ID": true,
5859
"OAUTH_NONCE_NONCE_CONSUMER_ID": true
5960
},
@@ -94,4 +95,4 @@
9495
"OAUTH_TOKEN_REQUEST_LOG_USER_NAME_USER_TYPE": true
9596
}
9697
}
97-
}
98+
}

app/code/Magento/LoginAsCustomerAssistance/etc/db_schema.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<constraint xsi:type="foreign" referenceId="LOGIN_AS_CUSTOMER_ASSISTANCE_ALLOWED_CUSTOMER_ID_CUSTOMER_ENTITY_ENTITY_ID"
1313
table="login_as_customer_assistance_allowed" column="customer_id" referenceTable="customer_entity"
1414
referenceColumn="entity_id" onDelete="CASCADE"/>
15-
<constraint xsi:type="unique" referenceId="LOGIN_AS_CUSTOMER_ASSISTANCE_ALLOWED_CUSTOMER_ID">
15+
<constraint xsi:type="primary" referenceId="LOGIN_AS_CUSTOMER_ASSISTANCE_ALLOWED_CUSTOMER_ID">
1616
<column name="customer_id"/>
1717
</constraint>
1818
</table>

0 commit comments

Comments
 (0)