Skip to content

Commit 46d85c7

Browse files
author
Oleksandr Iegorov
authored
merge magento/2.4-develop into magento-tango/MC-22998
2 parents c782080 + 57a2aad commit 46d85c7

File tree

40 files changed

+1312
-74
lines changed

40 files changed

+1312
-74
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Captcha\Test\Unit\Model\Config;
10+
11+
use PHPUnit\Framework\TestCase;
12+
use Magento\Captcha\Helper\Data as HelperData;
13+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
14+
use Magento\Captcha\Model\Config\Font;
15+
16+
class FontTest extends TestCase
17+
{
18+
/**
19+
* @var ObjectManagerHelper
20+
*/
21+
private $objectManagerHelper;
22+
23+
/**
24+
* @var Font
25+
*/
26+
private $model;
27+
28+
/**
29+
* @var HelperData|\PHPUnit_Framework_MockObject_MockObject
30+
*/
31+
private $helperDataMock;
32+
33+
/**
34+
* Setup Environment For Testing
35+
*/
36+
protected function setUp()
37+
{
38+
$this->helperDataMock = $this->createMock(HelperData::class);
39+
40+
$this->objectManagerHelper = new ObjectManagerHelper($this);
41+
42+
$this->model = $this->objectManagerHelper->getObject(
43+
Font::class,
44+
[
45+
'captchaData' => $this->helperDataMock
46+
]
47+
);
48+
}
49+
50+
/**
51+
* Test toOptionArray() with data provider below
52+
*
53+
* @param array $fonts
54+
* @param array $expectedResult
55+
* @dataProvider toOptionArrayDataProvider
56+
*/
57+
public function testToOptionArray($fonts, $expectedResult)
58+
{
59+
$this->helperDataMock->expects($this->any())->method('getFonts')
60+
->willReturn($fonts);
61+
62+
$this->assertEquals($expectedResult, $this->model->toOptionArray());
63+
}
64+
65+
/**
66+
* Data Provider for testing toOptionArray()
67+
*
68+
* @return array
69+
*/
70+
public function toOptionArrayDataProvider()
71+
{
72+
return [
73+
'Empty get font' => [
74+
[],
75+
[]
76+
],
77+
'Get font result' => [
78+
[
79+
'arial' => [
80+
'label' => 'Arial',
81+
'path' => '/www/magento/fonts/arial.ttf'
82+
],
83+
'verdana' => [
84+
'label' => 'Verdana',
85+
'path' => '/www/magento/fonts/verdana.ttf'
86+
]
87+
],
88+
[
89+
[
90+
'label' => 'Arial',
91+
'value' => 'arial'
92+
],
93+
[
94+
'label' => 'Verdana',
95+
'value' => 'verdana'
96+
]
97+
]
98+
]
99+
];
100+
}
101+
}
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Captcha\Test\Unit\Model\Config\Form;
10+
11+
use Magento\Captcha\Model\Config\Form\Backend;
12+
use PHPUnit\Framework\TestCase;
13+
use Magento\Framework\App\Config\ScopeConfigInterface;
14+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
15+
16+
class BackendTest extends TestCase
17+
{
18+
/**
19+
* @var ObjectManagerHelper
20+
*/
21+
private $objectManagerHelper;
22+
23+
/**
24+
* @var Backend
25+
*/
26+
private $model;
27+
28+
/**
29+
* @var ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject
30+
*/
31+
private $configMock;
32+
33+
/**
34+
* Setup Environment For Testing
35+
*/
36+
protected function setUp()
37+
{
38+
$this->configMock = $this->createMock(ScopeConfigInterface::class);
39+
40+
$this->objectManagerHelper = new ObjectManagerHelper($this);
41+
42+
$this->model = $this->objectManagerHelper->getObject(
43+
Backend::class,
44+
[
45+
'config' => $this->configMock
46+
]
47+
);
48+
}
49+
50+
/**
51+
* Test toOptionArray() with data provider below
52+
*
53+
* @param string|array $config
54+
* @param array $expectedResult
55+
* @dataProvider toOptionArrayDataProvider
56+
*/
57+
public function testToOptionArray($config, $expectedResult)
58+
{
59+
$this->configMock->expects($this->any())->method('getValue')
60+
->with('captcha/backend/areas', 'default')
61+
->willReturn($config);
62+
63+
$this->assertEquals($expectedResult, $this->model->toOptionArray());
64+
}
65+
66+
/**
67+
* Data Provider for testing toOptionArray()
68+
*
69+
* @return array
70+
*/
71+
public function toOptionArrayDataProvider()
72+
{
73+
return [
74+
'Empty captcha backend areas' => [
75+
'',
76+
[]
77+
],
78+
'With two captcha backend area' => [
79+
[
80+
'backend_login' => [
81+
'label' => 'Admin Login'
82+
],
83+
'backend_forgotpassword' => [
84+
'label' => 'Admin Forgot Password'
85+
]
86+
],
87+
[
88+
[
89+
'label' => 'Admin Login',
90+
'value' => 'backend_login'
91+
],
92+
[
93+
'label' => 'Admin Forgot Password',
94+
'value' => 'backend_forgotpassword'
95+
]
96+
]
97+
]
98+
];
99+
}
100+
}
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Captcha\Test\Unit\Model\Config\Form;
10+
11+
use Magento\Captcha\Model\Config\Form\Frontend;
12+
use PHPUnit\Framework\TestCase;
13+
use Magento\Framework\App\Config\ScopeConfigInterface;
14+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
15+
16+
class FrontendTest extends TestCase
17+
{
18+
/**
19+
* @var ObjectManagerHelper
20+
*/
21+
private $objectManagerHelper;
22+
23+
/**
24+
* @var Frontend
25+
*/
26+
private $model;
27+
28+
/**
29+
* @var ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject
30+
*/
31+
private $configMock;
32+
33+
/**
34+
* Setup Environment For Testing
35+
*/
36+
protected function setUp()
37+
{
38+
$this->configMock = $this->createMock(ScopeConfigInterface::class);
39+
40+
$this->objectManagerHelper = new ObjectManagerHelper($this);
41+
42+
$this->model = $this->objectManagerHelper->getObject(
43+
Frontend::class,
44+
[
45+
'config' => $this->configMock
46+
]
47+
);
48+
}
49+
50+
/**
51+
* Test toOptionArray() with data provider below
52+
*
53+
* @param string|array $config
54+
* @param array $expectedResult
55+
* @dataProvider toOptionArrayDataProvider
56+
*/
57+
public function testToOptionArray($config, $expectedResult)
58+
{
59+
$this->configMock->expects($this->any())->method('getValue')
60+
->with('captcha/frontend/areas', 'default')
61+
->willReturn($config);
62+
63+
$this->assertEquals($expectedResult, $this->model->toOptionArray());
64+
}
65+
66+
/**
67+
* Data Provider for testing toOptionArray()
68+
*
69+
* @return array
70+
*/
71+
public function toOptionArrayDataProvider()
72+
{
73+
return [
74+
'Empty captcha frontend areas' => [
75+
'',
76+
[]
77+
],
78+
'With two captcha frontend area' => [
79+
[
80+
'product_sendtofriend_form' => [
81+
'label' => 'Send To Friend Form'
82+
],
83+
'sales_rule_coupon_request' => [
84+
'label' => 'Applying coupon code'
85+
]
86+
],
87+
[
88+
[
89+
'label' => 'Send To Friend Form',
90+
'value' => 'product_sendtofriend_form'
91+
],
92+
[
93+
'label' => 'Applying coupon code',
94+
'value' => 'sales_rule_coupon_request'
95+
]
96+
]
97+
]
98+
];
99+
}
100+
}

app/code/Magento/CatalogUrlRewriteGraphQl/etc/di.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,12 @@
2222
</argument>
2323
</arguments>
2424
</type>
25+
26+
<type name="Magento\UrlRewriteGraphQl\Model\Resolver\UrlRewrite">
27+
<arguments>
28+
<argument name="entityTypeMapping" xsi:type="array">
29+
<item name="catalog_product" xsi:type="const">Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator::ENTITY_TYPE</item>
30+
</argument>
31+
</arguments>
32+
</type>
2533
</config>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
12+
<!--Fill Required Fields -->
13+
<actionGroup name="AdminCreatesNewIntegrationActionGroup">
14+
<arguments>
15+
<argument name="name" type="string"/>
16+
<argument name="password" type="string"/>
17+
</arguments>
18+
<fillField stepKey="fillNameField" selector="{{AdminNewIntegrationSection.name}}" userInput="{{name}}"/>
19+
<fillField stepKey="fillAdminPasswordField" selector="{{AdminNewIntegrationSection.password}}" userInput="{{password}}"/>
20+
</actionGroup>
21+
</actionGroups>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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="AdminDeleteIntegrationEntityActionGroup">
12+
<click stepKey="clickRemoveButon" selector="{{AdminIntegrationsGridSection.remove}}"/>
13+
<waitForElementVisible selector="{{AdminIntegrationsGridSection.submitButton}}" stepKey="waitForConfirmButtonVisible"/>
14+
<click stepKey="clickSubmitButton" selector="{{AdminIntegrationsGridSection.submitButton}}"/>
15+
<waitForPageLoad stepKey="waitForPageLoad"/>
16+
</actionGroup>
17+
</actionGroups>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
12+
<!--Click the "Add New Integration" Button -->
13+
14+
<actionGroup name="AdminNavigateToCreateIntegrationPageActionGroup">
15+
<click stepKey="clickAddNewIntegrationButton" selector="{{AdminIntegrationsGridSection.add}}"/>
16+
<waitForPageLoad stepKey="waitForNewNIntegrationPageLoaded"/>
17+
</actionGroup>
18+
</actionGroups>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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="AdminSearchIntegrationInGridActionGroup">
12+
<arguments>
13+
<argument name="name" type="string"/>
14+
</arguments>
15+
<!--Reset Search Filters -->
16+
<conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/>
17+
<!--Fill Integration Name Field -->
18+
<fillField selector="{{AdminIntegrationsGridSection.name}}" userInput="{{name}}" stepKey="filterByName"/>
19+
<!--Click "Search" Button -->
20+
<click selector="{{AdminIntegrationsGridSection.search}}" stepKey="doFilter"/>
21+
<waitForPageLoad stepKey="waitForSitemapPageLoadedAfterFiltering"/>
22+
</actionGroup>
23+
</actionGroups>

0 commit comments

Comments
 (0)