![]() 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/module-ui/Test/Unit/Config/Converter/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\Ui\Test\Unit\Config\Converter; use Magento\Ui\Config\Converter\StorageConfig; use Magento\Ui\Config\ConverterInterface; use Magento\Ui\Config\ConverterUtils; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class StorageConfigTest extends TestCase { /** * @var StorageConfig */ private $converter; /** * @var ConverterInterface|MockObject */ private $urlConverter; protected function setUp(): void { $this->urlConverter = $this->getMockBuilder(ConverterInterface::class) ->getMockForAbstractClass(); $this->converter = new StorageConfig($this->urlConverter, new ConverterUtils()); } public function testConvert() { $dom = new \DOMDocument('1.0', 'UTF-8'); $dom->load(dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files/test.xml'); $domXpath = new \DOMXPath($dom); $storageConfig = $domXpath->query('//listing/settings/storageConfig')->item(0); $path = $domXpath->query('//listing/settings/storageConfig/path')->item(0); $urlResult = [ 'name' => 'path', 'xsi:type' => 'url', 'path' => 'path', ]; $this->urlConverter->expects($this->any()) ->method('convert') ->with($path, ['type' => 'url']) ->willReturn($urlResult); $expectedResult = [ 'name' => 'storageConfig', 'xsi:type' => 'array', 'item' => [ 'provider' => [ 'name' => 'provider', 'xsi:type' => 'string', 'value' => 'provider', ], 'namespace' => [ 'name' => 'namespace', 'xsi:type' => 'string', 'value' => 'namespace', ], 'path' => $urlResult, 'test' => [ 'name' => 'test', 'xsi:type' => 'string', 'value' => 'test', ] ], ]; $this->assertEquals($expectedResult, $this->converter->convert($storageConfig)); } }