-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6645 from magento-tsg-csl3/2.4-develop-pr53
[TSG-CSL3] For 2.4 (pr53)
- Loading branch information
Showing
7 changed files
with
157 additions
and
16 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
...og/Test/Mftf/ActionGroup/AssertAdminProductFormAdvancedPricingAddTierPriceActionGroup.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?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="AssertAdminProductFormAdvancedPricingAddTierPriceActionGroup" extends="AdminProductFormAdvancedPricingAddTierPriceActionGroup"> | ||
<annotations> | ||
<description>Check tier price on Advanced Pricing dialog on the Admin Product creation/edit page.</description> | ||
</annotations> | ||
<remove keyForRemoval="selectWebsite"/> | ||
<remove keyForRemoval="selectCustomerGroup"/> | ||
<remove keyForRemoval="fillQuantity"/> | ||
<remove keyForRemoval="selectPriceType"/> | ||
<remove keyForRemoval="fillPriceAmount"/> | ||
<remove keyForRemoval="waitCustomerGroupFilterAppears"/> | ||
<remove keyForRemoval="selectCustomerGroupValue"/> | ||
<executeJS function="return window.getComputedStyle(document.querySelector("{$priceAmountSelector}")).getPropertyValue('min-width')" after="waitPriceAmountFieldAppers" stepKey="priceMinWidth"/> | ||
<assertEquals after="priceMinWidth" stepKey="assertWebsiteAmounts"> | ||
<actualResult type="string">$priceMinWidth</actualResult> | ||
<expectedResult type="string">60px</expectedResult> | ||
</assertEquals> | ||
<click selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceDeleteButton}}" after="assertWebsiteAmounts" stepKey="clickCustomerGroupPriceDeleteButton"/> | ||
</actionGroup> | ||
</actionGroups> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
app/code/Magento/GraphQl/Test/Unit/Controller/HttpRequestValidator/HttpVerbValidatorTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\GraphQl\Test\Unit\Controller\HttpRequestValidator; | ||
|
||
use Magento\Framework\App\HttpRequestInterface; | ||
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; | ||
use Magento\GraphQl\Controller\HttpRequestValidator\HttpVerbValidator; | ||
use PHPUnit\Framework\MockObject\MockObject; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* Test HttpVerbValidator | ||
*/ | ||
class HttpVerbValidatorTest extends TestCase | ||
{ | ||
/** | ||
* @var HttpVerbValidator|MockObject | ||
*/ | ||
private $httpVerbValidator; | ||
|
||
/** | ||
* @var HttpRequestInterface|MockObject | ||
*/ | ||
private $requestMock; | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
protected function setup(): void | ||
{ | ||
$objectManager = new ObjectManager($this); | ||
$this->requestMock = $this->getMockBuilder(HttpRequestInterface::class) | ||
->disableOriginalConstructor() | ||
->onlyMethods( | ||
[ | ||
'isPost', | ||
] | ||
)->addMethods( | ||
[ | ||
'getParam', | ||
] | ||
) | ||
->getMockForAbstractClass(); | ||
|
||
$this->httpVerbValidator = $objectManager->getObject( | ||
HttpVerbValidator::class | ||
); | ||
} | ||
|
||
/** | ||
* Test for validate method | ||
* | ||
* @param string $query | ||
* @param bool $needException | ||
* @dataProvider validateDataProvider | ||
*/ | ||
public function testValidate(string $query, bool $needException): void | ||
{ | ||
$this->requestMock | ||
->expects($this->once()) | ||
->method('isPost') | ||
->willReturn(false); | ||
|
||
$this->requestMock | ||
->method('getParam') | ||
->with('query', '') | ||
->willReturn($query); | ||
|
||
if ($needException) { | ||
$this->expectExceptionMessage('Syntax Error: Unexpected <EOF>'); | ||
} | ||
|
||
$this->httpVerbValidator->validate($this->requestMock); | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function validateDataProvider(): array | ||
{ | ||
return [ | ||
[ | ||
'query' => '', | ||
'needException' => false, | ||
], | ||
[ | ||
'query' => ' ', | ||
'needException' => true | ||
], | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters