Fix module tests

refs #4639
This commit is contained in:
Johannes Meyer 2014-04-10 14:52:08 +02:00
parent fe9cff843d
commit 1db9247d0d
13 changed files with 58 additions and 381 deletions

View File

@ -1,44 +1,11 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
/**
* This file is part of Icinga Web 2.
*
* Icinga Web 2 - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Test\Monitoring\Forms\Command;
require_once realpath(__DIR__ . '/../../../../../../../library/Icinga/Test/BaseTestCase.php');
use Icinga\Test\BaseTestCase;
require_once BaseTestCase::$moduleDir . '/monitoring/application/forms/Command/CommandForm.php';
require_once BaseTestCase::$moduleDir . '/monitoring/application/forms/Command/AcknowledgeForm.php';
require_once BaseTestCase::$libDir . '/Util/ConfigAwareFactory.php';
require_once BaseTestCase::$libDir . '/Util/DateTimeFactory.php';
namespace Tests\Icinga\Module\Monitoring\Application\Forms\Command;
use \DateTimeZone;
use Icinga\Test\BaseTestCase;
use Icinga\Util\DateTimeFactory;
class AcknowledgeFormTest extends BaseTestCase

View File

@ -1,41 +1,11 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
/**
* This file is part of Icinga Web 2.
*
* Icinga Web 2 - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Test\Monitoring\Forms\Command;
require_once realpath(__DIR__ . '/../../../../../../../library/Icinga/Test/BaseTestCase.php');
namespace Tests\Icinga\Module\Monitoring\Application\Forms\Command;
use Icinga\Test\BaseTestCase;
require_once BaseTestCase::$moduleDir . '/monitoring/application/forms/Command/CommandForm.php';
require_once BaseTestCase::$moduleDir . '/monitoring/application/forms/Command/CommentForm.php';
class CommentFormTest extends BaseTestCase
{
const FORM_CLASS = 'Icinga\Module\Monitoring\Form\Command\CommentForm';

View File

@ -1,41 +1,11 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
/**
* This file is part of Icinga Web 2.
*
* Icinga Web 2 - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Test\Monitoring\Forms\Command;
require_once realpath(__DIR__ . '/../../../../../../../library/Icinga/Test/BaseTestCase.php');
namespace Tests\Icinga\Module\Monitoring\Application\Forms\Command;
use Icinga\Test\BaseTestCase;
require_once BaseTestCase::$moduleDir . '/monitoring/application/forms/Command/CommandForm.php';
require_once BaseTestCase::$moduleDir . '/monitoring/application/forms/Command/CustomNotificationForm.php';
class CustomNotificationFormTest extends BaseTestCase
{
const FORM_CLASS = 'Icinga\Module\Monitoring\Form\Command\CustomNotificationForm';

View File

@ -1,41 +1,10 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
/**
* This file is part of Icinga Web 2.
*
* Icinga Web 2 - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Test\Monitoring\Forms\Command;
require_once realpath(__DIR__ . '/../../../../../../../library/Icinga/Test/BaseTestCase.php');
namespace Tests\Icinga\Module\Monitoring\Application\Forms\Command;
use Icinga\Test\BaseTestCase;
require_once BaseTestCase::$moduleDir . '/monitoring/application/forms/Command/CommandForm.php';
require_once BaseTestCase::$moduleDir . '/monitoring/application/forms/Command/DelayNotificationForm.php';
use Icinga\Module\Monitoring\Form\Command\DelayNotificationForm;
class DelayNotificationFormTest extends BaseTestCase

View File

@ -1,45 +1,11 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
/**
* This file is part of Icinga Web 2.
*
* Icinga Web 2 - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Test\Monitoring\Forms\Command;
require_once realpath(__DIR__ . '/../../../../../../../library/Icinga/Test/BaseTestCase.php');
use Icinga\Test\BaseTestCase;
require_once BaseTestCase::$moduleDir . '/monitoring/application/forms/Command/CommandForm.php';
require_once BaseTestCase::$moduleDir . '/monitoring/application/forms/Command/WithChildrenCommandForm.php';
require_once BaseTestCase::$moduleDir . '/monitoring/application/forms/Command/RescheduleNextCheckForm.php';
require_once BaseTestCase::$libDir . '/Util/ConfigAwareFactory.php';
require_once BaseTestCase::$libDir . '/Util/DateTimeFactory.php';
namespace Tests\Icinga\Module\Monitoring\Application\Forms\Command;
use \DateTimeZone;
use Icinga\Test\BaseTestCase;
use Icinga\Util\DateTimeFactory;
class RescheduleNextCheckFormTest extends BaseTestCase

View File

@ -1,51 +1,13 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
/**
* This file is part of Icinga Web 2.
*
* Icinga Web 2 - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Test\Monitoring\Forms\Command;
// @codingStandardsIgnoreStart
require_once realpath(__DIR__ . '/../../../../../../../library/Icinga/Test/BaseTestCase.php');
// @codingStandardsIgnoreEnd
namespace Tests\Icinga\Module\Monitoring\Application\Forms\Command;
use \DateTimeZone;
use Icinga\Test\BaseTestCase;
// @codingStandardsIgnoreStart
require_once 'Zend/Validate/Digits.php';
require_once 'Zend/Validate/GreaterThan.php';
require_once BaseTestCase::$libDir . '/Web/Form.php';
require_once BaseTestCase::$libDir . '/Util/DateTimeFactory.php';
require_once BaseTestCase::$libDir . '/Util/ConfigAwareFactory.php';
require_once BaseTestCase::$moduleDir . '/monitoring/application/forms/Command/ScheduleDowntimeForm.php';
// @codingStandardsIgnoreEnd
use DateTimeZone;
use Icinga\Util\DateTimeFactory;
use Icinga\Module\Monitoring\Form\Command\ScheduleDowntimeForm; // Used by constant FORM_CLASS
use Icinga\Module\Monitoring\Form\Command\ScheduleDowntimeForm;
class ScheduleDowntimeFormTest extends BaseTestCase
{
@ -60,7 +22,6 @@ class ScheduleDowntimeFormTest extends BaseTestCase
*/
public function setUp()
{
date_default_timezone_set('UTC');
DateTimeFactory::setConfig(array('timezone' => new DateTimeZone('UTC')));
}

View File

@ -1,42 +1,10 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
/**
* This file is part of Icinga Web 2.
*
* Icinga Web 2 - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Test\Monitoring\Forms\Command;
require_once realpath(__DIR__ . '/../../../../../../../library/Icinga/Test/BaseTestCase.php');
namespace Tests\Icinga\Module\Monitoring\Application\Forms\Command;
use Icinga\Test\BaseTestCase;
require_once BaseTestCase::$libDir . '/Exception/ProgrammingError.php';
require_once BaseTestCase::$moduleDir . '/monitoring/application/forms/Command/CommandForm.php';
require_once BaseTestCase::$moduleDir . '/monitoring/application/forms/Command/SubmitPassiveCheckResultForm.php';
use Icinga\Module\Monitoring\Form\Command\SubmitPassiveCheckResultForm;
class SubmitPassiveCheckResultFormTest extends BaseTestCase

View File

@ -1,12 +1,17 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
namespace Test\Modules\Monitoring\Application\Views\Helpers;
namespace Tests\Icinga\Module\Monitoring\Application\Views\Helpers;
require_once 'Zend/View/Helper/Abstract.php';
require_once 'Zend/View.php';
require_once __DIR__. '/../../../../../application/views/helpers/MonitoringFlags.php';
use \Zend_View_Helper_MonitoringFlags;
use Icinga\Test\BaseTestCase;
class MonitoringFlagsTest extends \PHPUnit_Framework_TestCase
// @codingStandardsIgnoreStart
require_once realpath(BaseTestCase::$moduleDir . '/monitoring/application/views/helpers/MonitoringFlags.php');
// @codingStandardsIgnoreEnd
class MonitoringFlagsTest extends BaseTestCase
{
public function testHosts1()
{
@ -19,7 +24,7 @@ class MonitoringFlagsTest extends \PHPUnit_Framework_TestCase
'flap_detection_enabled' => '1',
);
$monitoringFlags = new \Zend_View_Helper_MonitoringFlags();
$monitoringFlags = new Zend_View_Helper_MonitoringFlags();
$returnArray = $monitoringFlags->monitoringFlags((object)$testArray);
$this->assertCount(6, $returnArray);
@ -47,7 +52,7 @@ class MonitoringFlagsTest extends \PHPUnit_Framework_TestCase
'flap_detection_enabled' => '0',
);
$monitoringFlags = new \Zend_View_Helper_MonitoringFlags();
$monitoringFlags = new Zend_View_Helper_MonitoringFlags();
$returnArray = $monitoringFlags->monitoringFlags((object)$testArray);
$this->assertCount(6, $returnArray);

View File

@ -1,15 +1,17 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
namespace Test\Modules\Monitoring\Application\Views\Helpers;
require_once 'Zend/View/Helper/Abstract.php';
require_once 'Zend/View.php';
require_once __DIR__. '/../../../../../application/views/helpers/MonitoringProperties.php';
use \Zend_View_Helper_MonitoringProperties;
use Icinga\Test\BaseTestCase;
/**
* @TODO(el): This test is subject to bug #4679 and
*/
class HostStruct4Properties extends \stdClass
// @codingStandardsIgnoreStart
require_once realpath(BaseTestCase::$moduleDir . '/monitoring/application/views/helpers/MonitoringProperties.php');
// @codingStandardsIgnoreEnd
class HostStruct4Properties
{
public $host_name = 'localhost';
public $host_address = '127.0.0.1';
@ -62,14 +64,17 @@ class HostStruct4Properties extends \stdClass
public $host_status_update_time = '2013-07-08 10:10:10';
}
class MonitoringPropertiesTest extends \PHPUnit_Framework_TestCase
/**
* @TODO(el): This test is subject to bug #4679
*/
class MonitoringPropertiesTest extends BaseTestCase
{
public function testOutput1()
{
$host = new HostStruct4Properties();
$host->current_check_attempt = '5';
$propertyHelper = new \Zend_View_Helper_MonitoringProperties();
$propertyHelper = new Zend_View_Helper_MonitoringProperties();
$items = $propertyHelper->monitoringProperties($host);
$this->assertEquals('5/10 (HARD state)', $items['Current Attempt']);
@ -84,7 +89,7 @@ class MonitoringPropertiesTest extends \PHPUnit_Framework_TestCase
$host->passive_checks_enabled = '0';
$host->is_flapping = '1';
$propertyHelper = new \Zend_View_Helper_MonitoringProperties();
$propertyHelper = new Zend_View_Helper_MonitoringProperties();
$items = $propertyHelper->monitoringProperties($host);
$test = array(

View File

@ -1,42 +1,16 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
/**
* This file is part of Icinga Web 2.
*
* Icinga Web 2 - Head for multiple monitoring backends.
* Copyright (C) 2014 Icinga Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2014 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Test\Modules\Monitoring\Application\Views\Helpers;
require_once realpath(__DIR__ . '/../../../../../../../library/Icinga/Test/BaseTestCase.php');
use Icinga\Test\BaseTestCase;
require_once 'Zend/View/Helper/Abstract.php';
require_once BaseTestCase::$moduleDir . '/monitoring/application/views/helpers/ResolveMacros.php';
namespace Tests\Icinga\Modules\Monitoring\Application\Views\Helpers;
use \stdClass;
use \Zend_View_Helper_ResolveMacros;
use Icinga\Test\BaseTestCase;
// @codingStandardsIgnoreStart
require_once realpath(BaseTestCase::$moduleDir . '/monitoring/application/views/helpers/ResolveMacros.php');
// @codingStandardsIgnoreEnd
class ResolveMacrosTest extends BaseTestCase
{
@ -46,7 +20,7 @@ class ResolveMacrosTest extends BaseTestCase
$hostMock->host_name = 'test';
$hostMock->host_address = '1.1.1.1';
$helper = new \Zend_View_Helper_ResolveMacros();
$helper = new Zend_View_Helper_ResolveMacros();
$this->assertEquals($helper->resolveMacros('$HOSTNAME$', $hostMock), $hostMock->host_name);
$this->assertEquals($helper->resolveMacros('$HOSTADDRESS$', $hostMock), $hostMock->host_address);
}
@ -58,7 +32,7 @@ class ResolveMacrosTest extends BaseTestCase
$svcMock->host_address = '1.1.1.1';
$svcMock->service_description = 'a service';
$helper = new \Zend_View_Helper_ResolveMacros();
$helper = new Zend_View_Helper_ResolveMacros();
$this->assertEquals($helper->resolveMacros('$HOSTNAME$', $svcMock), $svcMock->host_name);
$this->assertEquals($helper->resolveMacros('$HOSTADDRESS$', $svcMock), $svcMock->host_address);
$this->assertEquals($helper->resolveMacros('$SERVICEDESC$', $svcMock), $svcMock->service_description);
@ -71,20 +45,20 @@ class ResolveMacrosTest extends BaseTestCase
'CUSTOMVAR' => 'test'
);
$helper = new \Zend_View_Helper_ResolveMacros();
$helper = new Zend_View_Helper_ResolveMacros();
$this->assertEquals($helper->resolveMacros('$CUSTOMVAR$', $objectMock), $objectMock->customvars['CUSTOMVAR']);
}
public function testFaultyMacros()
{
$hostMock = new \stdClass();
$hostMock = new stdClass();
$hostMock->host_name = 'test';
$hostMock->customvars = array(
'HOST' => 'te',
'NAME' => 'st'
);
$helper = new \Zend_View_Helper_ResolveMacros();
$helper = new Zend_View_Helper_ResolveMacros();
$this->assertEquals(
$helper->resolveMacros('$$HOSTNAME$ $ HOSTNAME$ $HOST$NAME$', $hostMock),
'$test $ HOSTNAME$ teNAME$'
@ -93,12 +67,12 @@ class ResolveMacrosTest extends BaseTestCase
public function testMacrosWithSpecialCharacters()
{
$objectMock = new \stdClass();
$objectMock = new stdClass();
$objectMock->customvars = array(
'V€RY_SP3C|@L' => 'not too special!'
);
$helper = new \Zend_View_Helper_ResolveMacros();
$helper = new Zend_View_Helper_ResolveMacros();
$this->assertEquals(
$helper->resolveMacros('$V€RY_SP3C|@L$', $objectMock),
$objectMock->customvars['V€RY_SP3C|@L']

View File

@ -1,49 +1,14 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
/**
* This file is part of Icinga Web 2.
*
* Icinga Web 2 - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Test\Modules\Monitoring\Library\Filter\Type;
namespace Tests\Icinga\Module\Monitoring\Library\Filter\Type;
use Icinga\Module\Monitoring\Filter\Type\StatusFilter;
use Icinga\Filter\Type\TimeRangeSpecifier;
use Icinga\Filter\Query\Node;
use Icinga\Test\BaseTestCase;
// @codingStandardsIgnoreStart
require_once realpath(__DIR__ . '/../../../../../../../library/Icinga/Test/BaseTestCase.php');
require_once realpath(BaseTestCase::$libDir .'/Filter/Query/Node.php');
require_once realpath(BaseTestCase::$libDir .'/Filter/QueryProposer.php');
require_once realpath(BaseTestCase::$libDir .'/Filter/Type/FilterType.php');
require_once realpath(BaseTestCase::$libDir .'/Filter/Type/TimeRangeSpecifier.php');
require_once realpath(BaseTestCase::$moduleDir .'/monitoring/library/Monitoring/Filter/Type/StatusFilter.php');
// @codingStandardsIgnoreEnd
class StatusFilterTest extends BaseTestCase
{
public function testOperatorProposal()
@ -140,4 +105,4 @@ class StatusFilterTest extends BaseTestCase
'Assert the right node to be the time specifier query (field)'
);
}
}
}

View File

@ -1,37 +1,11 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
/**
* This file is part of Icinga Web 2.
*
* Icinga Web 2 - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Test\Modules\Monitoring\Library\Filter;
namespace Tests\Icinga\Module\Monitoring\Library\Filter;
use Icinga\Filter\Filterable;
use Icinga\Filter\Query\Tree;
use Icinga\Module\Monitoring\Filter\Type\StatusFilter;
use Icinga\Filter\Type\TimeRangeSpecifier;
use Icinga\Filter\Query\Node;
use Icinga\Filter\Filter;
use Icinga\Filter\Type\TextFilter;
@ -39,20 +13,6 @@ use Icinga\Filter\FilterAttribute;
use Icinga\Module\Monitoring\Filter\UrlViewFilter;
use Icinga\Test\BaseTestCase;
// @codingStandardsIgnoreStart
require_once realpath(__DIR__ . '/../../../../../../library/Icinga/Test/BaseTestCase.php');
require_once realpath(BaseTestCase::$libDir . '/Filter/QueryProposer.php');
require_once realpath(BaseTestCase::$libDir . '/Filter/Filter.php');
require_once realpath(BaseTestCase::$libDir . '/Filter/FilterAttribute.php');
require_once realpath(BaseTestCase::$libDir . '/Filter/Domain.php');
require_once realpath(BaseTestCase::$libDir . '/Filter/Query/Node.php');
require_once realpath(BaseTestCase::$libDir . '/Filter/Query/Tree.php');
require_once realpath(BaseTestCase::$libDir . '/Filter/Type/FilterType.php');
require_once realpath(BaseTestCase::$libDir . '/Filter/Type/TextFilter.php');
require_once realpath(BaseTestCase::$libDir .'/Filter/Type/TimeRangeSpecifier.php');
require_once realpath(BaseTestCase::$moduleDir .'/monitoring/library/Monitoring/Filter/Type/StatusFilter.php');
require_once realpath(BaseTestCase::$moduleDir .'/monitoring/library/Monitoring/Filter/UrlViewFilter.php');
class FilterMock implements Filterable
{
public function isValidFilterTarget($field)
@ -79,8 +39,6 @@ class FilterMock implements Filterable
{
// TODO: Implement addFilter() method.
}
}
class UrlViewFilterTest extends BaseTestCase
@ -209,6 +167,5 @@ class UrlViewFilterTest extends BaseTestCase
$filter .= str_shuffle('&|ds& wra =!<>|dsgs=,-G');
$tree = $filterFactory->parseUrl($filter);
}
}
}

View File

@ -37,9 +37,9 @@ foreach ($modules as $module) {
$loader->registerNamespace($moduleNamespace, $moduleLibraryPath);
}
$moduleTestPath = $modulePath . '/' . $module . '/test';
$moduleTestPath = $modulePath . '/' . $module . '/test/php';
if (is_dir($moduleTestPath)) {
$loader->registerNamespace($moduleNamespace . '\\Test', $moduleTestPath);
$loader->registerNamespace('Tests\\' . $moduleNamespace, $moduleTestPath);
}
$moduleFormPath = $modulePath . '/' . $module . '/application/forms';