Skip to content

Commit 9cf7c69

Browse files
committed
Merge branch 'MC-34459' into 2.4-develop-com-int-improve-pr2
2 parents 4a68021 + c11cf3f commit 9cf7c69

File tree

27 files changed

+193
-5
lines changed

27 files changed

+193
-5
lines changed

dev/tests/integration/_files/Magento/TestModuleOverrideConfig/etc/adminhtml/system.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
<field id="field_1" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"/>
1313
<field id="field_2" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"/>
1414
<field id="field_3" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"/>
15+
<field id="field_4" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"/>
16+
<field id="field_5" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"/>
1517
</group>
1618
</section>
1719
</system>

dev/tests/integration/_files/Magento/TestModuleOverrideConfig/etc/config.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
<field_1>1st field default value</field_1>
1313
<field_2>2nd field default value</field_2>
1414
<field_3>3rd field default value</field_3>
15+
<field_4>4th field default value</field_4>
16+
<field_5>5th field default value</field_5>
1517
</test_group>
1618
</test_section>
1719
</default>

dev/tests/integration/_files/Magento/TestModuleOverrideConfig2/Test/Integration/_files/overrides.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,9 @@
204204
<dataSet name="first_data_set" skip="true"/>
205205
</method>
206206
</test>
207+
<global>
208+
<magentoDataFixture path="Magento/TestModuleOverrideConfig/_files/global_fixture_first_module.php" />
209+
<magentoConfigFixture scopeType="store" scopeCode="current" path="test_section/test_group/field_4" value="4th field globally overridden value"/>
210+
<magentoConfigFixture scopeType="store" scopeCode="current" path="test_section/test_group/field_5" newValue="5th field globally replaced value"/>
211+
</global>
207212
</overrides>

dev/tests/integration/framework/Magento/TestFramework/Workaround/Override/Config.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,22 @@ public static function getInstance(): ConfigInterface
7474
return self::$instance;
7575
}
7676

77+
/**
78+
* Get config from global node
79+
*
80+
* @param string|null $fixtureType
81+
* @return array
82+
*/
83+
public function getGlobalConfig(?string $fixtureType = null): array
84+
{
85+
$result = $this->config['global'] ?? [];
86+
if ($fixtureType) {
87+
$result = $result[$fixtureType] ?? [];
88+
}
89+
90+
return $result;
91+
}
92+
7793
/**
7894
* Self instance setter.
7995
*

dev/tests/integration/framework/Magento/TestFramework/Workaround/Override/Config/Converter.php

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(array $types = [])
4040
public function convert($source)
4141
{
4242
$this->xpath = new \DOMXPath($source);
43-
$config = [];
43+
$config = $this->getGlobalConfig($this->xpath);
4444
foreach ($this->xpath->query('//test') as $testOverride) {
4545
$className = ltrim($testOverride->getAttribute('class'), '\\');
4646
$config[$className] = $this->getTestConfigByFixtureType($testOverride);
@@ -189,4 +189,36 @@ protected function fillAdminConfigFixtureAttributes(\DOMElement $fixture): array
189189
'remove' => $fixture->getAttribute('remove'),
190190
];
191191
}
192+
/**
193+
* Get global configurations
194+
*
195+
* @param \DOMXPath $xpath
196+
* @return array
197+
*/
198+
private function getGlobalConfig(\DOMXPath $xpath): array
199+
{
200+
foreach ($xpath->query('//global') as $globalOverride) {
201+
$config = $this->fillGlobalConfigByFixtureType($globalOverride);
202+
}
203+
204+
return $config ?? [];
205+
}
206+
207+
/**
208+
* Fill global configurations node
209+
*
210+
* @param \DOMElement $node
211+
* @return array
212+
*/
213+
private function fillGlobalConfigByFixtureType(\DOMElement $node): array
214+
{
215+
$config = [];
216+
foreach (self::FIXTURE_TYPES as $fixtureType) {
217+
foreach ($node->getElementsByTagName($fixtureType) as $fixture) {
218+
$config['global'][$fixtureType][] = $this->fillAttributes($fixture);
219+
}
220+
}
221+
222+
return $config;
223+
}
192224
}

dev/tests/integration/framework/Magento/TestFramework/Workaround/Override/Fixture/Applier/Base.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
*/
1313
abstract class Base implements ApplierInterface
1414
{
15+
/** @var array */
16+
private $globalConfig;
17+
1518
/** @var array */
1619
private $classConfig;
1720

@@ -21,6 +24,27 @@ abstract class Base implements ApplierInterface
2124
/** @var array */
2225
private $dataSetConfig;
2326

27+
/**
28+
* Get global node config
29+
*
30+
* @return array
31+
*/
32+
public function getGlobalConfig(): array
33+
{
34+
return $this->globalConfig;
35+
}
36+
37+
/**
38+
* Set global node config
39+
*
40+
* @param array $globalConfig
41+
* @return void
42+
*/
43+
public function setGlobalConfig(array $globalConfig): void
44+
{
45+
$this->globalConfig = $globalConfig;
46+
}
47+
2448
/**
2549
* Get class node config
2650
*
@@ -92,6 +116,7 @@ public function setDataSetConfig(array $dataSetConfig): void
92116
protected function getPrioritizedConfig(): array
93117
{
94118
return [
119+
$this->getGlobalConfig(),
95120
$this->getClassConfig(),
96121
$this->getMethodConfig(),
97122
$this->getDataSetConfig(),

dev/tests/integration/framework/Magento/TestFramework/Workaround/Override/Fixture/Resolver.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ private function getApplier(TestCase $test, string $fixtureType): ApplierInterfa
203203
}
204204
/** @var Base $applier */
205205
$applier = $this->appliersList[$fixtureType];
206+
$applier->setGlobalConfig($this->config->getGlobalConfig($fixtureType));
206207
$applier->setClassConfig($this->config->getClassConfig($test, $fixtureType));
207208
$applier->setMethodConfig($this->config->getMethodConfig($test, $fixtureType));
208209
$applier->setDataSetConfig(

dev/tests/integration/framework/Magento/TestFramework/Workaround/etc/overrides.xsd

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<xs:complexType>
1111
<xs:sequence minOccurs="0" maxOccurs="unbounded">
1212
<xs:element name="test" type="test" minOccurs="0" maxOccurs="unbounded" />
13+
<xs:element name="global" type="global" minOccurs="0" maxOccurs="unbounded" />
1314
</xs:sequence>
1415
</xs:complexType>
1516
</xs:element>
@@ -77,4 +78,12 @@
7778
<xs:attribute name="newValue" type="xs:string"/>
7879
<xs:attribute name="remove" type="xs:boolean"/>
7980
</xs:complexType>
81+
<xs:complexType name="global">
82+
<xs:sequence minOccurs="0" maxOccurs="unbounded">
83+
<xs:element name="magentoDataFixture" type="dataFixture" minOccurs="0" maxOccurs="unbounded" />
84+
<xs:element name="magentoDataFixtureBeforeTransaction" type="dataFixture" minOccurs="0" maxOccurs="unbounded" />
85+
<xs:element name="magentoConfigFixture" type="configFixture" minOccurs="0" maxOccurs="unbounded" />
86+
<xs:element name="magentoAdminConfigFixture" type="adminConfigFixture" minOccurs="0" maxOccurs="unbounded" />
87+
</xs:sequence>
88+
</xs:complexType>
8089
</xs:schema>

dev/tests/integration/testsuite/Magento/AsynchronousOperations/Model/MassScheduleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
/**
2828
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
29+
*
30+
* @magentoDbIsolation disabled
2931
*/
3032
class MassScheduleTest extends \PHPUnit\Framework\TestCase
3133
{
@@ -64,6 +66,9 @@ class MassScheduleTest extends \PHPUnit\Framework\TestCase
6466
*/
6567
private $skus = [];
6668

69+
/** @var string */
70+
private $logFilePath;
71+
6772
/**
6873
* @var Registry
6974
*/

dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RelationTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
/**
1717
* Test relation customization
18+
*
19+
* @magentoDbIsolation disabled
1820
*/
1921
class RelationTest extends \Magento\TestFramework\Indexer\TestCase
2022
{

0 commit comments

Comments
 (0)