mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-26 23:34:08 +02:00
parent
fe9cff843d
commit
1db9247d0d
@ -1,44 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
// {{{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}}}
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Test\Monitoring\Forms\Command;
|
namespace Tests\Icinga\Module\Monitoring\Application\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';
|
|
||||||
|
|
||||||
use \DateTimeZone;
|
use \DateTimeZone;
|
||||||
|
use Icinga\Test\BaseTestCase;
|
||||||
use Icinga\Util\DateTimeFactory;
|
use Icinga\Util\DateTimeFactory;
|
||||||
|
|
||||||
class AcknowledgeFormTest extends BaseTestCase
|
class AcknowledgeFormTest extends BaseTestCase
|
||||||
|
@ -1,41 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
// {{{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}}}
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Test\Monitoring\Forms\Command;
|
namespace Tests\Icinga\Module\Monitoring\Application\Forms\Command;
|
||||||
|
|
||||||
require_once realpath(__DIR__ . '/../../../../../../../library/Icinga/Test/BaseTestCase.php');
|
|
||||||
|
|
||||||
use Icinga\Test\BaseTestCase;
|
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
|
class CommentFormTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
const FORM_CLASS = 'Icinga\Module\Monitoring\Form\Command\CommentForm';
|
const FORM_CLASS = 'Icinga\Module\Monitoring\Form\Command\CommentForm';
|
||||||
|
@ -1,41 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
// {{{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}}}
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Test\Monitoring\Forms\Command;
|
namespace Tests\Icinga\Module\Monitoring\Application\Forms\Command;
|
||||||
|
|
||||||
require_once realpath(__DIR__ . '/../../../../../../../library/Icinga/Test/BaseTestCase.php');
|
|
||||||
|
|
||||||
use Icinga\Test\BaseTestCase;
|
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
|
class CustomNotificationFormTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
const FORM_CLASS = 'Icinga\Module\Monitoring\Form\Command\CustomNotificationForm';
|
const FORM_CLASS = 'Icinga\Module\Monitoring\Form\Command\CustomNotificationForm';
|
||||||
|
@ -1,41 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
// {{{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}}}
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Test\Monitoring\Forms\Command;
|
namespace Tests\Icinga\Module\Monitoring\Application\Forms\Command;
|
||||||
|
|
||||||
require_once realpath(__DIR__ . '/../../../../../../../library/Icinga/Test/BaseTestCase.php');
|
|
||||||
|
|
||||||
use Icinga\Test\BaseTestCase;
|
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;
|
use Icinga\Module\Monitoring\Form\Command\DelayNotificationForm;
|
||||||
|
|
||||||
class DelayNotificationFormTest extends BaseTestCase
|
class DelayNotificationFormTest extends BaseTestCase
|
||||||
|
@ -1,45 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
// {{{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}}}
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Test\Monitoring\Forms\Command;
|
namespace Tests\Icinga\Module\Monitoring\Application\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';
|
|
||||||
|
|
||||||
use \DateTimeZone;
|
use \DateTimeZone;
|
||||||
|
use Icinga\Test\BaseTestCase;
|
||||||
use Icinga\Util\DateTimeFactory;
|
use Icinga\Util\DateTimeFactory;
|
||||||
|
|
||||||
class RescheduleNextCheckFormTest extends BaseTestCase
|
class RescheduleNextCheckFormTest extends BaseTestCase
|
||||||
|
@ -1,51 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
// {{{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}}}
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Test\Monitoring\Forms\Command;
|
namespace Tests\Icinga\Module\Monitoring\Application\Forms\Command;
|
||||||
|
|
||||||
// @codingStandardsIgnoreStart
|
|
||||||
require_once realpath(__DIR__ . '/../../../../../../../library/Icinga/Test/BaseTestCase.php');
|
|
||||||
// @codingStandardsIgnoreEnd
|
|
||||||
|
|
||||||
|
use \DateTimeZone;
|
||||||
use Icinga\Test\BaseTestCase;
|
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\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
|
class ScheduleDowntimeFormTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
@ -60,7 +22,6 @@ class ScheduleDowntimeFormTest extends BaseTestCase
|
|||||||
*/
|
*/
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
date_default_timezone_set('UTC');
|
|
||||||
DateTimeFactory::setConfig(array('timezone' => new DateTimeZone('UTC')));
|
DateTimeFactory::setConfig(array('timezone' => new DateTimeZone('UTC')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,42 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
// {{{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}}}
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Test\Monitoring\Forms\Command;
|
namespace Tests\Icinga\Module\Monitoring\Application\Forms\Command;
|
||||||
|
|
||||||
require_once realpath(__DIR__ . '/../../../../../../../library/Icinga/Test/BaseTestCase.php');
|
|
||||||
|
|
||||||
use Icinga\Test\BaseTestCase;
|
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;
|
use Icinga\Module\Monitoring\Form\Command\SubmitPassiveCheckResultForm;
|
||||||
|
|
||||||
class SubmitPassiveCheckResultFormTest extends BaseTestCase
|
class SubmitPassiveCheckResultFormTest extends BaseTestCase
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
<?php
|
<?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';
|
use \Zend_View_Helper_MonitoringFlags;
|
||||||
require_once 'Zend/View.php';
|
use Icinga\Test\BaseTestCase;
|
||||||
require_once __DIR__. '/../../../../../application/views/helpers/MonitoringFlags.php';
|
|
||||||
|
|
||||||
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()
|
public function testHosts1()
|
||||||
{
|
{
|
||||||
@ -19,7 +24,7 @@ class MonitoringFlagsTest extends \PHPUnit_Framework_TestCase
|
|||||||
'flap_detection_enabled' => '1',
|
'flap_detection_enabled' => '1',
|
||||||
);
|
);
|
||||||
|
|
||||||
$monitoringFlags = new \Zend_View_Helper_MonitoringFlags();
|
$monitoringFlags = new Zend_View_Helper_MonitoringFlags();
|
||||||
$returnArray = $monitoringFlags->monitoringFlags((object)$testArray);
|
$returnArray = $monitoringFlags->monitoringFlags((object)$testArray);
|
||||||
|
|
||||||
$this->assertCount(6, $returnArray);
|
$this->assertCount(6, $returnArray);
|
||||||
@ -47,7 +52,7 @@ class MonitoringFlagsTest extends \PHPUnit_Framework_TestCase
|
|||||||
'flap_detection_enabled' => '0',
|
'flap_detection_enabled' => '0',
|
||||||
);
|
);
|
||||||
|
|
||||||
$monitoringFlags = new \Zend_View_Helper_MonitoringFlags();
|
$monitoringFlags = new Zend_View_Helper_MonitoringFlags();
|
||||||
$returnArray = $monitoringFlags->monitoringFlags((object)$testArray);
|
$returnArray = $monitoringFlags->monitoringFlags((object)$testArray);
|
||||||
|
|
||||||
$this->assertCount(6, $returnArray);
|
$this->assertCount(6, $returnArray);
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Test\Modules\Monitoring\Application\Views\Helpers;
|
namespace Test\Modules\Monitoring\Application\Views\Helpers;
|
||||||
|
|
||||||
require_once 'Zend/View/Helper/Abstract.php';
|
use \Zend_View_Helper_MonitoringProperties;
|
||||||
require_once 'Zend/View.php';
|
use Icinga\Test\BaseTestCase;
|
||||||
require_once __DIR__. '/../../../../../application/views/helpers/MonitoringProperties.php';
|
|
||||||
|
|
||||||
/**
|
// @codingStandardsIgnoreStart
|
||||||
* @TODO(el): This test is subject to bug #4679 and
|
require_once realpath(BaseTestCase::$moduleDir . '/monitoring/application/views/helpers/MonitoringProperties.php');
|
||||||
*/
|
// @codingStandardsIgnoreEnd
|
||||||
class HostStruct4Properties extends \stdClass
|
|
||||||
|
class HostStruct4Properties
|
||||||
{
|
{
|
||||||
public $host_name = 'localhost';
|
public $host_name = 'localhost';
|
||||||
public $host_address = '127.0.0.1';
|
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';
|
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()
|
public function testOutput1()
|
||||||
{
|
{
|
||||||
$host = new HostStruct4Properties();
|
$host = new HostStruct4Properties();
|
||||||
$host->current_check_attempt = '5';
|
$host->current_check_attempt = '5';
|
||||||
|
|
||||||
$propertyHelper = new \Zend_View_Helper_MonitoringProperties();
|
$propertyHelper = new Zend_View_Helper_MonitoringProperties();
|
||||||
$items = $propertyHelper->monitoringProperties($host);
|
$items = $propertyHelper->monitoringProperties($host);
|
||||||
|
|
||||||
$this->assertEquals('5/10 (HARD state)', $items['Current Attempt']);
|
$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->passive_checks_enabled = '0';
|
||||||
$host->is_flapping = '1';
|
$host->is_flapping = '1';
|
||||||
|
|
||||||
$propertyHelper = new \Zend_View_Helper_MonitoringProperties();
|
$propertyHelper = new Zend_View_Helper_MonitoringProperties();
|
||||||
$items = $propertyHelper->monitoringProperties($host);
|
$items = $propertyHelper->monitoringProperties($host);
|
||||||
|
|
||||||
$test = array(
|
$test = array(
|
||||||
|
@ -1,42 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
// {{{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}}}
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Test\Modules\Monitoring\Application\Views\Helpers;
|
namespace Tests\Icinga\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';
|
|
||||||
|
|
||||||
use \stdClass;
|
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
|
class ResolveMacrosTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
@ -46,7 +20,7 @@ class ResolveMacrosTest extends BaseTestCase
|
|||||||
$hostMock->host_name = 'test';
|
$hostMock->host_name = 'test';
|
||||||
$hostMock->host_address = '1.1.1.1';
|
$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('$HOSTNAME$', $hostMock), $hostMock->host_name);
|
||||||
$this->assertEquals($helper->resolveMacros('$HOSTADDRESS$', $hostMock), $hostMock->host_address);
|
$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->host_address = '1.1.1.1';
|
||||||
$svcMock->service_description = 'a service';
|
$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('$HOSTNAME$', $svcMock), $svcMock->host_name);
|
||||||
$this->assertEquals($helper->resolveMacros('$HOSTADDRESS$', $svcMock), $svcMock->host_address);
|
$this->assertEquals($helper->resolveMacros('$HOSTADDRESS$', $svcMock), $svcMock->host_address);
|
||||||
$this->assertEquals($helper->resolveMacros('$SERVICEDESC$', $svcMock), $svcMock->service_description);
|
$this->assertEquals($helper->resolveMacros('$SERVICEDESC$', $svcMock), $svcMock->service_description);
|
||||||
@ -71,20 +45,20 @@ class ResolveMacrosTest extends BaseTestCase
|
|||||||
'CUSTOMVAR' => 'test'
|
'CUSTOMVAR' => 'test'
|
||||||
);
|
);
|
||||||
|
|
||||||
$helper = new \Zend_View_Helper_ResolveMacros();
|
$helper = new Zend_View_Helper_ResolveMacros();
|
||||||
$this->assertEquals($helper->resolveMacros('$CUSTOMVAR$', $objectMock), $objectMock->customvars['CUSTOMVAR']);
|
$this->assertEquals($helper->resolveMacros('$CUSTOMVAR$', $objectMock), $objectMock->customvars['CUSTOMVAR']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFaultyMacros()
|
public function testFaultyMacros()
|
||||||
{
|
{
|
||||||
$hostMock = new \stdClass();
|
$hostMock = new stdClass();
|
||||||
$hostMock->host_name = 'test';
|
$hostMock->host_name = 'test';
|
||||||
$hostMock->customvars = array(
|
$hostMock->customvars = array(
|
||||||
'HOST' => 'te',
|
'HOST' => 'te',
|
||||||
'NAME' => 'st'
|
'NAME' => 'st'
|
||||||
);
|
);
|
||||||
|
|
||||||
$helper = new \Zend_View_Helper_ResolveMacros();
|
$helper = new Zend_View_Helper_ResolveMacros();
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$helper->resolveMacros('$$HOSTNAME$ $ HOSTNAME$ $HOST$NAME$', $hostMock),
|
$helper->resolveMacros('$$HOSTNAME$ $ HOSTNAME$ $HOST$NAME$', $hostMock),
|
||||||
'$test $ HOSTNAME$ teNAME$'
|
'$test $ HOSTNAME$ teNAME$'
|
||||||
@ -93,12 +67,12 @@ class ResolveMacrosTest extends BaseTestCase
|
|||||||
|
|
||||||
public function testMacrosWithSpecialCharacters()
|
public function testMacrosWithSpecialCharacters()
|
||||||
{
|
{
|
||||||
$objectMock = new \stdClass();
|
$objectMock = new stdClass();
|
||||||
$objectMock->customvars = array(
|
$objectMock->customvars = array(
|
||||||
'V€RY_SP3C|@L' => 'not too special!'
|
'V€RY_SP3C|@L' => 'not too special!'
|
||||||
);
|
);
|
||||||
|
|
||||||
$helper = new \Zend_View_Helper_ResolveMacros();
|
$helper = new Zend_View_Helper_ResolveMacros();
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$helper->resolveMacros('$V€RY_SP3C|@L$', $objectMock),
|
$helper->resolveMacros('$V€RY_SP3C|@L$', $objectMock),
|
||||||
$objectMock->customvars['V€RY_SP3C|@L']
|
$objectMock->customvars['V€RY_SP3C|@L']
|
||||||
|
@ -1,49 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
// {{{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}}}
|
// {{{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\Module\Monitoring\Filter\Type\StatusFilter;
|
||||||
use Icinga\Filter\Type\TimeRangeSpecifier;
|
use Icinga\Filter\Type\TimeRangeSpecifier;
|
||||||
use Icinga\Filter\Query\Node;
|
use Icinga\Filter\Query\Node;
|
||||||
use Icinga\Test\BaseTestCase;
|
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
|
class StatusFilterTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
public function testOperatorProposal()
|
public function testOperatorProposal()
|
||||||
|
@ -1,37 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
// {{{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}}}
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
namespace Test\Modules\Monitoring\Library\Filter;
|
|
||||||
|
namespace Tests\Icinga\Module\Monitoring\Library\Filter;
|
||||||
|
|
||||||
use Icinga\Filter\Filterable;
|
use Icinga\Filter\Filterable;
|
||||||
use Icinga\Filter\Query\Tree;
|
|
||||||
use Icinga\Module\Monitoring\Filter\Type\StatusFilter;
|
use Icinga\Module\Monitoring\Filter\Type\StatusFilter;
|
||||||
use Icinga\Filter\Type\TimeRangeSpecifier;
|
|
||||||
use Icinga\Filter\Query\Node;
|
use Icinga\Filter\Query\Node;
|
||||||
use Icinga\Filter\Filter;
|
use Icinga\Filter\Filter;
|
||||||
use Icinga\Filter\Type\TextFilter;
|
use Icinga\Filter\Type\TextFilter;
|
||||||
@ -39,20 +13,6 @@ use Icinga\Filter\FilterAttribute;
|
|||||||
use Icinga\Module\Monitoring\Filter\UrlViewFilter;
|
use Icinga\Module\Monitoring\Filter\UrlViewFilter;
|
||||||
use Icinga\Test\BaseTestCase;
|
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
|
class FilterMock implements Filterable
|
||||||
{
|
{
|
||||||
public function isValidFilterTarget($field)
|
public function isValidFilterTarget($field)
|
||||||
@ -79,8 +39,6 @@ class FilterMock implements Filterable
|
|||||||
{
|
{
|
||||||
// TODO: Implement addFilter() method.
|
// TODO: Implement addFilter() method.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class UrlViewFilterTest extends BaseTestCase
|
class UrlViewFilterTest extends BaseTestCase
|
||||||
@ -209,6 +167,5 @@ class UrlViewFilterTest extends BaseTestCase
|
|||||||
$filter .= str_shuffle('&|ds& wra =!<>|dsgs=,-G');
|
$filter .= str_shuffle('&|ds& wra =!<>|dsgs=,-G');
|
||||||
$tree = $filterFactory->parseUrl($filter);
|
$tree = $filterFactory->parseUrl($filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,9 +37,9 @@ foreach ($modules as $module) {
|
|||||||
$loader->registerNamespace($moduleNamespace, $moduleLibraryPath);
|
$loader->registerNamespace($moduleNamespace, $moduleLibraryPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
$moduleTestPath = $modulePath . '/' . $module . '/test';
|
$moduleTestPath = $modulePath . '/' . $module . '/test/php';
|
||||||
if (is_dir($moduleTestPath)) {
|
if (is_dir($moduleTestPath)) {
|
||||||
$loader->registerNamespace($moduleNamespace . '\\Test', $moduleTestPath);
|
$loader->registerNamespace('Tests\\' . $moduleNamespace, $moduleTestPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
$moduleFormPath = $modulePath . '/' . $module . '/application/forms';
|
$moduleFormPath = $modulePath . '/' . $module . '/application/forms';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user