ltsecurityinc安防产品在线商城代码
This commit is contained in:
+32
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\Framework\App\ObjectManager;
|
||||
|
||||
use Magento\TestFramework\Helper\CacheCleaner;
|
||||
|
||||
class ConfigLoaderTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @var \Magento\Framework\App\ObjectManager\ConfigLoader
|
||||
*/
|
||||
private $object;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
|
||||
$this->object = $objectManager->create(
|
||||
\Magento\Framework\App\ObjectManager\ConfigLoader::class
|
||||
);
|
||||
}
|
||||
|
||||
public function testLoad()
|
||||
{
|
||||
$data = $this->object->load('global');
|
||||
$this->assertNotEmpty($data);
|
||||
$cachedData = $this->object->load('global');
|
||||
$this->assertEquals($data, $cachedData);
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\Framework\App\ObjectManager\ConfigWriter;
|
||||
|
||||
class FilesystemTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
const CACHE_KEY = 'filesystemtest';
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\App\ObjectManager\ConfigWriter\Filesystem
|
||||
*/
|
||||
private $configWriter;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\App\ObjectManager\ConfigLoader
|
||||
*/
|
||||
private $configReader;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
|
||||
$this->configWriter = $objectManager->create(
|
||||
\Magento\Framework\App\ObjectManager\ConfigWriter\Filesystem::class
|
||||
);
|
||||
$this->configReader = $objectManager->create(
|
||||
\Magento\Framework\App\ObjectManager\ConfigLoader\Compiled::class
|
||||
);
|
||||
}
|
||||
|
||||
public function testWrite()
|
||||
{
|
||||
$sampleData = [
|
||||
'classA' => true,
|
||||
'classB' => false,
|
||||
];
|
||||
|
||||
$this->configWriter->write(self::CACHE_KEY, $sampleData);
|
||||
$this->assertEquals($sampleData, $this->configReader->load(self::CACHE_KEY));
|
||||
}
|
||||
|
||||
public function testOverwrite()
|
||||
{
|
||||
$this->configWriter->write(self::CACHE_KEY, ['hello' => 'world']);
|
||||
|
||||
$sampleData = [
|
||||
'classC' => false,
|
||||
'classD' => true,
|
||||
];
|
||||
|
||||
$this->configWriter->write(self::CACHE_KEY, $sampleData);
|
||||
$this->assertEquals($sampleData, $this->configReader->load(self::CACHE_KEY));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user