Skip to content

Commit 8a90819

Browse files
Merge branch '2.4-develop' into 19345
2 parents c2b038e + 45f27d6 commit 8a90819

File tree

12 files changed

+692
-1880
lines changed

12 files changed

+692
-1880
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertAdminProductFormAdvancedPricingAddTierPriceActionGroup" extends="AdminProductFormAdvancedPricingAddTierPriceActionGroup">
12+
<annotations>
13+
<description>Check tier price on Advanced Pricing dialog on the Admin Product creation/edit page.</description>
14+
</annotations>
15+
<remove keyForRemoval="selectWebsite"/>
16+
<remove keyForRemoval="selectCustomerGroup"/>
17+
<remove keyForRemoval="fillQuantity"/>
18+
<remove keyForRemoval="selectPriceType"/>
19+
<remove keyForRemoval="fillPriceAmount"/>
20+
<remove keyForRemoval="waitCustomerGroupFilterAppears"/>
21+
<remove keyForRemoval="selectCustomerGroupValue"/>
22+
<executeJS function="return window.getComputedStyle(document.querySelector(&quot;{$priceAmountSelector}&quot;)).getPropertyValue('min-width')" after="waitPriceAmountFieldAppers" stepKey="priceMinWidth"/>
23+
<assertEquals after="priceMinWidth" stepKey="assertWebsiteAmounts">
24+
<actualResult type="string">$priceMinWidth</actualResult>
25+
<expectedResult type="string">60px</expectedResult>
26+
</assertEquals>
27+
<click selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceDeleteButton}}" after="assertWebsiteAmounts" stepKey="clickCustomerGroupPriceDeleteButton"/>
28+
</actionGroup>
29+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest/AdminApplyTierPriceToProductWithPercentageDiscountTest.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetGridToDefaultKeywordSearch"/>
3333
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
3434
</after>
35-
35+
3636
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="loginAsAdmin"/>
3737
<actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForSimpleProduct">
3838
<argument name="product" value="$$createSimpleProduct$$"/>
@@ -41,6 +41,10 @@
4141
<argument name="product" value="$$createSimpleProduct$$"/>
4242
</actionGroup>
4343

44+
<actionGroup ref="AdminProductFormOpenAdvancedPricingDialogActionGroup" stepKey="clickOnAdvancedPricingButtonForAssert"/>
45+
<actionGroup ref="AssertAdminProductFormAdvancedPricingAddTierPriceActionGroup" stepKey="assertProductTierPriceInput"/>
46+
<actionGroup ref="AdminProductFormDoneAdvancedPricingDialogActionGroup" stepKey="doneButtonAfterAssert"/>
47+
4448
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="scrollToTopOfPage"/>
4549
<actionGroup ref="AdminProductFormOpenAdvancedPricingDialogActionGroup" stepKey="clickOnAdvancedPricingButton"/>
4650
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForCustomerGroupPriceAddButton"/>

app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerFiltersSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
<element name="viewDropdown" type="button" selector=".admin__data-grid-action-bookmarks button.admin__action-dropdown"/>
2020
<element name="viewBookmark" type="button" selector="//div[contains(@class, 'admin__data-grid-action-bookmarks')]/ul/li/div/a[text() = '{{label}}']" parameterized="true" timeout="30"/>
2121
<element name="countryOptions" type="button" selector=".admin__data-grid-filters select[name=billing_country_id] option"/>
22+
<element name="websiteOptions" type="button" selector=".admin__data-grid-filters select[name=website_id] option"/>
2223
</section>
2324
</sections>

app/code/Magento/Customer/view/adminhtml/ui_component/customer_listing.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@
189189
</column>
190190
<column name="website_id" class="Magento\Customer\Ui\Component\Listing\Column\Websites" component="Magento_Ui/js/grid/columns/select" sortOrder="110">
191191
<settings>
192+
<options class="Magento\Store\Model\ResourceModel\Website\Collection"/>
192193
<filter>select</filter>
193194
<editor>
194195
<editorType>select</editorType>

app/code/Magento/GraphQl/Controller/HttpRequestValidator/HttpVerbValidator.php

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,25 @@ public function validate(HttpRequestInterface $request) : void
3131
/** @var Http $request */
3232
if (false === $request->isPost()) {
3333
$query = $request->getParam('query', '');
34-
$operationType = null;
35-
$queryAst = \GraphQL\Language\Parser::parse(new \GraphQL\Language\Source($query ?: '', 'GraphQL'));
36-
\GraphQL\Language\Visitor::visit(
37-
$queryAst,
38-
[
39-
'leave' => [
40-
NodeKind::OPERATION_DEFINITION => function (Node $node) use (&$operationType) {
41-
$operationType = $node->operation;
42-
}
34+
if (!empty($query)) {
35+
$operationType = null;
36+
$queryAst = \GraphQL\Language\Parser::parse(new \GraphQL\Language\Source($query ?: '', 'GraphQL'));
37+
\GraphQL\Language\Visitor::visit(
38+
$queryAst,
39+
[
40+
'leave' => [
41+
NodeKind::OPERATION_DEFINITION => function (Node $node) use (&$operationType) {
42+
$operationType = $node->operation;
43+
}
44+
]
4345
]
44-
]
45-
);
46-
47-
if (strtolower($operationType) === 'mutation') {
48-
throw new GraphQlInputException(
49-
new \Magento\Framework\Phrase('Mutation requests allowed only for POST requests')
5046
);
47+
48+
if (strtolower($operationType) === 'mutation') {
49+
throw new GraphQlInputException(
50+
new \Magento\Framework\Phrase('Mutation requests allowed only for POST requests')
51+
);
52+
}
5153
}
5254
}
5355
}
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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\GraphQl\Test\Unit\Controller\HttpRequestValidator;
9+
10+
use Magento\Framework\App\HttpRequestInterface;
11+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
12+
use Magento\GraphQl\Controller\HttpRequestValidator\HttpVerbValidator;
13+
use PHPUnit\Framework\MockObject\MockObject;
14+
use PHPUnit\Framework\TestCase;
15+
16+
/**
17+
* Test HttpVerbValidator
18+
*/
19+
class HttpVerbValidatorTest extends TestCase
20+
{
21+
/**
22+
* @var HttpVerbValidator|MockObject
23+
*/
24+
private $httpVerbValidator;
25+
26+
/**
27+
* @var HttpRequestInterface|MockObject
28+
*/
29+
private $requestMock;
30+
31+
/**
32+
* @inheritDoc
33+
*/
34+
protected function setup(): void
35+
{
36+
$objectManager = new ObjectManager($this);
37+
$this->requestMock = $this->getMockBuilder(HttpRequestInterface::class)
38+
->disableOriginalConstructor()
39+
->onlyMethods(
40+
[
41+
'isPost',
42+
]
43+
)->addMethods(
44+
[
45+
'getParam',
46+
]
47+
)
48+
->getMockForAbstractClass();
49+
50+
$this->httpVerbValidator = $objectManager->getObject(
51+
HttpVerbValidator::class
52+
);
53+
}
54+
55+
/**
56+
* Test for validate method
57+
*
58+
* @param string $query
59+
* @param bool $needException
60+
* @dataProvider validateDataProvider
61+
*/
62+
public function testValidate(string $query, bool $needException): void
63+
{
64+
$this->requestMock
65+
->expects($this->once())
66+
->method('isPost')
67+
->willReturn(false);
68+
69+
$this->requestMock
70+
->method('getParam')
71+
->with('query', '')
72+
->willReturn($query);
73+
74+
if ($needException) {
75+
$this->expectExceptionMessage('Syntax Error: Unexpected <EOF>');
76+
}
77+
78+
$this->httpVerbValidator->validate($this->requestMock);
79+
}
80+
81+
/**
82+
* @return array
83+
*/
84+
public function validateDataProvider(): array
85+
{
86+
return [
87+
[
88+
'query' => '',
89+
'needException' => false,
90+
],
91+
[
92+
'query' => ' ',
93+
'needException' => true
94+
],
95+
];
96+
}
97+
}

app/design/adminhtml/Magento/backend/Magento_Catalog/web/css/source/_module.less

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@
9999
.admin__field + .admin__field {
100100
margin-left: @indent__s;
101101
margin-top: 0;
102+
.admin__field-control {
103+
.admin__control-addon {
104+
.admin__control-text {
105+
min-width: 6rem;
106+
}
107+
}
108+
}
102109
}
103110
}
104111
}

0 commit comments

Comments
 (0)