22 private $moduleManager;
35 $this->cliCommand =
new CliCommand($this->moduleManager);
44 public function startTest(\PHPUnit\Framework\TestCase $test)
46 $annotations = $test->getAnnotations();
48 if (isset($annotations[
'method'][
'moduleName'])) {
49 $moduleNames = $annotations[
'method'][
'moduleName'];
51 foreach ($moduleNames as $moduleName) {
52 $this->cliCommand->introduceModule($moduleName);
54 $path = MAGENTO_MODULES_PATH . explode(
"_", $moduleName)[1] .
'/registration.php';
65 public function endTest(\PHPUnit\Framework\TestCase $test)
67 $annotations = $test->getAnnotations();
69 if (!empty($annotations[
'method'][
'moduleName'])) {
70 foreach ($annotations[
'method'][
'moduleName'] as $moduleName) {
71 $path = MAGENTO_MODULES_PATH .
73 explode(
"_", $moduleName)[1];
75 $this->unsergisterModuleFromComponentRegistrar($moduleName);
89 private function unsergisterModuleFromComponentRegistrar($moduleName)
91 $reflection = new \ReflectionClass(ComponentRegistrar::class);
92 $reflectionProperty = $reflection->getProperty(
'paths');
93 $reflectionProperty->setAccessible(
true);
94 $value = $reflectionProperty->getValue();
96 $reflectionProperty->setValue(
$value);
startTest(\PHPUnit\Framework\TestCase $test)
endTest(\PHPUnit\Framework\TestCase $test)
static rmdirRecursive($dir, $recursive=true)