Completed
Push — master ( a834dc...2c3a2a )
by Fabian
15s queued 11s
created

ModuleTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace IntegerNet\GlobalCustomLayout\Test\Integration;
5
6
use Magento\Framework\App\ObjectManager;
7
use Magento\Framework\Component\ComponentRegistrar;
8
use Magento\Framework\Module\ModuleList;
9
use PHPUnit\Framework\TestCase;
10
11
class ModuleTest extends TestCase
12
{
13
    private const MODULE_NAME = 'IntegerNet_GlobalCustomLayout';
14
15
    /**
16
     * @var ObjectManager
17
     */
18
    private $objectManager;
19
20
    protected function setUp(): void
21
    {
22
        $this->objectManager = ObjectManager::getInstance();
23
    }
24
25
    public function testModuleIsRegistered()
26
    {
27
        $registrar = new ComponentRegistrar();
28
        $paths = $registrar->getPaths(ComponentRegistrar::MODULE);
29
        $this->assertArrayHasKey(self::MODULE_NAME, $paths);
30
    }
31
32
    public function testModuleIsActive()
33
    {
34
        /** @var ModuleList $moduleList */
35
        $moduleList = $this->objectManager->create(ModuleList::class);
36
        $this->assertTrue(
37
            $moduleList->has(self::MODULE_NAME),
38
            sprintf('The module %s should be enabled', self::MODULE_NAME)
39
        );
40
    }
41
}
42