/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
lib/internal/Magento/Framework/Component/Test/Unit/ComponentRegistrarTest.php
57 строк
2 KB
Alexandra Zota
ACP2E-4019: CE copyright updates for 2.4.9-beta1
22 окт 2025, 17:47
22 окт 2025, 17:47
1b769b7
Код
Авторство
О чём код?
<?php /** * Copyright 2015 Adobe * All Rights Reserved. */ 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')); } }