Completed
Push — master ( dc4f09...1ada9d )
by Willem
25s queued 11s
created

ModuleTest::testModuleIsRegistered()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 0
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;
0 ignored issues
show
Bug introduced by
The type PHPUnit\Framework\TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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()
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