-
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 #8130 from magento-l3/PR_7_JAN_2023
L3 Bugfix delivery
- Loading branch information
Showing
26 changed files
with
776 additions
and
36 deletions.
There are no files selected for viewing
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
162 changes: 162 additions & 0 deletions
162
app/code/Magento/CatalogGraphQl/Test/Unit/Model/Config/FilterAttributeReaderTest.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,162 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\CatalogGraphQl\Test\Unit\Model\Config; | ||
|
||
use Magento\Catalog\Model\ResourceModel\Eav\Attribute; | ||
use Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection as AttributeCollection; | ||
use Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory as AttributeCollectionFactory; | ||
use Magento\CatalogGraphQl\Model\Config\FilterAttributeReader; | ||
use Magento\Framework\GraphQl\Schema\Type\Entity\MapperInterface; | ||
use PHPUnit\Framework\MockObject\MockObject; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class FilterAttributeReaderTest extends TestCase | ||
{ | ||
/** | ||
* @var MapperInterface|MockObject | ||
*/ | ||
private $mapperMock; | ||
|
||
/** | ||
* @var CollectionFactory|MockObject | ||
*/ | ||
private $collectionFactoryMock; | ||
|
||
/** | ||
* @var FilterAttributeReader | ||
*/ | ||
private $model; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->mapperMock = $this->createMock(MapperInterface::class); | ||
$this->collectionFactoryMock = $this->createMock(AttributeCollectionFactory::class); | ||
$this->model = new FilterAttributeReader($this->mapperMock, $this->collectionFactoryMock); | ||
} | ||
|
||
/** | ||
* @dataProvider readDataProvider | ||
* @param string $filterableAttrCode | ||
* @param string $filterableAttrInput | ||
* @param string $searchableAttrCode | ||
* @param string $searchableAttrInput | ||
* @param array $fieldsType | ||
*/ | ||
public function testRead( | ||
string $filterableAttrCode, | ||
string $filterableAttrInput, | ||
string $searchableAttrCode, | ||
string $searchableAttrInput, | ||
array $fieldsType | ||
): void { | ||
$this->mapperMock->expects(self::once()) | ||
->method('getMappedTypes') | ||
->with('filter_attributes') | ||
->willReturn(['product_filter_attributes' => 'ProductAttributeFilterInput']); | ||
|
||
$filterableAttributeCollection = $this->createMock(AttributeCollection::class); | ||
$filterableAttributeCollection->expects(self::once()) | ||
->method('addHasOptionsFilter') | ||
->willReturnSelf(); | ||
$filterableAttributeCollection->expects(self::once()) | ||
->method('addIsFilterableFilter') | ||
->willReturnSelf(); | ||
$filterableAttribute = $this->createMock(Attribute::class); | ||
$filterableAttributeCollection->expects(self::once()) | ||
->method('getItems') | ||
->willReturn(array_filter([11 => $filterableAttribute])); | ||
$searchableAttributeCollection = $this->createMock(AttributeCollection::class); | ||
$searchableAttributeCollection->expects(self::once()) | ||
->method('addHasOptionsFilter') | ||
->willReturnSelf(); | ||
$searchableAttributeCollection->expects(self::once()) | ||
->method('addIsSearchableFilter') | ||
->willReturnSelf(); | ||
$searchableAttributeCollection->expects(self::once()) | ||
->method('addDisplayInAdvancedSearchFilter') | ||
->willReturnSelf(); | ||
$searchableAttribute = $this->createMock(Attribute::class); | ||
$searchableAttributeCollection->expects(self::once()) | ||
->method('getItems') | ||
->willReturn(array_filter([21 => $searchableAttribute])); | ||
$this->collectionFactoryMock->expects(self::exactly(2)) | ||
->method('create') | ||
->willReturnOnConsecutiveCalls($filterableAttributeCollection, $searchableAttributeCollection); | ||
|
||
$filterableAttribute->method('getAttributeCode') | ||
->willReturn($filterableAttrCode); | ||
$filterableAttribute->method('getFrontendInput') | ||
->willReturn($filterableAttrInput); | ||
$searchableAttribute->method('getAttributeCode') | ||
->willReturn($searchableAttrCode); | ||
$searchableAttribute->method('getFrontendInput') | ||
->willReturn($searchableAttrInput); | ||
|
||
$config = $this->model->read(); | ||
self::assertNotEmpty($config['ProductAttributeFilterInput']); | ||
self::assertCount(count($fieldsType), $config['ProductAttributeFilterInput']['fields']); | ||
foreach ($fieldsType as $attrCode => $fieldType) { | ||
self::assertEquals($fieldType, $config['ProductAttributeFilterInput']['fields'][$attrCode]['type']); | ||
} | ||
} | ||
|
||
public function readDataProvider(): array | ||
{ | ||
return [ | ||
[ | ||
'price', | ||
'price', | ||
'sku', | ||
'text', | ||
[ | ||
'price' => 'FilterRangeTypeInput', | ||
'sku' => 'FilterEqualTypeInput', | ||
], | ||
], | ||
[ | ||
'date_attr', | ||
'date', | ||
'datetime_attr', | ||
'datetime', | ||
[ | ||
'date_attr' => 'FilterRangeTypeInput', | ||
'datetime_attr' => 'FilterRangeTypeInput', | ||
], | ||
], | ||
[ | ||
'select_attr', | ||
'select', | ||
'multiselect_attr', | ||
'multiselect', | ||
[ | ||
'select_attr' => 'FilterEqualTypeInput', | ||
'multiselect_attr' => 'FilterEqualTypeInput', | ||
], | ||
], | ||
[ | ||
'text_attr', | ||
'text', | ||
'textarea_attr', | ||
'textarea', | ||
[ | ||
'text_attr' => 'FilterMatchTypeInput', | ||
'textarea_attr' => 'FilterMatchTypeInput', | ||
], | ||
], | ||
[ | ||
'boolean_attr', | ||
'boolean', | ||
'boolean_attr', | ||
'boolean', | ||
[ | ||
'boolean_attr' => 'FilterEqualTypeInput', | ||
], | ||
], | ||
]; | ||
} | ||
} |
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
28 changes: 28 additions & 0 deletions
28
...est/Mftf/ActionGroup/AdminOpenPayPalAdvancedFrontendExperienceFeaturesPageActionGroup.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,28 @@ | ||
<?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="AdminOpenPayPalAdvancedFrontendExperienceFeaturesPageActionGroup"> | ||
<annotations> | ||
<description>Clicks on 'Configure' for 'PayPal Express Checkout' on the Admin Configuration page. | ||
Expands the 'Advanced Settings' tab. | ||
Expands the 'Frontend Experience Settings' tab. | ||
Expands the 'Features' tab.</description> | ||
</annotations> | ||
<arguments> | ||
<argument name="countryCode" type="string" defaultValue="us"/> | ||
</arguments> | ||
|
||
<click selector="{{PayPalExpressCheckoutConfigSection.configureBtn(countryCode)}}" stepKey="clickPayPalConfigureBtn"/> | ||
<click selector="{{PayPalAdvancedSettingConfigSection.advancedSettingTab(countryCode)}}" stepKey="openAdvancedSettingTab"/> | ||
<click selector="{{PayPalAdvancedSettingConfigSection.frontendExperienceSettingsTab(countryCode)}}" stepKey="openFrontendExperienceSettingsTab"/> | ||
<click selector="{{PayPalAdvancedSettingConfigSection.featuresTab(countryCode)}}" stepKey="openFeaturesTab"/> | ||
<seeElement selector="{{PayPalAdvancedFrontendExperienceFeaturesSection.disableFundingOptionsMultiselect(countryCode)}}" stepKey="seeDisableFundingOptionsMultiselect"/> | ||
</actionGroup> | ||
</actionGroups> |
22 changes: 22 additions & 0 deletions
22
app/code/Magento/Paypal/Test/Mftf/ActionGroup/AdminSelectDisableFundingActionGroup.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,22 @@ | ||
<?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="AdminSelectDisableFundingActionGroup"> | ||
<annotations> | ||
<description>Clicks on specified option in 'Disable Funding Options' list.</description> | ||
</annotations> | ||
<arguments> | ||
<argument name="countryCode" type="string" defaultValue="us"/> | ||
<argument name="option" type="string" defaultValue="Venmo"/> | ||
</arguments> | ||
|
||
<selectOption selector="{{PayPalAdvancedFrontendExperienceFeaturesSection.disableFundingOptionsMultiselect(countryCode)}}" userInput="{{option}}" stepKey="selectOption"/> | ||
</actionGroup> | ||
</actionGroups> |
22 changes: 22 additions & 0 deletions
22
app/code/Magento/Paypal/Test/Mftf/ActionGroup/AdminUnselectDisableFundingActionGroup.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,22 @@ | ||
<?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="AdminUnselectDisableFundingActionGroup"> | ||
<annotations> | ||
<description>Unselects specified option in 'Disable Funding Options' list.</description> | ||
</annotations> | ||
<arguments> | ||
<argument name="countryCode" type="string" defaultValue="us"/> | ||
<argument name="option" type="string" defaultValue="Venmo"/> | ||
</arguments> | ||
|
||
<unselectOption selector="{{PayPalAdvancedFrontendExperienceFeaturesSection.disableFundingOptionsMultiselect(countryCode)}}" userInput="{{option}}" stepKey="unselectOption"/> | ||
</actionGroup> | ||
</actionGroups> |
13 changes: 13 additions & 0 deletions
13
...on/PayPalExpressCheckoutConfigSection/PayPalAdvancedFrontendExperienceFeaturesSection.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,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> | ||
<section name="PayPalAdvancedFrontendExperienceFeaturesSection"> | ||
<element name="disableFundingOptionsMultiselect" type="multiselect" selector="#payment_{{countryCode}}_paypal_alternative_payment_methods_express_checkout_{{countryCode}}_settings_ec_settings_ec_advanced_express_checkout_frontend_features_disable_funding_options" parameterized="true"/> | ||
</section> | ||
</sections> |
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
13 changes: 13 additions & 0 deletions
13
...tf/Section/PayPalExpressCheckoutConfigSection/StorefrontPayPalSmartButtonVenmoSection.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,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> | ||
<section name="StorefrontPayPalSmartButtonVenmoSection"> | ||
<element name="venmoButton" type="button" selector="//div[@data-funding-source='venmo']"/> | ||
</section> | ||
</sections> |
Oops, something went wrong.