Skip to content

Commit ad8474d

Browse files
committed
Test if module is enabled
1 parent 900918b commit ad8474d

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

tests/Integration/ModuleTest.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
namespace IntegerNet\AsyncVarnish\Test\Integration;
5+
6+
use Magento\Framework\Component\ComponentRegistrar;
7+
use Magento\Framework\Module\ModuleList;
8+
use Magento\TestFramework\ObjectManager;
9+
use PHPUnit\Framework\TestCase;
10+
11+
class ModuleTest extends TestCase
12+
{
13+
14+
/**
15+
* @var ObjectManager
16+
*/
17+
private $objectManager;
18+
const MODULE_NAME = 'IntegerNet_AsyncVarnish';
19+
/**
20+
* @return ModuleList
21+
*/
22+
private function getTestModuleList()
23+
{
24+
/** @var ModuleList $moduleList */
25+
$moduleList = $this->objectManager->create(ModuleList::class);
26+
return $moduleList;
27+
}
28+
protected function setUp()
29+
{
30+
$this->objectManager = ObjectManager::getInstance();
31+
}
32+
public function testTheModuleIsRegistered()
33+
{
34+
$registrar = new ComponentRegistrar();
35+
$paths = $registrar->getPaths(ComponentRegistrar::MODULE);
36+
$this->assertArrayHasKey(self::MODULE_NAME, $paths, 'Module should be registered');
37+
}
38+
public function testTheModuleIsKnownAndEnabled()
39+
{
40+
$moduleList = $this->getTestModuleList();
41+
$this->assertTrue($moduleList->has(self::MODULE_NAME), 'Module should be enabled');
42+
}
43+
44+
}

0 commit comments

Comments
 (0)