diff --git a/app/code/core/Mage/Adminhtml/Block/Template.php b/app/code/core/Mage/Adminhtml/Block/Template.php
index 34fc2cb84..d6003e51a 100644
--- a/app/code/core/Mage/Adminhtml/Block/Template.php
+++ b/app/code/core/Mage/Adminhtml/Block/Template.php
@@ -39,7 +39,7 @@ public function getFormKey()
}
/**
- * Check whether or not the module output is enabled
+ * Check whether the module output is enabled
*
* Because many module blocks belong to Adminhtml module,
* the feature "Disable module output" doesn't cover Admin area
@@ -52,7 +52,8 @@ public function isOutputEnabled($moduleName = null)
if ($moduleName === null) {
$moduleName = $this->getModuleName();
}
- return !Mage::getStoreConfigFlag('advanced/modules_disable_output/' . $moduleName);
+
+ return Mage::helper('core')->isModuleOutputEnabled($moduleName);
}
/**
diff --git a/app/code/core/Mage/Core/Helper/Abstract.php b/app/code/core/Mage/Core/Helper/Abstract.php
index 18c8eb68e..c61a6de59 100644
--- a/app/code/core/Mage/Core/Helper/Abstract.php
+++ b/app/code/core/Mage/Core/Helper/Abstract.php
@@ -116,7 +116,7 @@ protected function _getModuleName()
}
/**
- * Check whether or not the module output is enabled in Configuration
+ * Check whether the module output is enabled in Configuration
*
* @param string $moduleName Full module name
* @return bool
@@ -131,10 +131,7 @@ public function isModuleOutputEnabled($moduleName = null)
return false;
}
- if (Mage::getStoreConfigFlag('advanced/modules_disable_output/' . $moduleName)) {
- return false;
- }
- return true;
+ return !Mage::getStoreConfigFlag('advanced/modules_disable_output/' . $moduleName);
}
/**
diff --git a/tests/unit/Mage/Adminhtml/Block/TemplateTest.php b/tests/unit/Mage/Adminhtml/Block/TemplateTest.php
new file mode 100644
index 000000000..ea770f2e4
--- /dev/null
+++ b/tests/unit/Mage/Adminhtml/Block/TemplateTest.php
@@ -0,0 +1,93 @@
+subject = new Mage_Adminhtml_Block_Template();
+ }
+
+ /**
+ * @see Mage_Core_Model_Session::getFormKey()
+ * @group Mage_Adminhtml
+ * @group Mage_Adminhtml_Block
+ * @group runInSeparateProcess
+ * @runInSeparateProcess
+ */
+ public function testGetFormKey(): void
+ {
+ $this->assertIsString($this->subject->getFormKey());
+ }
+
+ /**
+ * @covers Mage_Adminhtml_Block_Template::isOutputEnabled()
+ * @dataProvider provideIsOutputEnabled
+ * @group Mage_Adminhtml
+ * @group Mage_Adminhtml_Block
+ */
+ public function testIsOutputEnabled(bool $expectedResult, ?string $moduleName): void
+ {
+ $this->assertSame($expectedResult, $this->subject->isOutputEnabled($moduleName));
+ }
+
+ public function provideIsOutputEnabled(): Generator
+ {
+ yield 'null' => [
+ true,
+ null, #Mage_Adminhtml
+ ];
+ yield 'Mage_Core' => [
+ true,
+ 'Mage_Core',
+ ];
+ yield 'Not_Exist' => [
+ false,
+ 'Not_Exist',
+ ];
+ }
+
+ /**
+ * @group Mage_Adminhtml
+ * @group Mage_Adminhtml_Block
+ */
+ public function testGetModuleName(): void
+ {
+ $this->assertSame('Mage_Adminhtml', $this->subject->getModuleName());
+ }
+
+ /**
+ * @see Mage_Core_Model_Input_Filter_MaliciousCode::filter()
+ * @group Mage_Adminhtml
+ * @group Mage_Adminhtml_Block
+ */
+ public function testMaliciousCodeFilter(): void
+ {
+ $this->assertIsString($this->subject->maliciousCodeFilter(''));
+ }
+}