ltsecurityinc安防产品在线商城代码

This commit is contained in:
2026-09-14 17:47:10 +08:00
parent 57d8444c15
commit 6a3c9c5bd8
14539 changed files with 1775310 additions and 0 deletions
@@ -0,0 +1,102 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleOverrideConfig\MagentoConfigFixture;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Store\Model\ScopeInterface;
use Magento\TestModuleOverrideConfig\AbstractOverridesTest;
/**
* Class checks that magentoConfigFixtures can be added via override config
*
* @magentoAppIsolation enabled
*/
class AddFixtureTest extends AbstractOverridesTest
{
/** @var ScopeConfigInterface */
private $config;
/**
* @inheritdoc
*/
protected function setUp(): void
{
parent::setUp();
$this->config = $this->objectManager->get(ScopeConfigInterface::class);
}
/**
* Checks that fixture added in global node successfully applied
*
* @return void
*/
public function testGloballyAddFixture(): void
{
$value = $this->config->getValue('test_section/test_group/field_4', ScopeInterface::SCOPE_STORES);
$this->assertEquals('4th field globally overridden value', $value);
}
/**
* 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);
$this->assertEquals('overridden value for full class', $value);
}
/**
* 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);
$this->assertEquals($expectedConfigValue, $value);
}
/**
* @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);
$this->assertEquals('overridden value for method on website scope', $value);
}
/**
* Checks that fixtures can be added on website scope with specified scope code
*
* @return void
*/
public function testAddFixtureOnWebsiteScopeWithScopeCode(): void
{
$value = $this->config->getValue('test_section/test_group/field_1', ScopeInterface::SCOPE_WEBSITES, 'base');
$this->assertEquals('overridden value for base website scope', $value);
}
}
@@ -0,0 +1,109 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleOverrideConfig\MagentoConfigFixture;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Store\Model\ScopeInterface;
use Magento\TestModuleOverrideConfig\AbstractOverridesTest;
/**
* Class checks that magentoConfigFixtures can be removed using override config
*
* @magentoAppIsolation enabled
*/
class RemoveFixtureTest extends AbstractOverridesTest
{
/** @var ScopeConfigInterface */
private $config;
/**
* @inheritdoc
*/
protected function setUp(): void
{
parent::setUp();
$this->config = $this->objectManager->get(ScopeConfigInterface::class);
}
/**
* Checks that fixture can be removed in test class node
*
* @magentoConfigFixture current_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);
$this->assertEquals('1st field default value', $value);
}
/**
* Checks that fixtures can be removed in method and data set nodes
*
* @magentoConfigFixture current_store test_section/test_group/field_2 new_value
* @magentoConfigFixture current_store test_section/test_group/field_3 new_value
*
* @dataProvider testDataProvider
*
* @param string $expectedFirstValue
* @param string $expectedSecondValue
* @return void
*/
public function testRemoveFixtureForMethod(string $expectedFirstValue, string $expectedSecondValue): void
{
$fistValue = $this->config->getValue('test_section/test_group/field_2', ScopeInterface::SCOPE_STORES);
$secondValue = $this->config->getValue('test_section/test_group/field_3', ScopeInterface::SCOPE_STORES);
$this->assertEquals($expectedFirstValue, $fistValue);
$this->assertEquals($expectedSecondValue, $secondValue);
}
/**
* @return array
*/
public function testDataProvider(): array
{
return [
'first_data_set' => [
'expected_first_config_value' => '2nd field default value',
'expected_second_config_value' => 'new_value',
],
'second_data_set' => [
'expected_first_config_value' => '2nd field default value',
'expected_second_config_value' => '3rd field website scope default value',
],
];
}
/**
* Checks that website scope fixture can be removed
*
* @magentoConfigFixture current_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);
$this->assertEquals('3rd field website scope default value', $value);
}
/**
* Checks that website scope fixture with specified scope code can be removed
*
* @magentoConfigFixture base_website test_section/test_group/field_3 new_value
*
* @return void
*/
public function testRemoveWebsiteScopeFixtureWithScopeCode(): void
{
$value = $this->config->getValue('test_section/test_group/field_3', ScopeInterface::SCOPE_WEBSITES, 'base');
$this->assertEquals('3rd field website scope default value', $value);
}
}
@@ -0,0 +1,134 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleOverrideConfig\MagentoConfigFixture;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Store\Model\ScopeInterface;
use Magento\TestModuleOverrideConfig\AbstractOverridesTest;
/**
* Class check that fixtures can be replaced using override config
*
* @magentoAppIsolation enabled
*/
class ReplaceFixtureTest extends AbstractOverridesTest
{
/** @var ScopeConfigInterface */
private $config;
/**
* @inheritdoc
*/
protected function setUp(): void
{
parent::setUp();
$this->config = $this->objectManager->get(ScopeConfigInterface::class);
}
/**
* Checks that fixture can be replaced in global node
*
* @magentoConfigFixture current_store test_section/test_group/field_5 new_value
*
* @return void
*/
public function testGloballyReplaceFixture(): void
{
$value = $this->config->getValue('test_section/test_group/field_5', ScopeInterface::SCOPE_STORES);
$this->assertEquals('5th field globally replaced value', $value);
}
/**
* Checks that fixture can be replaced in test class node
*
* @magentoConfigFixture current_store test_section/test_group/field_1 new_value
*
* @return void
*/
public function testReplaceFixtureForClass(): void
{
$value = $this->config->getValue('test_section/test_group/field_1', ScopeInterface::SCOPE_STORES);
$this->assertEquals('Overridden fixture for class', $value);
}
/**
* Checks that fixture can be replaced in method and data set nodes
*
* @magentoConfigFixture current_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);
$this->assertEquals($expectedConfigValue, $value);
}
/**
* @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 current_website test_section/test_group/field_1 new_value
*
* @return void
*/
public function testReplaceWebsiteScopedFixture(): void
{
$value = $this->config->getValue('test_section/test_group/field_1', ScopeInterface::SCOPE_WEBSITES);
$this->assertEquals('Overridden value for website scope', $value);
}
/**
* Checks that replace config from last loaded file will be applied
*
* @magentoConfigFixture current_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);
$this->assertEquals($expectedConfigValue, $value);
}
/**
* @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',
],
];
}
}