Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
framework
Component
Test
Unit
ComponentRegistrarTest.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Framework\Component\Test\Unit
;
8
9
use
Magento\Framework\Component\ComponentRegistrar
;
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
49
public
function
testRegistrarWithExceptionForModules
()
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
}
Magento\Framework\Component\Test\Unit\ComponentRegistrarTest\testWithInvalidType
testWithInvalidType()
Definition:
ComponentRegistrarTest.php:29
Magento\Framework\Component\Test\Unit\ComponentRegistrarTest\setUp
setUp()
Definition:
ComponentRegistrarTest.php:20
Magento\Framework\Component\Test\Unit\ComponentRegistrarTest\testRegistrarWithExceptionForModules
testRegistrarWithExceptionForModules()
Definition:
ComponentRegistrarTest.php:49
Magento\Framework\Component\Test\Unit\ComponentRegistrarTest\testGetPath
testGetPath()
Definition:
ComponentRegistrarTest.php:54
Magento\Framework\Component\Test\Unit\ComponentRegistrarTest\testGetPathsForModule
testGetPathsForModule()
Definition:
ComponentRegistrarTest.php:34
Magento\Framework\Component\ComponentRegistrar\register
static register($type, $componentName, $path)
Definition:
ComponentRegistrar.php:46
Magento\Framework\Component\ComponentRegistrar\MODULE
const MODULE
Definition:
ComponentRegistrar.php:21
Magento\Framework\Component\Test\Unit\ComponentRegistrarTest
Definition:
ComponentRegistrarTest.php:11
Magento\Framework\Component\ComponentRegistrar
Definition:
ComponentRegistrar.php:16
Magento\Framework\Component\Test\Unit
Definition:
ComponentFileTest.php:6