ltsecurityinc安防产品在线商城代码
This commit is contained in:
+80
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\TestModuleOverrideConfig\Model;
|
||||
|
||||
/**
|
||||
* Class represent simple container to save data
|
||||
*
|
||||
* phpcs:disable Generic.Classes.DuplicateClassName
|
||||
*/
|
||||
class FixtureCallStorage
|
||||
{
|
||||
/** @var array */
|
||||
private $storage = [];
|
||||
|
||||
/**
|
||||
* Add fixture to storage
|
||||
*
|
||||
* @param string $fixture
|
||||
*/
|
||||
public function addFixtureToStorage(string $fixture): void
|
||||
{
|
||||
$this->storage[] = $fixture;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fixture position in storage
|
||||
*
|
||||
* @param string $fixture
|
||||
* @return null|int
|
||||
*/
|
||||
public function getFixturePosition(string $fixture): ?int
|
||||
{
|
||||
return array_search($fixture, $this->storage) ?: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get storage
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getStorage(): array
|
||||
{
|
||||
return $this->storage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fixtures count in storage
|
||||
*
|
||||
* @param string $fixture
|
||||
* @return int
|
||||
*/
|
||||
public function getFixturesCount(string $fixture = ''): int
|
||||
{
|
||||
$count = count($this->storage);
|
||||
if ($fixture) {
|
||||
$result = array_filter($this->storage, function ($storedFixture) use ($fixture) {
|
||||
return $storedFixture === $fixture;
|
||||
});
|
||||
$count = count($result);
|
||||
}
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear storage
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function clearStorage(): void
|
||||
{
|
||||
$this->storage = [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "magento/module-override-config-test",
|
||||
"description": "module for override config check",
|
||||
"config": {
|
||||
"sort-packages": true
|
||||
},
|
||||
"require": {
|
||||
"php": "~7.4.0||~8.0.0",
|
||||
"magento/framework": "*",
|
||||
"magento/module-integration": "*"
|
||||
},
|
||||
"type": "magento2-module",
|
||||
"extra": {
|
||||
"map": [
|
||||
[
|
||||
"*",
|
||||
"Magento/TestModuleOverrideConfig"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
|
||||
<system>
|
||||
<section id="test_section" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
|
||||
<group id="test_group" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
|
||||
<field id="field_1" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"/>
|
||||
<field id="field_2" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"/>
|
||||
<field id="field_3" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"/>
|
||||
<field id="field_4" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"/>
|
||||
<field id="field_5" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"/>
|
||||
</group>
|
||||
</section>
|
||||
</system>
|
||||
</config>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
|
||||
<default>
|
||||
<test_section>
|
||||
<test_group>
|
||||
<field_1>1st field default value</field_1>
|
||||
<field_2>2nd field default value</field_2>
|
||||
<field_3>3rd field default value</field_3>
|
||||
<field_4>4th field default value</field_4>
|
||||
<field_5>5th field default value</field_5>
|
||||
</test_group>
|
||||
</test_section>
|
||||
</default>
|
||||
<websites>
|
||||
<base>
|
||||
<test_section>
|
||||
<test_group>
|
||||
<field_3>3rd field website scope default value</field_3>
|
||||
</test_group>
|
||||
</test_section>
|
||||
</base>
|
||||
</websites>
|
||||
</config>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
|
||||
<module name="Magento_TestModuleOverrideConfig" />
|
||||
</config>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Magento\Framework\Component\ComponentRegistrar;
|
||||
|
||||
$registrar = new ComponentRegistrar();
|
||||
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModuleOverrideConfig') === null) {
|
||||
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModuleOverrideConfig', __DIR__);
|
||||
}
|
||||
Reference in New Issue
Block a user