tests: Require view helpers at runtime

This commit is contained in:
Johannes Meyer 2023-07-04 16:22:08 +02:00
parent e7adc06497
commit c9f3f0444d
4 changed files with 29 additions and 9 deletions

View File

@ -3,13 +3,22 @@
namespace Tests\Icinga\Module\Monitoring\Application\Views\Helpers; namespace Tests\Icinga\Module\Monitoring\Application\Views\Helpers;
use Icinga\Application\Icinga;
use Zend_View_Helper_MonitoringFlags; use Zend_View_Helper_MonitoringFlags;
use Icinga\Test\BaseTestCase; use Icinga\Test\BaseTestCase;
require_once realpath(BaseTestCase::$moduleDir . '/monitoring/application/views/helpers/MonitoringFlags.php');
class MonitoringFlagsTest extends BaseTestCase class MonitoringFlagsTest extends BaseTestCase
{ {
public function setUp(): void
{
parent::setUp();
require_once realpath(
Icinga::app()->getModuleManager()->getModuleDir('monitoring')
. '/application/views/helpers/MonitoringFlags.php'
);
}
public function testHosts1() public function testHosts1()
{ {
$testArray = array( $testArray = array(

View File

@ -3,12 +3,11 @@
namespace Tests\Icinga\Module\Monitoring\Application\Views\Helpers; namespace Tests\Icinga\Module\Monitoring\Application\Views\Helpers;
use Icinga\Application\Icinga;
use Icinga\Web\View; use Icinga\Web\View;
use Zend_View_Helper_PluginOutput; use Zend_View_Helper_PluginOutput;
use Icinga\Test\BaseTestCase; use Icinga\Test\BaseTestCase;
require_once realpath(BaseTestCase::$moduleDir . '/monitoring/application/views/helpers/PluginOutput.php');
class PluginOutputTest extends BaseTestCase class PluginOutputTest extends BaseTestCase
{ {
/** @var Zend_View_Helper_PluginOutput */ /** @var Zend_View_Helper_PluginOutput */
@ -24,6 +23,11 @@ class PluginOutputTest extends BaseTestCase
{ {
parent::setUp(); parent::setUp();
require_once realpath(
Icinga::app()->getModuleManager()->getModuleDir('monitoring')
. '/application/views/helpers/PluginOutput.php'
);
$this->helper = $h = new Zend_View_Helper_PluginOutput; $this->helper = $h = new Zend_View_Helper_PluginOutput;
$h->setView(new View()); $h->setView(new View());
} }

View File

@ -7,8 +7,6 @@ use Mockery;
use Icinga\Test\BaseTestCase; use Icinga\Test\BaseTestCase;
use Icinga\Module\Monitoring\Object\Macro; use Icinga\Module\Monitoring\Object\Macro;
require_once realpath(BaseTestCase::$moduleDir . '/monitoring/library/Monitoring/Object/Macro.php');
class MacroTest extends BaseTestCase class MacroTest extends BaseTestCase
{ {
public function testHostMacros() public function testHostMacros()

View File

@ -3,14 +3,23 @@
namespace Tests\Icinga\Web\Paginator\ScrollingStyle; namespace Tests\Icinga\Web\Paginator\ScrollingStyle;
use Icinga\Application\Icinga;
use Mockery; use Mockery;
use Zend_Paginator; use Zend_Paginator;
use Icinga\Test\BaseTestCase; use Icinga\Test\BaseTestCase;
require_once realpath(BaseTestCase::$libDir . '/Web/Paginator/ScrollingStyle/SlidingWithBorder.php'); class SlidingWithborderTest extends BaseTestCase
class SlidingwithborderTest extends BaseTestCase
{ {
public function setUp(): void
{
parent::setUp();
require_once realpath(
Icinga::app()->getLibraryDir('Icinga')
. '/Web/Paginator/ScrollingStyle/SlidingWithBorder.php'
);
}
public function testGetPages2() public function testGetPages2()
{ {
$scrollingStyle = new \Icinga_Web_Paginator_ScrollingStyle_SlidingWithBorder(); $scrollingStyle = new \Icinga_Web_Paginator_ScrollingStyle_SlidingWithBorder();