Skip to content

Commit 1a8503c

Browse files
authored
Merge branch '2.4-develop' into #39982
2 parents 51f38cf + 297b774 commit 1a8503c

File tree

642 files changed

+30723
-14432
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

642 files changed

+30723
-14432
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
<?php
2+
/**
3+
* Copyright 2025 Adobe
4+
* All Rights Reserved.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Authorization\Test\Unit\Helper;
9+
10+
use Magento\Authorization\Model\Role;
11+
12+
/**
13+
* Test helper for Magento\Authorization\Model\Role
14+
*
15+
* This helper provides only the custom GWS-related methods that are not available
16+
* in the parent Role class. Standard methods like getData(), setData(), and load()
17+
* are inherited from Magento\Framework\Model\AbstractModel.
18+
*/
19+
class RoleTestHelper extends Role
20+
{
21+
/**
22+
* @var array
23+
*/
24+
private $gwsWebsites = [];
25+
26+
/**
27+
* @var array
28+
*/
29+
private $gwsStoreGroups = [];
30+
31+
/**
32+
* @var bool
33+
*/
34+
private $gwsDataIsset = false;
35+
36+
/**
37+
* Skip parent constructor to avoid dependency injection requirements in tests
38+
*/
39+
public function __construct()
40+
{
41+
// Intentionally empty - avoids parent constructor dependencies
42+
}
43+
44+
/**
45+
* Get GWS websites
46+
*
47+
* @return array
48+
*/
49+
public function getGwsWebsites()
50+
{
51+
return $this->gwsWebsites;
52+
}
53+
54+
/**
55+
* Set GWS websites
56+
*
57+
* @param array $websites
58+
* @return $this
59+
*/
60+
public function setGwsWebsites($websites)
61+
{
62+
$this->gwsWebsites = $websites;
63+
return $this;
64+
}
65+
66+
/**
67+
* Get GWS store groups
68+
*
69+
* @return array
70+
*/
71+
public function getGwsStoreGroups()
72+
{
73+
return $this->gwsStoreGroups;
74+
}
75+
76+
/**
77+
* Set GWS store groups
78+
*
79+
* @param array $storeGroups
80+
* @return $this
81+
*/
82+
public function setGwsStoreGroups($storeGroups)
83+
{
84+
$this->gwsStoreGroups = $storeGroups;
85+
return $this;
86+
}
87+
88+
/**
89+
* Set GWS data isset flag
90+
*
91+
* @param bool $value
92+
* @return $this
93+
*/
94+
public function setGwsDataIsset($value)
95+
{
96+
$this->gwsDataIsset = $value;
97+
return $this;
98+
}
99+
100+
/**
101+
* Load role (overridden to avoid database access in tests)
102+
*
103+
* @param mixed $modelId
104+
* @param string|null $field
105+
* @return $this
106+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
107+
*/
108+
public function load($modelId, $field = null)
109+
{
110+
return $this;
111+
}
112+
}

app/code/Magento/Backend/Test/Mftf/Test/AdminVerifyStateProvinceRequiredOnAddingNewAddressPageTest.xml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
<actionGroup ref="SetAdminAccountActionGroup" stepKey="setAdminAccountToUnitedStates">
3333
<argument name="InterfaceLocaleByValue" value="en_US" />
3434
</actionGroup>
35+
<!--Delete customer created during test execution-->
36+
<actionGroup ref="AdminDeleteAllCustomerActionGroup" stepKey="deleteAllCustomerFromGrid"/>
3537
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
3638
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
3739
<argument name="indices" value=""/>
@@ -40,35 +42,29 @@
4042
<argument name="tags" value=""/>
4143
</actionGroup>
4244
</after>
43-
4445
<!-- Open Admin Store Configuration Page -->
4546
<actionGroup ref="AdminOpenStoreConfigPageActionGroup" stepKey="openStoreConfigPage" />
46-
4747
<!--"Choose United Kingdom" as State Option Required and save configuration -->
4848
<conditionalClick selector="{{StateOptionsSection.stateOptions}}" dependentSelector="{{StateOptionsSection.countriesWithRequiredRegions}}" visible="false" stepKey="expandStateOptionsTab"/>
4949
<waitForAjaxLoad stepKey="waitForAjax"/>
5050
<scrollTo selector="{{StateOptionsSection.countriesWithRequiredRegions}}" stepKey="scrollToForm"/>
5151
<selectOption selector="{{StateOptionsSection.countriesWithRequiredRegions}}" userInput="United Kingdom" stepKey="selectCountriesWithRequiredRegion"/>
5252
<click selector="#save" stepKey="saveStateOptionsConfig"/>
5353
<waitForPageLoad stepKey="waitForSavingConfig"/>
54-
5554
<!-- create customer on storefront -->
5655
<actionGroup ref="StorefrontOpenCustomerAccountCreatePageActionGroup" stepKey="openCreateAccountPage"/>
5756
<actionGroup ref="ReloadPageActionGroup" stepKey="refreshPage"/>
5857
<actionGroup ref="StorefrontFillCustomerAccountCreationFormActionGroup" stepKey="fillCreateAccountForm">
5958
<argument name="customer" value="Simple_US_Customer"/>
6059
</actionGroup>
6160
<actionGroup ref="StorefrontClickCreateAnAccountCustomerAccountCreationFormActionGroup" stepKey="submitCreateAccountForm"/>
62-
6361
<!-- Open AddressBook and set Country as "United Kingdom" -->
6462
<actionGroup ref="StorefrontCustomerGoToSidebarMenu" stepKey="goToAddressBookPage">
6563
<argument name="menu" value="Address Book"/>
6664
</actionGroup>
67-
6865
<!-- Choose Country as "United Kingdom" -->
6966
<selectOption selector="{{StorefrontCustomerAddressFormSection.country}}" userInput="United Kingdom" stepKey="selectCountry"/>
7067
<click selector="{{StorefrontCustomerAddressFormSection.saveAddress}}" stepKey="saveCustomerAddress"/>
71-
7268
<!-- Assert the error message -->
7369
<seeElement selector="{{StorefrontCustomerMessagesSection.assertErrorMessage}}" stepKey="assetErrorMessage"/>
7470
</test>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
/**
3+
* Copyright 2025 Adobe
4+
* All Rights Reserved.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Backend\Test\Unit\Helper;
9+
10+
use Magento\Backend\Test\Unit\App\Action\Stub\ActionStub;
11+
12+
/**
13+
* Test helper for ActionStub with additional test-specific methods
14+
*
15+
* This helper extends ActionStub to provide the setDirtyRulesNoticeMessage()
16+
* method which is used in production by CatalogRule controllers but doesn't
17+
* exist in the base ActionStub class. Since PHPUnit 12 removed addMethods(),
18+
* this helper is necessary to test code that calls this method.
19+
*
20+
* @SuppressWarnings(PHPMD.AllPurposeAction)
21+
*/
22+
class ActionStubTestHelper extends ActionStub
23+
{
24+
public function __construct()
25+
{
26+
// Skip parent constructor for testing
27+
}
28+
29+
/**
30+
* Stub method for testing CatalogRule controllers
31+
*
32+
* This method is called by AdminGws\Model\Controllers::promoCatalogIndexAction()
33+
* but doesn't exist in the base ActionStub class.
34+
*
35+
* @param string $message
36+
* @return $this
37+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
38+
*/
39+
public function setDirtyRulesNoticeMessage($message)
40+
{
41+
return $this;
42+
}
43+
}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<?php
2+
/**
3+
* Copyright 2025 Adobe
4+
* All Rights Reserved.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Backend\Test\Unit\Helper;
9+
10+
use Magento\Backend\Block\Widget\Button;
11+
12+
/**
13+
* Test helper for Button class with custom methods
14+
*/
15+
class ButtonTestHelper extends Button
16+
{
17+
/**
18+
* @var array
19+
*/
20+
private $data = [];
21+
22+
/**
23+
* Skip parent constructor to avoid dependencies
24+
*/
25+
public function __construct()
26+
{
27+
// Skip parent constructor - clean initialization
28+
$this->data = [];
29+
}
30+
31+
/**
32+
* Custom isAllowed method for testing
33+
*
34+
* @param string|null $resource
35+
* @return bool
36+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
37+
*/
38+
public function isAllowed($resource = null): bool
39+
{
40+
return $this->data['is_allowed'] ?? true;
41+
}
42+
43+
/**
44+
* Set is allowed for testing
45+
*
46+
* @param bool $isAllowed
47+
* @return self
48+
*/
49+
public function setIsAllowed(bool $isAllowed): self
50+
{
51+
$this->data['is_allowed'] = $isAllowed;
52+
return $this;
53+
}
54+
55+
/**
56+
* Override getAuthorization method
57+
*
58+
* @return mixed
59+
*/
60+
public function getAuthorization()
61+
{
62+
return $this->data['authorization'] ?? null;
63+
}
64+
65+
/**
66+
* Set authorization for testing
67+
*
68+
* @param mixed $authorization
69+
* @return self
70+
*/
71+
public function setAuthorization($authorization): self
72+
{
73+
$this->data['authorization'] = $authorization;
74+
return $this;
75+
}
76+
77+
/**
78+
* Override toHtml method
79+
*
80+
* @return string
81+
*/
82+
public function toHtml(): string
83+
{
84+
return $this->data['html'] ?? '';
85+
}
86+
87+
/**
88+
* Set HTML output for testing
89+
*
90+
* @param string $html
91+
* @return self
92+
*/
93+
public function setHtml(string $html): self
94+
{
95+
$this->data['html'] = $html;
96+
return $this;
97+
}
98+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
/**
3+
* Copyright 2016 Adobe
4+
* All Rights Reserved.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Backend\Test\Unit\Helper;
9+
10+
use Magento\Backend\Model\Session\Quote;
11+
12+
/**
13+
* Test helper for Session\Quote
14+
*
15+
* This helper extends the concrete Session\Quote class to provide
16+
* test-specific functionality without dependency injection issues.
17+
*/
18+
class SessionQuoteTestHelper extends Quote
19+
{
20+
/**
21+
* Constructor that skips parent initialization
22+
*/
23+
public function __construct()
24+
{
25+
// Skip parent constructor to avoid dependency injection issues
26+
}
27+
28+
/**
29+
* Get store ID
30+
*
31+
* @return int
32+
*/
33+
public function getStoreId()
34+
{
35+
return 1;
36+
}
37+
}

0 commit comments

Comments
 (0)