ltsecurityinc安防产品在线商城代码
This commit is contained in:
+38
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\TestModuleOverrideConfig;
|
||||
|
||||
use Magento\Framework\ObjectManagerInterface;
|
||||
use Magento\TestFramework\Helper\Bootstrap;
|
||||
use Magento\TestFramework\TestCase\WebapiAbstract;
|
||||
|
||||
/**
|
||||
* Base class for override config tests.
|
||||
*/
|
||||
abstract class AbstractOverridesTest extends WebapiAbstract
|
||||
{
|
||||
/** @var ObjectManagerInterface */
|
||||
protected $objectManager;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$useConfig = (defined('USE_OVERRIDE_CONFIG') && USE_OVERRIDE_CONFIG === 'enabled');
|
||||
|
||||
if (!$useConfig) {
|
||||
$this->markTestSkipped('Override config is disabled.');
|
||||
}
|
||||
|
||||
$this->objectManager = Bootstrap::getObjectManager();
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\TestModuleOverrideConfig\Inheritance\Fixtures;
|
||||
|
||||
use Magento\TestModuleOverrideConfig\AbstractOverridesTest;
|
||||
|
||||
/**
|
||||
* Test abstract class for testing fixtures override config inheritance.
|
||||
*
|
||||
* phpcs:disable Generic.Classes.DuplicateClassName
|
||||
*/
|
||||
abstract class FixturesAbstractClass extends AbstractOverridesTest
|
||||
{
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\TestModuleOverrideConfig\Inheritance\Fixtures;
|
||||
|
||||
/**
|
||||
* Test interface for testing fixtures override config inheritance.
|
||||
*
|
||||
* phpcs:disable Generic.Classes.DuplicateClassName
|
||||
*/
|
||||
interface FixturesInterface
|
||||
{
|
||||
|
||||
}
|
||||
+229
@@ -0,0 +1,229 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\TestModuleOverrideConfig\Inheritance\Fixtures;
|
||||
|
||||
use Magento\Framework\App\Config\ScopeConfigInterface;
|
||||
use Magento\Store\Model\ScopeInterface;
|
||||
use Magento\TestFramework\Config\Model\ConfigStorage;
|
||||
use Magento\TestModuleOverrideConfig\Model\FixtureCallStorage;
|
||||
|
||||
/**
|
||||
* Class checks that fixtures override config inherited from abstract class and interface.
|
||||
*
|
||||
* phpcs:disable Generic.Classes.DuplicateClassName
|
||||
*
|
||||
* @magentoAppIsolation enabled
|
||||
*/
|
||||
class FixturesTest extends FixturesAbstractClass implements FixturesInterface
|
||||
{
|
||||
/**
|
||||
* @var ScopeConfigInterface
|
||||
*/
|
||||
private $config;
|
||||
|
||||
/**
|
||||
* @var ConfigStorage
|
||||
*/
|
||||
private $configStorage;
|
||||
|
||||
/**
|
||||
* @var FixtureCallStorage
|
||||
*/
|
||||
private $fixtureCallStorage;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->config = $this->objectManager->get(ScopeConfigInterface::class);
|
||||
$this->configStorage = $this->objectManager->get(ConfigStorage::class);
|
||||
$this->fixtureCallStorage = $this->objectManager->get(FixtureCallStorage::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @magentoConfigFixture default_store test_section/test_group/field_2 new_value
|
||||
* @magentoConfigFixture default_store test_section/test_group/field_3 new_value
|
||||
* @magentoApiDataFixture Magento/TestModuleOverrideConfig/_files/fixture2_first_module.php
|
||||
* @magentoApiDataFixture Magento/TestModuleOverrideConfig/_files/fixture3_first_module.php
|
||||
* @dataProvider interfaceDataProvider
|
||||
* @param array $storeConfigs
|
||||
* @param array $fixtures
|
||||
* @return void
|
||||
*/
|
||||
public function testInterfaceInheritance(
|
||||
array $storeConfigs,
|
||||
array $fixtures
|
||||
): void {
|
||||
$this->assertConfigFieldValues($storeConfigs, ScopeInterface::SCOPE_STORES);
|
||||
$this->assertUsedFixturesCount($fixtures);
|
||||
}
|
||||
|
||||
/**
|
||||
* @magentoConfigFixture default_store test_section/test_group/field_2 new_value
|
||||
* @magentoApiDataFixture Magento/TestModuleOverrideConfig/_files/fixture2_first_module.php
|
||||
* @dataProvider abstractDataProvider
|
||||
* @param array $storeConfigs
|
||||
* @param array $fixtures
|
||||
* @return void
|
||||
*/
|
||||
public function testAbstractInheritance(
|
||||
array $storeConfigs,
|
||||
array $fixtures
|
||||
): void {
|
||||
$this->assertConfigFieldValues($storeConfigs, ScopeInterface::SCOPE_STORES);
|
||||
$this->assertUsedFixturesCount($fixtures);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function interfaceDataProvider(): array
|
||||
{
|
||||
return [
|
||||
'first_data_set' => [
|
||||
'store_configs' => [
|
||||
'test_section/test_group/field_1' => [
|
||||
'value' => 'overridden config fixture value for class',
|
||||
'exists_in_db' => true,
|
||||
],
|
||||
'test_section/test_group/field_2' => [
|
||||
'value' => 'overridden config fixture value for method',
|
||||
'exists_in_db' => true,
|
||||
],
|
||||
'test_section/test_group/field_3' => [
|
||||
'value' => 'new_value',
|
||||
'exists_in_db' => true,
|
||||
],
|
||||
],
|
||||
'fixtures' => [
|
||||
'fixture1_first_module.php' => 1,
|
||||
'fixture2_first_module.php' => 0,
|
||||
'fixture2_second_module.php' => 1,
|
||||
'fixture3_first_module.php' => 1,
|
||||
],
|
||||
],
|
||||
'second_data_set' => [
|
||||
'store_configs' => [
|
||||
'test_section/test_group/field_1' => [
|
||||
'value' => 'overridden config fixture value for class',
|
||||
'exists_in_db' => true,
|
||||
],
|
||||
'test_section/test_group/field_2' => [
|
||||
'value' => 'overridden config fixture value for method',
|
||||
'exists_in_db' => true,
|
||||
],
|
||||
'test_section/test_group/field_3' => [
|
||||
'value' => '3rd field website scope default value',
|
||||
'exists_in_db' => false,
|
||||
],
|
||||
],
|
||||
'fixtures' => [
|
||||
'fixture1_first_module.php' => 1,
|
||||
'fixture2_first_module.php' => 0,
|
||||
'fixture2_second_module.php' => 1,
|
||||
'fixture3_first_module.php' => 0,
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function abstractDataProvider(): array
|
||||
{
|
||||
return [
|
||||
'first_data_set' => [
|
||||
'store_configs' => [
|
||||
'test_section/test_group/field_1' => [
|
||||
'value' => 'overridden config fixture value for class',
|
||||
'exists_in_db' => true,
|
||||
],
|
||||
'test_section/test_group/field_2' => [
|
||||
'value' => '2nd field default value',
|
||||
'exists_in_db' => false,
|
||||
],
|
||||
'test_section/test_group/field_3' => [
|
||||
'value' => 'overridden config fixture value for data set from abstract',
|
||||
'exists_in_db' => true,
|
||||
],
|
||||
],
|
||||
'fixtures' => [
|
||||
'fixture1_first_module.php' => 1,
|
||||
'fixture2_first_module.php' => 0,
|
||||
'fixture2_second_module.php' => 0,
|
||||
'fixture3_first_module.php' => 1,
|
||||
],
|
||||
],
|
||||
'second_data_set' => [
|
||||
'store_configs' => [
|
||||
'test_section/test_group/field_1' => [
|
||||
'value' => 'overridden config fixture value for data set from abstract',
|
||||
'exists_in_db' => true,
|
||||
],
|
||||
'test_section/test_group/field_2' => [
|
||||
'value' => '2nd field default value',
|
||||
'exists_in_db' => false,
|
||||
],
|
||||
'test_section/test_group/field_3' => [
|
||||
'value' => '3rd field website scope default value',
|
||||
'exists_in_db' => false,
|
||||
],
|
||||
],
|
||||
'fixtures' => [
|
||||
'fixture1_first_module.php' => 0,
|
||||
'fixture2_first_module.php' => 0,
|
||||
'fixture1_second_module.php' => 1,
|
||||
'fixture3_first_module.php' => 0,
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts config field values.
|
||||
*
|
||||
* @param array $configs
|
||||
* @param string $scope
|
||||
* @return void
|
||||
*/
|
||||
private function assertConfigFieldValues(
|
||||
array $configs,
|
||||
string $scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT
|
||||
): void {
|
||||
foreach ($configs as $path => $expected) {
|
||||
$this->assertEquals($expected['value'], $this->config->getValue($path, $scope, 'default'));
|
||||
if ($expected['exists_in_db']) {
|
||||
$this->assertEquals(
|
||||
$expected['value'],
|
||||
$this->configStorage->getValueFromDb($path, ScopeInterface::SCOPE_STORES, 'default')
|
||||
);
|
||||
} else {
|
||||
$this->assertFalse(
|
||||
$this->configStorage->checkIsRecordExist($path, ScopeInterface::SCOPE_STORES, 'default')
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts count of used fixtures.
|
||||
*
|
||||
* @param array $fixtures
|
||||
* @return void
|
||||
*/
|
||||
private function assertUsedFixturesCount(array $fixtures): void
|
||||
{
|
||||
foreach ($fixtures as $fixture => $count) {
|
||||
$this->assertEquals($count, $this->fixtureCallStorage->getFixturesCount($fixture));
|
||||
}
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\TestModuleOverrideConfig\Inheritance\Skip;
|
||||
|
||||
use Magento\TestModuleOverrideConfig\AbstractOverridesTest;
|
||||
|
||||
/**
|
||||
* Test abstract class for testing skip override config inheritance.
|
||||
*
|
||||
* phpcs:disable Generic.Classes.DuplicateClassName
|
||||
*/
|
||||
abstract class SkipAbstractClass extends AbstractOverridesTest
|
||||
{
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\TestModuleOverrideConfig\Inheritance\Skip;
|
||||
|
||||
/**
|
||||
* Test interface for testing skip override config inheritance.
|
||||
*
|
||||
* phpcs:disable Generic.Classes.DuplicateClassName
|
||||
*/
|
||||
interface SkipInterface
|
||||
{
|
||||
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\TestModuleOverrideConfig\Inheritance\Skip;
|
||||
|
||||
/**
|
||||
* Class checks that test method can be skipped using inherited from abstract class/interface override config
|
||||
*
|
||||
* phpcs:disable Generic.Classes.DuplicateClassName
|
||||
*
|
||||
* @magentoAppIsolation enabled
|
||||
*/
|
||||
class SkipTest extends SkipAbstractClass implements SkipInterface
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function testAbstractSkip(): void
|
||||
{
|
||||
$this->fail('This test should be skipped via override config in method node inherited from abstract class');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function testInterfaceSkip(): void
|
||||
{
|
||||
$this->fail('This test should be skipped via override config in method node inherited from interface');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider skipDataProvider
|
||||
*
|
||||
* @param string $message
|
||||
* @return void
|
||||
*/
|
||||
public function testSkipDataSet(string $message): void
|
||||
{
|
||||
$this->fail($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function skipDataProvider(): array
|
||||
{
|
||||
return [
|
||||
'first_data_set' => ['This test should be skipped in data set node inherited from abstract class'],
|
||||
'second_data_set' => ['This test should be skipped in data set node inherited from interface'],
|
||||
];
|
||||
}
|
||||
}
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\TestModuleOverrideConfig\MagentoApiConfigFixture;
|
||||
|
||||
use Magento\Framework\App\Config\ScopeConfigInterface;
|
||||
use Magento\Store\Model\ScopeInterface;
|
||||
use Magento\TestFramework\Config\Model\ConfigStorage;
|
||||
use Magento\TestModuleOverrideConfig\AbstractOverridesTest;
|
||||
|
||||
/**
|
||||
* Class checks that magentoConfigFixtures can be added via override config
|
||||
*
|
||||
* @magentoAppIsolation enabled
|
||||
*/
|
||||
class AddFixtureTest extends AbstractOverridesTest
|
||||
{
|
||||
/** @var ScopeConfigInterface */
|
||||
private $config;
|
||||
|
||||
/** @var ConfigStorage */
|
||||
private $configStorage;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->config = $this->objectManager->get(ScopeConfigInterface::class);
|
||||
$this->configStorage = $this->objectManager->get(ConfigStorage::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that fixture added in test class node successfully applied
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAddFixtureToClass(): void
|
||||
{
|
||||
$value = $this->config->getValue('test_section/test_group/field_1', ScopeInterface::SCOPE_STORES, 'default');
|
||||
$this->assertEquals('overridden value for full class', $value);
|
||||
$this->assertEquals(
|
||||
'overridden value for full class',
|
||||
$this->configStorage->getValueFromDb(
|
||||
'test_section/test_group/field_1',
|
||||
ScopeInterface::SCOPE_STORES,
|
||||
'default'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that fixtures added in method and data set nodes successfully applied
|
||||
*
|
||||
* @dataProvider testDataProvider
|
||||
*
|
||||
* @param string $expectedConfigValue
|
||||
* @return void
|
||||
*/
|
||||
public function testAddFixtureToMethod(string $expectedConfigValue): void
|
||||
{
|
||||
$value = $this->config->getValue('test_section/test_group/field_1', ScopeInterface::SCOPE_STORES, 'default');
|
||||
$this->assertEquals($expectedConfigValue, $value);
|
||||
$this->assertEquals(
|
||||
$expectedConfigValue,
|
||||
$this->configStorage->getValueFromDb(
|
||||
'test_section/test_group/field_1',
|
||||
ScopeInterface::SCOPE_STORES,
|
||||
'default'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function testDataProvider(): array
|
||||
{
|
||||
return [
|
||||
'first_data_set' => ['expected_config_value' => 'overridden value for method'],
|
||||
'second_data_set' => ['expected_config_value' => 'overridden value for data set']
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that fixtures can be added on website scope
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAddFixtureOnWebsiteScope(): void
|
||||
{
|
||||
$value = $this->config->getValue('test_section/test_group/field_1', ScopeInterface::SCOPE_WEBSITES, 'base');
|
||||
$this->assertEquals('overridden value for method on website scope', $value);
|
||||
$this->assertEquals(
|
||||
'overridden value for method on website scope',
|
||||
$this->configStorage->getValueFromDb(
|
||||
'test_section/test_group/field_1',
|
||||
ScopeInterface::SCOPE_WEBSITES,
|
||||
'base'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
+178
@@ -0,0 +1,178 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\TestModuleOverrideConfig\MagentoApiConfigFixture;
|
||||
|
||||
use Magento\Framework\App\Config\ScopeConfigInterface;
|
||||
use Magento\Store\Model\ScopeInterface;
|
||||
use Magento\TestFramework\Config\Model\ConfigStorage;
|
||||
use Magento\TestModuleOverrideConfig\AbstractOverridesTest;
|
||||
|
||||
/**
|
||||
* Class checks that magentoConfigFixtures can be removed using override config
|
||||
*
|
||||
* @magentoAppIsolation enabled
|
||||
*/
|
||||
class RemoveFixtureTest extends AbstractOverridesTest
|
||||
{
|
||||
/** @var ScopeConfigInterface */
|
||||
private $config;
|
||||
|
||||
/** @var ConfigStorage */
|
||||
private $configStorage;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->config = $this->objectManager->get(ScopeConfigInterface::class);
|
||||
$this->configStorage = $this->objectManager->get(ConfigStorage::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that fixture can be removed in test class node
|
||||
*
|
||||
* @magentoConfigFixture default_store test_section/test_group/field_1 new_value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testRemoveFixtureForClass(): void
|
||||
{
|
||||
$value = $this->config->getValue(
|
||||
'test_section/test_group/field_1',
|
||||
ScopeInterface::SCOPE_STORES,
|
||||
'default'
|
||||
);
|
||||
$this->assertEquals('1st field default value', $value);
|
||||
$this->assertFalse(
|
||||
$this->configStorage->checkIsRecordExist(
|
||||
'test_section/test_group/field_1',
|
||||
ScopeInterface::SCOPE_STORES,
|
||||
'default'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that fixtures can be removed in method and data set nodes
|
||||
*
|
||||
* @magentoConfigFixture default_store test_section/test_group/field_2 new_value
|
||||
* @magentoConfigFixture default_store test_section/test_group/field_3 new_value
|
||||
*
|
||||
* @dataProvider testDataProvider
|
||||
*
|
||||
* @param string $expectedFirstValue
|
||||
* @param string $expectedSecondValue
|
||||
* @param bool $firstvalueExist
|
||||
* @param bool $secondvalueExist
|
||||
* @return void
|
||||
*/
|
||||
public function testRemoveFixtureForMethod(
|
||||
string $expectedFirstValue,
|
||||
string $expectedSecondValue,
|
||||
bool $firstvalueExist,
|
||||
bool $secondvalueExist
|
||||
): void {
|
||||
$fistValue = $this->config->getValue(
|
||||
'test_section/test_group/field_2',
|
||||
ScopeInterface::SCOPE_STORES,
|
||||
'default'
|
||||
);
|
||||
$secondValue = $this->config->getValue(
|
||||
'test_section/test_group/field_3',
|
||||
ScopeInterface::SCOPE_STORES,
|
||||
'default'
|
||||
);
|
||||
$this->assertEquals($expectedFirstValue, $fistValue);
|
||||
if ($firstvalueExist) {
|
||||
$this->assertEquals(
|
||||
$expectedFirstValue,
|
||||
$this->configStorage->getValueFromDb(
|
||||
'test_section/test_group/field_2',
|
||||
ScopeInterface::SCOPE_STORES,
|
||||
'default'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$this->assertEquals(
|
||||
$firstvalueExist,
|
||||
$this->configStorage->checkIsRecordExist(
|
||||
'test_section/test_group/field_2',
|
||||
ScopeInterface::SCOPE_STORES,
|
||||
'default'
|
||||
)
|
||||
);
|
||||
$this->assertEquals($expectedSecondValue, $secondValue);
|
||||
if ($secondvalueExist) {
|
||||
$this->assertEquals(
|
||||
$expectedSecondValue,
|
||||
$this->configStorage->getValueFromDb(
|
||||
'test_section/test_group/field_3',
|
||||
ScopeInterface::SCOPE_STORES,
|
||||
'default'
|
||||
)
|
||||
);
|
||||
}
|
||||
$this->assertEquals(
|
||||
$secondvalueExist,
|
||||
$this->configStorage->checkIsRecordExist(
|
||||
'test_section/test_group/field_3',
|
||||
ScopeInterface::SCOPE_STORES,
|
||||
'default'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function testDataProvider(): array
|
||||
{
|
||||
return [
|
||||
'first_data_set' => [
|
||||
'expected_first_config_value' => '2nd field default value',
|
||||
'expected_second_config_value' => 'new_value',
|
||||
'first_value_exist' => false,
|
||||
'second_value_exist' => true,
|
||||
],
|
||||
'second_data_set' => [
|
||||
'expected_first_config_value' => '2nd field default value',
|
||||
'expected_second_config_value' => '3rd field website scope default value',
|
||||
'first_value_exist' => false,
|
||||
'second_value_exist' => false,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that website scope fixture can be removed
|
||||
*
|
||||
* @magentoConfigFixture base_website test_section/test_group/field_3 new_value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testRemoveWebsiteScopeFixture(): void
|
||||
{
|
||||
$value = $this->config->getValue(
|
||||
'test_section/test_group/field_3',
|
||||
ScopeInterface::SCOPE_WEBSITES,
|
||||
'base'
|
||||
);
|
||||
$this->assertEquals('3rd field website scope default value', $value);
|
||||
$this->assertFalse(
|
||||
$this->configStorage->checkIsRecordExist(
|
||||
'test_section/test_group/field_3',
|
||||
ScopeInterface::SCOPE_WEBSITES,
|
||||
'base'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
+178
@@ -0,0 +1,178 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\TestModuleOverrideConfig\MagentoApiConfigFixture;
|
||||
|
||||
use Magento\Framework\App\Config\ScopeConfigInterface;
|
||||
use Magento\Store\Model\ScopeInterface;
|
||||
use Magento\TestFramework\Config\Model\ConfigStorage;
|
||||
use Magento\TestModuleOverrideConfig\AbstractOverridesTest;
|
||||
|
||||
/**
|
||||
* Class check that fixtures can be replaced using override config
|
||||
*
|
||||
* @magentoAppIsolation enabled
|
||||
*/
|
||||
class ReplaceFixtureTest extends AbstractOverridesTest
|
||||
{
|
||||
/** @var ScopeConfigInterface */
|
||||
private $config;
|
||||
|
||||
/** @var ConfigStorage */
|
||||
private $configStorage;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->config = $this->objectManager->get(ScopeConfigInterface::class);
|
||||
$this->configStorage = $this->objectManager->get(ConfigStorage::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that fixture can be replaced in test class node
|
||||
*
|
||||
* @magentoConfigFixture default_store test_section/test_group/field_1 new_value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testReplaceFixtureForClass(): void
|
||||
{
|
||||
$expectedValue = 'Overridden fixture for class';
|
||||
$value = $this->config->getValue('test_section/test_group/field_1', ScopeInterface::SCOPE_STORES, 'default');
|
||||
$this->assertEquals($expectedValue, $value);
|
||||
$this->assertEquals(
|
||||
$expectedValue,
|
||||
$this->configStorage->getValueFromDb(
|
||||
'test_section/test_group/field_1',
|
||||
ScopeInterface::SCOPE_STORES,
|
||||
'default'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that fixture can be replaced in method and data set nodes
|
||||
*
|
||||
* @magentoConfigFixture default_store test_section/test_group/field_1 new_value
|
||||
*
|
||||
* @dataProvider testDataProvider
|
||||
*
|
||||
* @param string $expectedConfigValue
|
||||
* @return void
|
||||
*/
|
||||
public function testReplaceFixtureForMethod(string $expectedConfigValue): void
|
||||
{
|
||||
$value = $this->config->getValue('test_section/test_group/field_1', ScopeInterface::SCOPE_STORES, 'default');
|
||||
$this->assertEquals($expectedConfigValue, $value);
|
||||
$this->assertEquals(
|
||||
$expectedConfigValue,
|
||||
$this->configStorage->getValueFromDb(
|
||||
'test_section/test_group/field_1',
|
||||
ScopeInterface::SCOPE_STORES,
|
||||
'default'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function testDataProvider(): array
|
||||
{
|
||||
return [
|
||||
'first_data_set' => [
|
||||
'expected_config_value' => 'Overridden fixture for method',
|
||||
],
|
||||
'second_data_set' => [
|
||||
'expected_config_value' => 'Overridden fixture for data set',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that website scope fixture can be replaced
|
||||
*
|
||||
* @magentoConfigFixture base_website test_section/test_group/field_1 new_value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testReplaceWebsiteScopedFixture(): void
|
||||
{
|
||||
$expectedConfigValue = 'Overridden value for website scope';
|
||||
$value = $this->config->getValue('test_section/test_group/field_1', ScopeInterface::SCOPE_WEBSITES, 'base');
|
||||
$this->assertEquals($expectedConfigValue, $value);
|
||||
$this->assertEquals(
|
||||
$expectedConfigValue,
|
||||
$this->configStorage->getValueFromDb(
|
||||
'test_section/test_group/field_1',
|
||||
ScopeInterface::SCOPE_WEBSITE,
|
||||
'base'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that replace config from last loaded file will be applied
|
||||
*
|
||||
* @magentoConfigFixture default_store test_section/test_group/field_1 new_value
|
||||
*
|
||||
* @dataProvider configValuesProvider
|
||||
*
|
||||
* @param string $expectedConfigValue
|
||||
* @return void
|
||||
*/
|
||||
public function testReplaceFixtureViaThirdModule(string $expectedConfigValue): void
|
||||
{
|
||||
$value = $this->config->getValue('test_section/test_group/field_1', ScopeInterface::SCOPE_STORES, 'default');
|
||||
$this->assertEquals($expectedConfigValue, $value);
|
||||
$this->assertEquals(
|
||||
$expectedConfigValue,
|
||||
$this->configStorage->getValueFromDb(
|
||||
'test_section/test_group/field_1',
|
||||
ScopeInterface::SCOPE_STORES,
|
||||
'default'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function configValuesProvider(): array
|
||||
{
|
||||
return [
|
||||
'first_data_set' => [
|
||||
'expected_config_value' => 'Overridden fixture for method from third module',
|
||||
],
|
||||
'second_data_set' => [
|
||||
'expected_config_value' => 'Overridden fixture for data set from third module',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that fixture for global scope can be replaced
|
||||
*
|
||||
* @magentoConfigFixture test_section/test_group/field_1 new_value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testReplaceDefaultConfig(): void
|
||||
{
|
||||
$expectedConfigValue = 'Overridden value for default scope';
|
||||
$value = $this->config->getValue('test_section/test_group/field_1');
|
||||
$this->assertEquals('Overridden value for default scope', $value);
|
||||
$this->assertEquals(
|
||||
$expectedConfigValue,
|
||||
$this->configStorage->getValueFromDb('test_section/test_group/field_1')
|
||||
);
|
||||
}
|
||||
}
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\TestModuleOverrideConfig\MagentoApiDataFixture;
|
||||
|
||||
use Magento\TestModuleOverrideConfig\AbstractOverridesTest;
|
||||
use Magento\TestModuleOverrideConfig\Model\FixtureCallStorage;
|
||||
|
||||
/**
|
||||
* Class checks that magentoDataFixtures can be added using override config
|
||||
*
|
||||
* @magentoAppIsolation enabled
|
||||
*/
|
||||
class AddFixtureTest extends AbstractOverridesTest
|
||||
{
|
||||
/** @var FixtureCallStorage */
|
||||
private $fixtureCallStorage;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->fixtureCallStorage = $this->objectManager->get(FixtureCallStorage::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that fixtures added in all nodes successfully applied
|
||||
*
|
||||
* @dataProvider addedFixturesProvider
|
||||
*
|
||||
* @param array $fixtures
|
||||
* @return void
|
||||
*/
|
||||
public function testAddFixtures(array $fixtures): void
|
||||
{
|
||||
foreach ($fixtures as $scope => $fixture) {
|
||||
$this->assertEquals(
|
||||
1,
|
||||
$this->fixtureCallStorage->getFixturesCount($fixture),
|
||||
sprintf('Fixture added in %s scope was not called', $scope)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function addedFixturesProvider(): array
|
||||
{
|
||||
return [
|
||||
'first_data_set' => [
|
||||
[
|
||||
'class' => 'fixture1_second_module.php',
|
||||
'method' => 'fixture2_second_module.php',
|
||||
'data_set' => 'fixture3_second_module.php',
|
||||
],
|
||||
],
|
||||
'second_data_set' => [
|
||||
[
|
||||
'class' => 'fixture1_second_module.php',
|
||||
'method' => 'fixture2_second_module.php',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that same fixture can be added via override config from few files
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAddSameFixtures(): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
3,
|
||||
$this->fixtureCallStorage->getFixturesCount('fixture2_second_module.php')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that fixture which require another fixture can be added using override
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAddFixtureWithRequiredFixture(): void
|
||||
{
|
||||
$this->assertEquals(1, $this->fixtureCallStorage->getFixturesCount('fixture_with_required_fixture.php'));
|
||||
$this->assertEquals(1, $this->fixtureCallStorage->getFixturesCount('fixture3_second_module.php'));
|
||||
}
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\TestModuleOverrideConfig\MagentoApiDataFixture;
|
||||
|
||||
use Magento\TestModuleOverrideConfig\AbstractOverridesTest;
|
||||
use Magento\TestModuleOverrideConfig\Model\FixtureCallStorage;
|
||||
|
||||
/**
|
||||
* Checks that magentoDataFixture can be removed using override config
|
||||
*
|
||||
* @magentoAppIsolation enabled
|
||||
*/
|
||||
class RemoveFixtureTest extends AbstractOverridesTest
|
||||
{
|
||||
/** @var FixtureCallStorage */
|
||||
private $fixtureCallStorage;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->fixtureCallStorage = $this->objectManager->get(FixtureCallStorage::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that fixture can be removed in test class node
|
||||
*
|
||||
* @magentoDataFixture Magento/TestModuleOverrideConfig/_files/fixture1_first_module.php
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testRemoveFixtureForClass(): void
|
||||
{
|
||||
$this->assertEmpty($this->fixtureCallStorage->getFixturesCount('fixture1_first_module.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that fixture can be removed in method and data set nodes
|
||||
*
|
||||
* @magentoDataFixture Magento/TestModuleOverrideConfig/_files/fixture2_first_module.php
|
||||
* @magentoDataFixture Magento/TestModuleOverrideConfig/_files/fixture3_first_module.php
|
||||
*
|
||||
* @dataProvider testDataProvider
|
||||
*
|
||||
* @param string $fixtureName
|
||||
* @return void
|
||||
*/
|
||||
public function testRemoveFixtureForMethod(string $fixtureName): void
|
||||
{
|
||||
$this->assertEmpty($this->fixtureCallStorage->getFixturesCount($fixtureName));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function testDataProvider(): array
|
||||
{
|
||||
return [
|
||||
'first_data_set' => ['fixture2_first_module.php'],
|
||||
'second_data_set' => ['fixture3_first_module.php'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that same fixtures can be removed few times
|
||||
*
|
||||
* @magentoDataFixture Magento/TestModuleOverrideConfig/_files/fixture2_first_module.php
|
||||
* @magentoDataFixture Magento/TestModuleOverrideConfig/_files/fixture2_first_module.php
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testRemoveSameFixtures(): void
|
||||
{
|
||||
$this->assertEmpty($this->fixtureCallStorage->getFixturesCount('fixture3_first_module.php'));
|
||||
}
|
||||
}
|
||||
+136
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\TestModuleOverrideConfig\MagentoApiDataFixture;
|
||||
|
||||
use Magento\TestModuleOverrideConfig\AbstractOverridesTest;
|
||||
use Magento\TestModuleOverrideConfig\Model\FixtureCallStorage;
|
||||
|
||||
/**
|
||||
* Class check that magentoApiDataFixtures can be replaced using override config
|
||||
*
|
||||
* @magentoAppIsolation enabled
|
||||
*/
|
||||
class ReplaceFixtureTest extends AbstractOverridesTest
|
||||
{
|
||||
/** @var FixtureCallStorage */
|
||||
private $fixtureCallStorage;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->fixtureCallStorage = $this->objectManager->get(FixtureCallStorage::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that fixture can be replaced in test class node
|
||||
*
|
||||
* @magentoApiDataFixture Magento/TestModuleOverrideConfig/_files/fixture1_first_module.php
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testReplaceFixtureForClass(): void
|
||||
{
|
||||
$this->assertEquals(0, $this->fixtureCallStorage->getFixturesCount('fixture1_first_module.php'));
|
||||
$this->assertEquals(1, $this->fixtureCallStorage->getFixturesCount('fixture1_second_module.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that fixture can be replaced in method and data set nodes
|
||||
*
|
||||
* @dataProvider replacedFixturesProvider
|
||||
*
|
||||
* @magentoApiDataFixture Magento/TestModuleOverrideConfig/_files/fixture1_first_module.php
|
||||
*
|
||||
* @param string $fixture
|
||||
* @return void
|
||||
*/
|
||||
public function testReplaceFixturesForMethod(string $fixture): void
|
||||
{
|
||||
$this->assertEquals(0, $this->fixtureCallStorage->getFixturesCount('fixture1_first_module.php'));
|
||||
$this->assertEquals(1, $this->fixtureCallStorage->getFixturesCount($fixture));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function replacedFixturesProvider(): array
|
||||
{
|
||||
return [
|
||||
'first_data_set' => [
|
||||
'fixture2_second_module.php',
|
||||
],
|
||||
'second_data_set' => [
|
||||
'fixture3_second_module.php',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that replace config from last loaded file will be applied
|
||||
*
|
||||
* @dataProvider dataProvider
|
||||
*
|
||||
* @magentoApiDataFixture Magento/TestModuleOverrideConfig/_files/fixture1_first_module.php
|
||||
*
|
||||
* @param string $fixture
|
||||
* @return void
|
||||
*/
|
||||
public function testReplaceFixtureViaThirdModule(string $fixture): void
|
||||
{
|
||||
$this->assertEquals(0, $this->fixtureCallStorage->getFixturesCount('fixture1_first_module.php'));
|
||||
$this->assertEquals(1, $this->fixtureCallStorage->getFixturesCount($fixture));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function dataProvider(): array
|
||||
{
|
||||
return [
|
||||
'first_data_set' => [
|
||||
'fixture2_second_module.php',
|
||||
],
|
||||
'second_data_set' => [
|
||||
'fixture3_second_module.php',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that fixture required in the another fixture can be replaced using override
|
||||
*
|
||||
* @magentoApiDataFixture Magento/TestModuleOverrideConfig2/_files/fixture_with_required_fixture.php
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testReplaceRequiredFixture(): void
|
||||
{
|
||||
$this->assertEquals(1, $this->fixtureCallStorage->getFixturesCount('fixture_with_required_fixture.php'));
|
||||
$this->assertEquals(1, $this->fixtureCallStorage->getFixturesCount('fixture2_second_module.php'));
|
||||
$this->assertEmpty($this->fixtureCallStorage->getFixturesCount('fixture3_second_module.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that fixture required in the another fixture will be replaced according to last loaded override
|
||||
*
|
||||
* @magentoApiDataFixture Magento/TestModuleOverrideConfig2/_files/fixture_with_required_fixture.php
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testReplaceRequiredFixtureViaThirdModule(): void
|
||||
{
|
||||
$this->assertEquals(1, $this->fixtureCallStorage->getFixturesCount('fixture_with_required_fixture.php'));
|
||||
$this->assertEquals(1, $this->fixtureCallStorage->getFixturesCount('fixture1_third_module.php'));
|
||||
$this->assertEmpty($this->fixtureCallStorage->getFixturesCount('fixture2_second_module.php'));
|
||||
$this->assertEmpty($this->fixtureCallStorage->getFixturesCount('fixture3_second_module.php'));
|
||||
}
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\TestModuleOverrideConfig\MagentoApiDataFixture;
|
||||
|
||||
use Magento\TestModuleOverrideConfig\AbstractOverridesTest;
|
||||
use Magento\TestModuleOverrideConfig\Model\FixtureCallStorage;
|
||||
|
||||
/**
|
||||
* Class checks that magentoConfigFixtures can be placed into certain place using override config
|
||||
*
|
||||
* @magentoAppIsolation enabled
|
||||
*/
|
||||
class SortFixturesTest extends AbstractOverridesTest
|
||||
{
|
||||
/** @var FixtureCallStorage */
|
||||
private $fixtureCallStorage;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->fixtureCallStorage = $this->objectManager->get(FixtureCallStorage::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that fixtures can be placed to specific place according to config
|
||||
*
|
||||
* @dataProvider sortFixturesProvider
|
||||
*
|
||||
* @magentoApiDataFixture Magento/TestModuleOverrideConfig/_files/fixture1_first_module.php
|
||||
* @magentoApiDataFixture Magento/TestModuleOverrideConfig/_files/fixture2_first_module.php
|
||||
* @magentoApiDataFixture Magento/TestModuleOverrideConfig/_files/fixture3_first_module.php
|
||||
*
|
||||
* @param array $sortedFixtures
|
||||
* @return void
|
||||
*/
|
||||
public function testSortFixtures(array $sortedFixtures): void
|
||||
{
|
||||
$this->assertEquals($sortedFixtures, $this->fixtureCallStorage->getStorage());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function sortFixturesProvider(): array
|
||||
{
|
||||
return [
|
||||
'first_data_set' => [
|
||||
'sorted_fixtures' => [
|
||||
'fixture3_second_module.php',
|
||||
'fixture1_first_module.php',
|
||||
'fixture1_second_module.php',
|
||||
'fixture2_first_module.php',
|
||||
'fixture1_third_module.php',
|
||||
'fixture3_first_module.php',
|
||||
'fixture2_second_module.php',
|
||||
],
|
||||
],
|
||||
'second_data_set' => [
|
||||
'sorted_fixtures' => [
|
||||
'fixture1_first_module.php',
|
||||
'fixture1_second_module.php',
|
||||
'fixture2_first_module.php',
|
||||
'fixture3_first_module.php',
|
||||
'fixture2_second_module.php',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\TestModuleOverrideConfig\Skip;
|
||||
|
||||
use Magento\TestModuleOverrideConfig\AbstractOverridesTest;
|
||||
|
||||
/**
|
||||
* Class checks that full test class can be skipped
|
||||
*
|
||||
* @magentoAppIsolation enabled
|
||||
*/
|
||||
class SkipClassTest extends AbstractOverridesTest
|
||||
{
|
||||
/**
|
||||
* This test should not be executed according to override config it should be mark as skipped
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testClassSkip(): void
|
||||
{
|
||||
$this->fail('This test should be skipped via override config in test class node');
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\TestModuleOverrideConfig\Skip;
|
||||
|
||||
use Magento\TestModuleOverrideConfig\AbstractOverridesTest;
|
||||
|
||||
/**
|
||||
* Class checks that only specific data set can be skipped using override config
|
||||
*
|
||||
* @magentoAppIsolation enabled
|
||||
*/
|
||||
class SkipDataSetTest extends AbstractOverridesTest
|
||||
{
|
||||
/**
|
||||
* The first_data_set should not be executed according to override config it should be mark as skipped
|
||||
*
|
||||
* @dataProvider testDataProvider
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testSkipDataSet(): void
|
||||
{
|
||||
if ($this->dataName() === 'first_data_set') {
|
||||
$this->fail('This test should be skipped via override config in data set node');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function testDataProvider(): array
|
||||
{
|
||||
return [
|
||||
'first_data_set' => [],
|
||||
'second_data_set' => [],
|
||||
];
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\TestModuleOverrideConfig\Skip;
|
||||
|
||||
use Magento\TestModuleOverrideConfig\AbstractOverridesTest;
|
||||
|
||||
/**
|
||||
* Class checks that test method can be skipped using override config
|
||||
*
|
||||
* @magentoAppIsolation enabled
|
||||
*/
|
||||
class SkipMethodTest extends AbstractOverridesTest
|
||||
{
|
||||
/**
|
||||
* This test should not be executed according to override config it should be mark as skipped
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testMethodSkip(): void
|
||||
{
|
||||
$this->fail('This test should be skipped via override config in method node');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user