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

ModuleTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
eloc 11
c 2
b 0
f 0
dl 0
loc 28
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