![]() 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/Component/Test/Unit/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\Framework\Component\Test\Unit; use Magento\Framework\Component\ComponentRegistrar; use PHPUnit\Framework\TestCase; class ComponentRegistrarTest extends TestCase { /** * Module registrar object * * @var ComponentRegistrar */ private $object; protected function setUp(): void { $this->object = new ComponentRegistrar(); } public function testWithInvalidType() { $this->expectException('LogicException'); $this->expectExceptionMessage('\'some_type\' is not a valid component type'); ComponentRegistrar::register('some_type', "test_module_one", "some/path/name/one"); } public function testGetPathsForModule() { ComponentRegistrar::register(ComponentRegistrar::MODULE, "test_module_one", "some/path/name/one"); ComponentRegistrar::register(ComponentRegistrar::MODULE, "test_module_two", "some/path/name/two"); $expected = [ 'test_module_one' => "some/path/name/one", 'test_module_two' => "some/path/name/two", ]; $this->assertContains($expected['test_module_one'], $this->object->getPaths(ComponentRegistrar::MODULE)); $this->assertContains($expected['test_module_two'], $this->object->getPaths(ComponentRegistrar::MODULE)); } public function testRegistrarWithExceptionForModules() { $this->expectException('LogicException'); ComponentRegistrar::register(ComponentRegistrar::MODULE, "test_module_one", "some/path/name/onemore"); } public function testGetPath() { $this->assertSame("some/path/name/one", $this->object->getPath(ComponentRegistrar::MODULE, 'test_module_one')); $this->assertSame("some/path/name/two", $this->object->getPath(ComponentRegistrar::MODULE, 'test_module_two')); } }