Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ComponentRegistrarTest.php
Go to the documentation of this file.
1 <?php
8 
10 
11 class ComponentRegistrarTest extends \PHPUnit\Framework\TestCase
12 {
18  private $object;
19 
20  protected function setUp()
21  {
22  $this->object = new ComponentRegistrar();
23  }
24 
29  public function testWithInvalidType()
30  {
31  ComponentRegistrar::register('some_type', "test_module_one", "some/path/name/one");
32  }
33 
34  public function testGetPathsForModule()
35  {
36  ComponentRegistrar::register(ComponentRegistrar::MODULE, "test_module_one", "some/path/name/one");
37  ComponentRegistrar::register(ComponentRegistrar::MODULE, "test_module_two", "some/path/name/two");
38  $expected = [
39  'test_module_one' => "some/path/name/one",
40  'test_module_two' => "some/path/name/two",
41  ];
42  $this->assertContains($expected['test_module_one'], $this->object->getPaths(ComponentRegistrar::MODULE));
43  $this->assertContains($expected['test_module_two'], $this->object->getPaths(ComponentRegistrar::MODULE));
44  }
45 
50  {
51  ComponentRegistrar::register(ComponentRegistrar::MODULE, "test_module_one", "some/path/name/onemore");
52  }
53 
54  public function testGetPath()
55  {
56  $this->assertSame("some/path/name/one", $this->object->getPath(ComponentRegistrar::MODULE, 'test_module_one'));
57  $this->assertSame("some/path/name/two", $this->object->getPath(ComponentRegistrar::MODULE, 'test_module_two'));
58  }
59 }
static register($type, $componentName, $path)