![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/framework/App/Test/Unit/Config/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\Framework\App\Test\Unit\Config; use Magento\Framework\App\Config\Data; use Magento\Framework\App\Config\MetadataProcessor; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class DataTest extends TestCase { /** * @var Data */ protected $_model; /** * @var MetadataProcessor|MockObject */ protected $_metaDataProcessor; protected function setUp(): void { $this->_metaDataProcessor = $this->createMock(MetadataProcessor::class); $this->_metaDataProcessor->expects($this->any())->method('process')->willReturnArgument(0); $this->_model = new Data($this->_metaDataProcessor, []); } /** * @param string $path * @param mixed $value * @dataProvider setValueDataProvider */ public function testSetValue($path, $value) { $this->_model->setValue($path, $value); $this->assertEquals($value, $this->_model->getValue($path)); } /** * @return array */ public function setValueDataProvider() { return [ 'simple value' => ['some/config/value', 'test'], 'complex value' => ['some/config/value', ['level1' => ['level2' => 'test']]] ]; } public function testGetData() { $model = new Data( $this->_metaDataProcessor, ['test' => ['path' => 'value']] ); $this->assertEquals('value', $model->getValue('test/path')); } }