mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-29 16:54:04 +02:00
Make all tests inherit from BaseTestCase and fix license headers and style
refs #4639
This commit is contained in:
parent
6056327c6d
commit
ccae70bc80
@ -1,30 +1,5 @@
|
|||||||
<?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 {
|
namespace {
|
||||||
@ -48,12 +23,12 @@ namespace Icinga\Test {
|
|||||||
|
|
||||||
use \Exception;
|
use \Exception;
|
||||||
use \RuntimeException;
|
use \RuntimeException;
|
||||||
use Zend_Test_PHPUnit_ControllerTestCase;
|
use \Zend_Test_PHPUnit_ControllerTestCase;
|
||||||
use Zend_Config;
|
use \Zend_Config;
|
||||||
use Zend_Db_Adapter_Pdo_Abstract;
|
use \Zend_Db_Adapter_Pdo_Abstract;
|
||||||
use Zend_Db_Adapter_Pdo_Mysql;
|
use \Zend_Db_Adapter_Pdo_Mysql;
|
||||||
use Zend_Db_Adapter_Pdo_Pgsql;
|
use \Zend_Db_Adapter_Pdo_Pgsql;
|
||||||
use Zend_Db_Adapter_Pdo_Oci;
|
use \Zend_Db_Adapter_Pdo_Oci;
|
||||||
use Icinga\Data\ResourceFactory;
|
use Icinga\Data\ResourceFactory;
|
||||||
use Icinga\User\Preferences;
|
use Icinga\User\Preferences;
|
||||||
use Icinga\Web\Form;
|
use Icinga\Web\Form;
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Tests\Application\Controller;
|
namespace Tests\Icinga\Application\Controller;
|
||||||
|
|
||||||
class IndexControllerTest extends \Zend_Test_PHPUnit_ControllerTestCase {
|
use Icinga\Test\BaseTestCase;
|
||||||
private $applicationPath;
|
|
||||||
|
|
||||||
|
class IndexControllerTest extends BaseTestCase
|
||||||
|
{
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->applicationPath = realpath(__DIR__. '/../../../../application');
|
|
||||||
|
|
||||||
if (!defined('APPLICATION_PATH')) {
|
if (!defined('APPLICATION_PATH')) {
|
||||||
define('APPLICATION_PATH', $this->applicationPath);
|
define('APPLICATION_PATH', BaseTestCase::$appDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!defined('APPLICATION_ENV')) {
|
if (!defined('APPLICATION_ENV')) {
|
||||||
@ -25,7 +26,7 @@ class IndexControllerTest extends \Zend_Test_PHPUnit_ControllerTestCase {
|
|||||||
|
|
||||||
public function appBootstrap()
|
public function appBootstrap()
|
||||||
{
|
{
|
||||||
$this->getFrontController()->setControllerDirectory($this->applicationPath. '/controllers');
|
$this->getFrontController()->setControllerDirectory(BaseTestCase::$appDir . '/controllers');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIndexAction()
|
public function testIndexAction()
|
||||||
|
@ -1,74 +1,19 @@
|
|||||||
<?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 Tests\Icinga\Form\Config;
|
namespace Tests\Icinga\Form\Config;
|
||||||
|
|
||||||
use Icinga\Test\BaseTestCase;
|
|
||||||
|
|
||||||
use \Zend_Config;
|
use \Zend_Config;
|
||||||
use \Icinga\Web\Url;
|
use Icinga\Web\Url;
|
||||||
|
use Icinga\Test\BaseTestCase;
|
||||||
use Tests\Icinga\Web\RequestMock;
|
use Tests\Icinga\Web\RequestMock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for the authentication provider form
|
* Test for the authentication provider form
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
class AuthenticationFormTest extends BaseTestCase
|
class AuthenticationFormTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Return a test configuration containing a database and a ldap backend
|
|
||||||
*
|
|
||||||
* @return Zend_Config
|
|
||||||
*/
|
|
||||||
private function getTestConfig()
|
|
||||||
{
|
|
||||||
return new Zend_Config(
|
|
||||||
array(
|
|
||||||
'test-db' => array(
|
|
||||||
'backend' => 'db',
|
|
||||||
'target' => 'user',
|
|
||||||
'resource' => 'db_resource'
|
|
||||||
),
|
|
||||||
'test-ldap' => array(
|
|
||||||
'backend' => 'ldap',
|
|
||||||
'target' => 'user',
|
|
||||||
'hostname' => 'test host',
|
|
||||||
'root_dn' => 'ou=test,dc=icinga,dc=org',
|
|
||||||
'bind_dn' => 'cn=testuser,cn=config',
|
|
||||||
'bind_pw' => 'password',
|
|
||||||
'user_class' => 'testClass',
|
|
||||||
'user_name_attribute' => 'testAttribute'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the ldap provider form population from config
|
* Test the ldap provider form population from config
|
||||||
*/
|
*/
|
||||||
|
@ -1,30 +1,5 @@
|
|||||||
<?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 Tests\Icinga\Form\Config;
|
namespace Tests\Icinga\Form\Config;
|
||||||
|
@ -1,30 +1,5 @@
|
|||||||
<?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 Tests\Icinga\Form\Config;
|
namespace Tests\Icinga\Form\Config;
|
||||||
@ -34,13 +9,11 @@ Use Icinga\Test\BaseTestCase;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for the authentication provider form
|
* Test for the authentication provider form
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
class LoggingFormTest extends BaseTestCase
|
class LoggingFormTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Test the logging form to be correctly populated from configuration
|
* Test the logging form to be correctly populated from configuration
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function testLoggingFormPopulation()
|
public function testLoggingFormPopulation()
|
||||||
{
|
{
|
||||||
@ -88,7 +61,6 @@ class LoggingFormTest extends BaseTestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the logging form to create correct modified configurations when submit
|
* Test the logging form to create correct modified configurations when submit
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function testCorrectConfigCreation()
|
public function testCorrectConfigCreation()
|
||||||
{
|
{
|
||||||
|
@ -1,30 +1,5 @@
|
|||||||
<?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 Tests\Icinga\Form\Preference;
|
namespace Tests\Icinga\Form\Preference;
|
||||||
@ -42,7 +17,6 @@ class GeneralFormTest extends BaseTestCase
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Test whether fields using the default values have input disabled
|
* Test whether fields using the default values have input disabled
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function testDisableFormIfUsingDefault()
|
public function testDisableFormIfUsingDefault()
|
||||||
{
|
{
|
||||||
@ -60,7 +34,6 @@ class GeneralFormTest extends BaseTestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test whether fields with preferences are enabled
|
* Test whether fields with preferences are enabled
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function testEnableFormIfUsingPreference()
|
public function testEnableFormIfUsingPreference()
|
||||||
{
|
{
|
||||||
|
@ -1,37 +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 Tests\Icinga\Application;
|
namespace Tests\Icinga\Application;
|
||||||
|
|
||||||
|
use Icinga\Test\BaseTestCase;
|
||||||
use \Icinga\Application\Config as IcingaConfig;
|
use \Icinga\Application\Config as IcingaConfig;
|
||||||
|
|
||||||
class ConfigTest extends \PHPUnit_Framework_TestCase
|
class ConfigTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Set up config dir
|
* Set up config dir
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Tests\Icinga\Application;
|
namespace Tests\Icinga\Application;
|
||||||
|
|
||||||
|
use Icinga\Test\BaseTestCase;
|
||||||
use Icinga\Application\Loader;
|
use Icinga\Application\Loader;
|
||||||
|
|
||||||
class LoaderTest extends \PHPUnit_Framework_TestCase
|
class LoaderTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
private static $classFile = 'test/My/Library/TestStruct.php';
|
private static $classFile = 'test/My/Library/TestStruct.php';
|
||||||
|
|
||||||
|
@ -1,38 +1,12 @@
|
|||||||
<?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 Tests\Icinga\Application;
|
namespace Tests\Icinga\Application;
|
||||||
|
|
||||||
|
|
||||||
use \Zend_Config;
|
use \Zend_Config;
|
||||||
use Icinga\Test\BaseTestCase;
|
|
||||||
use Icinga\Logger\Logger;
|
use Icinga\Logger\Logger;
|
||||||
|
use Icinga\Test\BaseTestCase;
|
||||||
|
|
||||||
class LoggerTest extends BaseTestCase
|
class LoggerTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Tests\Icinga\Application\Module\Manager;
|
namespace Tests\Icinga\Application\Module\Manager;
|
||||||
|
|
||||||
|
use Icinga\Test\BaseTestCase;
|
||||||
use Icinga\Application\Modules\Manager as ModuleManager;
|
use Icinga\Application\Modules\Manager as ModuleManager;
|
||||||
|
|
||||||
class ModuleMock
|
class ModuleMock
|
||||||
@ -20,7 +23,7 @@ class ModuleMock
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ManagerTest extends \PHPUnit_Framework_TestCase
|
class ManagerTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
const MODULE_TARGET = "/tmp";
|
const MODULE_TARGET = "/tmp";
|
||||||
|
|
||||||
@ -31,11 +34,11 @@ class ManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->markTestSkipped("Temporary folder not writable for this user");
|
$this->markTestSkipped("Temporary folder not writable for this user");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (is_dir($moduleDir."/enabledModules")) {
|
if (is_dir($moduleDir . "/enabledModules")) {
|
||||||
exec("rm -r $moduleDir/enabledModules");
|
exec("rm -r $moduleDir/enabledModules");
|
||||||
}
|
}
|
||||||
|
|
||||||
mkdir($moduleDir."/enabledModules");
|
mkdir($moduleDir . "/enabledModules");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDetectEnabledModules()
|
public function testDetectEnabledModules()
|
||||||
@ -43,11 +46,11 @@ class ManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$manager = new ModuleManager(null, "/tmp/enabledModules", array("none"));
|
$manager = new ModuleManager(null, "/tmp/enabledModules", array("none"));
|
||||||
$this->assertEmpty($manager->listEnabledModules());
|
$this->assertEmpty($manager->listEnabledModules());
|
||||||
|
|
||||||
symlink(getcwd()."/res/testModules/module1", "/tmp/enabledModules/module1");
|
symlink(getcwd() . "/res/testModules/module1", "/tmp/enabledModules/module1");
|
||||||
$manager = new ModuleManager(null, "/tmp/enabledModules", array("none"));
|
$manager = new ModuleManager(null, "/tmp/enabledModules", array("none"));
|
||||||
$this->assertEquals(array("module1"), $manager->listEnabledModules());
|
$this->assertEquals(array("module1"), $manager->listEnabledModules());
|
||||||
symlink(getcwd()."/res/testModules/module2", "/tmp/enabledModules/module2");
|
symlink(getcwd() . "/res/testModules/module2", "/tmp/enabledModules/module2");
|
||||||
symlink(getcwd()."/res/???", "/tmp/enabledModules/module3");
|
symlink(getcwd() . "/res/???", "/tmp/enabledModules/module3");
|
||||||
$manager = new ModuleManager(null, "/tmp/enabledModules", array("none"));
|
$manager = new ModuleManager(null, "/tmp/enabledModules", array("none"));
|
||||||
$this->assertEquals(array("module1", "module2"), $manager->listEnabledModules());
|
$this->assertEquals(array("module1", "module2"), $manager->listEnabledModules());
|
||||||
}
|
}
|
||||||
@ -67,7 +70,7 @@ class ManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testEnableModule()
|
public function testEnableModule()
|
||||||
{
|
{
|
||||||
$manager = new ModuleManager(null, "/tmp/enabledModules", array(getcwd()."/res/testModules"));
|
$manager = new ModuleManager(null, "/tmp/enabledModules", array(getcwd() . "/res/testModules"));
|
||||||
$this->assertEmpty($manager->listEnabledModules());
|
$this->assertEmpty($manager->listEnabledModules());
|
||||||
$manager->enableModule("module1");
|
$manager->enableModule("module1");
|
||||||
$elems = $manager->listEnabledModules();
|
$elems = $manager->listEnabledModules();
|
||||||
@ -82,8 +85,8 @@ class ManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testDisableModule()
|
public function testDisableModule()
|
||||||
{
|
{
|
||||||
clearstatcache(true);
|
clearstatcache(true);
|
||||||
symlink(getcwd()."/res/testModules/module1", "/tmp/enabledModules/module1");
|
symlink(getcwd() . "/res/testModules/module1", "/tmp/enabledModules/module1");
|
||||||
$manager = new ModuleManager(null, "/tmp/enabledModules", array(getcwd()."/res/testModules"));
|
$manager = new ModuleManager(null, "/tmp/enabledModules", array(getcwd() . "/res/testModules"));
|
||||||
$elems = $manager->listEnabledModules();
|
$elems = $manager->listEnabledModules();
|
||||||
$this->assertNotEmpty($elems);
|
$this->assertNotEmpty($elems);
|
||||||
$this->assertEquals($elems[0], "module1");
|
$this->assertEquals($elems[0], "module1");
|
||||||
|
@ -1,30 +1,5 @@
|
|||||||
<?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 Tests\Icinga\Application;
|
namespace Tests\Icinga\Application;
|
||||||
@ -53,7 +28,7 @@ class ZendDbMock
|
|||||||
*
|
*
|
||||||
* @param $adapter String name of base adapter class, or Zend_Config object
|
* @param $adapter String name of base adapter class, or Zend_Config object
|
||||||
* @param $config mixed OPTIONAL; an array or Zend_Config object with adapter
|
* @param $config mixed OPTIONAL; an array or Zend_Config object with adapter
|
||||||
* parameters
|
* parameters
|
||||||
*
|
*
|
||||||
* @return stdClass Empty object
|
* @return stdClass Empty object
|
||||||
*/
|
*/
|
||||||
|
@ -1,30 +1,5 @@
|
|||||||
<?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 Tests\Icinga\Authentication;
|
namespace Tests\Icinga\Authentication;
|
||||||
@ -289,5 +264,4 @@ class DbUserBackendTest extends BaseTestCase
|
|||||||
|
|
||||||
$this->assertGreaterThan(0, $backend->getUserCount());
|
$this->assertGreaterThan(0, $backend->getUserCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,30 +1,5 @@
|
|||||||
<?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 Tests\Icinga\Authentication;
|
namespace Tests\Icinga\Authentication;
|
||||||
|
@ -1,30 +1,5 @@
|
|||||||
<?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 Tests\Icinga\Authentication;
|
namespace Tests\Icinga\Authentication;
|
||||||
@ -58,7 +33,6 @@ class ManagerTest extends BaseTestCase
|
|||||||
&$session = null,
|
&$session = null,
|
||||||
$write = false,
|
$write = false,
|
||||||
$nobackend = false,
|
$nobackend = false,
|
||||||
|
|
||||||
Zend_Config $managerConfig = null
|
Zend_Config $managerConfig = null
|
||||||
) {
|
) {
|
||||||
if ($session == null) {
|
if ($session == null) {
|
||||||
|
@ -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 Tests\Icinga\Chart;
|
namespace Tests\Icinga\Chart;
|
||||||
|
|
||||||
use \DOMXPath;
|
use \DOMXPath;
|
||||||
use \DOMDocument;
|
use \DOMDocument;
|
||||||
|
|
||||||
use Icinga\Chart\GridChart;
|
use Icinga\Chart\GridChart;
|
||||||
use Icinga\Test\BaseTestCase;
|
use Icinga\Test\BaseTestCase;
|
||||||
|
|
||||||
|
@ -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 Tests\Icinga\Chart;
|
namespace Tests\Icinga\Chart;
|
||||||
|
|
||||||
use \DOMXPath;
|
use \DOMXPath;
|
||||||
use \DOMDocument;
|
use \DOMDocument;
|
||||||
|
|
||||||
use Icinga\Chart\PieChart;
|
use Icinga\Chart\PieChart;
|
||||||
use Icinga\Test\BaseTestCase;
|
use Icinga\Test\BaseTestCase;
|
||||||
|
|
||||||
|
@ -1,39 +1,15 @@
|
|||||||
<?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 Tests\Icinga\PreservingIniWriterTest;
|
namespace Tests\Icinga\Config;
|
||||||
|
|
||||||
use \Zend_Config;
|
use \Zend_Config;
|
||||||
|
use Icinga\Test\BaseTestCase;
|
||||||
use Icinga\Config\PreservingIniWriter;
|
use Icinga\Config\PreservingIniWriter;
|
||||||
|
|
||||||
class PreservingIniWriterTest extends \PHPUnit_Framework_TestCase {
|
class PreservingIniWriterTest extends BaseTestCase
|
||||||
|
{
|
||||||
private $tmpfiles = array();
|
private $tmpfiles = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,30 +1,5 @@
|
|||||||
<?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 Tests\Icinga\Filter;
|
namespace Tests\Icinga\Filter;
|
||||||
|
@ -1,30 +1,5 @@
|
|||||||
<?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 Tests\Icinga\Filter;
|
namespace Tests\Icinga\Filter;
|
||||||
|
@ -1,30 +1,5 @@
|
|||||||
<?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 Tests\Icinga\Filter;
|
namespace Tests\Icinga\Filter;
|
||||||
@ -48,7 +23,6 @@ class TypeMock extends FilterType
|
|||||||
return $node;
|
return $node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getProposalsForQuery($query)
|
public function getProposalsForQuery($query)
|
||||||
{
|
{
|
||||||
return $this->getOperators();
|
return $this->getOperators();
|
||||||
|
@ -1,30 +1,5 @@
|
|||||||
<?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 Tests\Icinga\Filter;
|
namespace Tests\Icinga\Filter;
|
||||||
|
@ -1,30 +1,5 @@
|
|||||||
<?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 Tests\Icinga\Filter;
|
namespace Tests\Icinga\Filter;
|
||||||
|
@ -1,30 +1,5 @@
|
|||||||
<?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 Tests\Icinga\Filter;
|
namespace Tests\Icinga\Filter;
|
||||||
|
@ -1,36 +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 Tests\Icinga\Protocol\Commandpipe;
|
namespace Tests\Icinga\Protocol\Commandpipe;
|
||||||
|
|
||||||
use \Zend_Config;
|
use \Zend_Config;
|
||||||
use \PHPUnit_Framework_TestCase;
|
use Icinga\Test\BaseTestCase;
|
||||||
use Icinga\Protocol\Commandpipe\Comment;
|
use Icinga\Protocol\Commandpipe\Comment;
|
||||||
use Icinga\Protocol\Commandpipe\CommandPipe;
|
use Icinga\Protocol\Commandpipe\CommandPipe;
|
||||||
use Icinga\Protocol\Commandpipe\PropertyModifier as MONFLAG;
|
use Icinga\Protocol\Commandpipe\PropertyModifier as MONFLAG;
|
||||||
@ -53,7 +28,7 @@ if (!defined('EXTCMD_TEST_BIN')) {
|
|||||||
* Uses the helper script extcmd_test, which is basically the extracted command
|
* Uses the helper script extcmd_test, which is basically the extracted command
|
||||||
* parser functions from the icinga core
|
* parser functions from the icinga core
|
||||||
*/
|
*/
|
||||||
class CommandPipeTest extends PHPUnit_Framework_TestCase
|
class CommandPipeTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Return the path of the test pipe used in these tests
|
* Return the path of the test pipe used in these tests
|
||||||
|
@ -5,8 +5,10 @@
|
|||||||
namespace Tests\Icinga\Protocol\Ldap;
|
namespace Tests\Icinga\Protocol\Ldap;
|
||||||
|
|
||||||
use \Zend_Config;
|
use \Zend_Config;
|
||||||
|
use Icinga\Test\BaseTestCase;
|
||||||
|
use Icinga\Protocol\Ldap\Connection;
|
||||||
|
|
||||||
class QueryTest extends \PHPUnit_Framework_TestCase
|
class QueryTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
private function emptySelect()
|
private function emptySelect()
|
||||||
{
|
{
|
||||||
@ -19,7 +21,7 @@ class QueryTest extends \PHPUnit_Framework_TestCase
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$connection = new \Icinga\Protocol\Ldap\Connection($config);
|
$connection = new Connection($config);
|
||||||
return $connection->select();
|
return $connection->select();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,18 +37,6 @@ class QueryTest extends \PHPUnit_Framework_TestCase
|
|||||||
return $select;
|
return $select;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test for Query::Count() - shall be tested with connection
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
public function testCount()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test for Query::Limit()
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
public function testLimit()
|
public function testLimit()
|
||||||
{
|
{
|
||||||
$select = $this->prepareSelect();
|
$select = $this->prepareSelect();
|
||||||
@ -54,10 +44,6 @@ class QueryTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals(4, $select->getOffset());
|
$this->assertEquals(4, $select->getOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test for Query::HasLimit()
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
public function testHasLimit()
|
public function testHasLimit()
|
||||||
{
|
{
|
||||||
$select = $this->emptySelect();
|
$select = $this->emptySelect();
|
||||||
@ -66,10 +52,6 @@ class QueryTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertTrue($select->hasLimit());
|
$this->assertTrue($select->hasLimit());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test for Query::HasOffset()
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
public function testHasOffset()
|
public function testHasOffset()
|
||||||
{
|
{
|
||||||
$select = $this->emptySelect();
|
$select = $this->emptySelect();
|
||||||
@ -78,99 +60,39 @@ class QueryTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertTrue($select->hasOffset());
|
$this->assertTrue($select->hasOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test for Query::GetLimit()
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
public function testGetLimit()
|
public function testGetLimit()
|
||||||
{
|
{
|
||||||
$select = $this->prepareSelect();
|
$select = $this->prepareSelect();
|
||||||
$this->assertEquals(10, $select->getLimit());
|
$this->assertEquals(10, $select->getLimit());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test for Query::GetOffset()
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
public function testGetOffset()
|
public function testGetOffset()
|
||||||
{
|
{
|
||||||
$select = $this->prepareSelect();
|
$select = $this->prepareSelect();
|
||||||
$this->assertEquals(10, $select->getLimit());
|
$this->assertEquals(10, $select->getLimit());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test for Query::FetchTree()
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
public function testFetchTree()
|
public function testFetchTree()
|
||||||
{
|
{
|
||||||
$this->markTestIncomplete('testFetchTree is not implemented yet - requires real LDAP');
|
$this->markTestIncomplete('testFetchTree is not implemented yet - requires real LDAP');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test for Query::FetchAll() - shall be tested with connection
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
public function testFetchAll()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test for Query::FetchRow() - shall be tested with connection
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
public function testFetchRow()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test for Query::FetchOne()
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
public function testFetchOne()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test for Query::FetchPairs()
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
public function testFetchPairs()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test for Query::From()
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
public function testFrom()
|
public function testFrom()
|
||||||
{
|
{
|
||||||
return $this->testListFields();
|
return $this->testListFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test for Query::Where()
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
public function testWhere()
|
public function testWhere()
|
||||||
{
|
{
|
||||||
$this->markTestIncomplete('testWhere is not implemented yet');
|
$this->markTestIncomplete('testWhere is not implemented yet');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test for Query::Order()
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
public function testOrder()
|
public function testOrder()
|
||||||
{
|
{
|
||||||
$select = $this->emptySelect()->order('bla');
|
$select = $this->emptySelect()->order('bla');
|
||||||
// tested by testGetSortColumns
|
// tested by testGetSortColumns
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test for Query::ListFields()
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
public function testListFields()
|
public function testListFields()
|
||||||
{
|
{
|
||||||
$select = $this->prepareSelect();
|
$select = $this->prepareSelect();
|
||||||
@ -180,10 +102,6 @@ class QueryTest extends \PHPUnit_Framework_TestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test for Query::GetSortColumns()
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
public function testGetSortColumns()
|
public function testGetSortColumns()
|
||||||
{
|
{
|
||||||
$select = $this->prepareSelect();
|
$select = $this->prepareSelect();
|
||||||
@ -191,31 +109,10 @@ class QueryTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals('testIntColumn', $cols[0][0]);
|
$this->assertEquals('testIntColumn', $cols[0][0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test for Query::Paginate() - requires real result
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
public function testPaginate()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test for Query::__toString()
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
public function test__toString()
|
public function test__toString()
|
||||||
{
|
{
|
||||||
$select = $this->prepareSelect();
|
$select = $this->prepareSelect();
|
||||||
$res = '(&(objectClass=dummyClass)(testIntColumn=1)(testStringColumn=test)(testWildcard=abc*))';
|
$res = '(&(objectClass=dummyClass)(testIntColumn=1)(testStringColumn=test)(testWildcard=abc*))';
|
||||||
$this->assertEquals($res, (string) $select);
|
$this->assertEquals($res, (string) $select);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test for Query::__destruct()
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
public function test__destruct()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Tests\Icinga\Protocol\Statusdat;
|
namespace Tests\Icinga\Protocol\Statusdat;
|
||||||
|
|
||||||
use \Zend_Config;
|
use \Zend_Config;
|
||||||
|
use Icinga\Test\BaseTestCase;
|
||||||
use Icinga\Protocol\Statusdat\Reader;
|
use Icinga\Protocol\Statusdat\Reader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a high level test for the whole statusdat component, i.e. all parts put together
|
* This is a high level test for the whole statusdat component, i.e. all parts put together
|
||||||
* and called like they would be in a real situation. This should work when all isolated tests have passed.
|
* and called like they would be in a real situation. This should work when all isolated tests have passed.
|
||||||
*/
|
*/
|
||||||
class StatusdatComponentTest extends \PHPUnit_Framework_TestCase
|
class StatusdatComponentTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
public function getReader() {
|
public function getReader() {
|
||||||
$reader = new Reader(new Zend_Config(array(
|
$reader = new Reader(new Zend_Config(array(
|
||||||
@ -53,7 +56,7 @@ class StatusdatComponentTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testHostgroupFilterFromService() {
|
public function testHostgroupFilterFromService() {
|
||||||
$r = $this->getReader();
|
$r = $this->getReader();
|
||||||
$group = array(array('exc-hostb'));
|
$group = array(array('exc-hostb'));
|
||||||
$result = $r->select()->from("services")->where("host.group IN ?",$group)->getResult();
|
$result = $r->select()->from("services")->where("host.group IN ?", $group)->getResult();
|
||||||
|
|
||||||
$this->assertCount(9, $result);
|
$this->assertCount(9, $result);
|
||||||
foreach($result as $obj) {
|
foreach($result as $obj) {
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Icinga\Protocol\Statusdat\Exceptions;
|
namespace Icinga\Protocol\Statusdat\Exceptions;
|
||||||
|
|
||||||
class ParsingException extends RuntimeException
|
class ParsingException extends RuntimeException
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Tests\Icinga\Protocol\Statusdat;
|
namespace Tests\Icinga\Protocol\Statusdat;
|
||||||
|
|
||||||
|
use Icinga\Test\BaseTestCase;
|
||||||
use Icinga\Protocol\Statusdat\Parser;
|
use Icinga\Protocol\Statusdat\Parser;
|
||||||
|
|
||||||
class ParserTest extends \PHPUnit_Framework_TestCase
|
class ParserTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
private function getStringAsFileHandle($string)
|
private function getStringAsFileHandle($string)
|
||||||
{
|
{
|
||||||
$maxsize = strlen($string)*2;
|
|
||||||
$fhandle = fopen("php://memory", 'r+');
|
$fhandle = fopen("php://memory", 'r+');
|
||||||
fputs($fhandle,$string);
|
fputs($fhandle, $string);
|
||||||
rewind($fhandle);
|
rewind($fhandle);
|
||||||
return $fhandle;
|
return $fhandle;
|
||||||
}
|
}
|
||||||
@ -136,7 +138,6 @@ define servicegroup {
|
|||||||
*/
|
*/
|
||||||
public function testRuntimeParsingForBigFile()
|
public function testRuntimeParsingForBigFile()
|
||||||
{
|
{
|
||||||
//$this->markTestSkipped('Skipped slow tests');
|
|
||||||
$objects = fopen("./res/status/icinga.objects.cache","r");
|
$objects = fopen("./res/status/icinga.objects.cache","r");
|
||||||
$status = fopen("./res/status/icinga.status.dat","r");
|
$status = fopen("./res/status/icinga.status.dat","r");
|
||||||
$testParser = new Parser($objects);
|
$testParser = new Parser($objects);
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Tests\Icinga\Protocol\Statusdat\Query;
|
namespace Tests\Icinga\Protocol\Statusdat\Query;
|
||||||
|
|
||||||
|
use Icinga\Test\BaseTestCase;
|
||||||
use Icinga\Protocol\Statusdat\Query\Expression;
|
use Icinga\Protocol\Statusdat\Query\Expression;
|
||||||
|
|
||||||
class ExpressionTest extends \PHPUnit_Framework_TestCase
|
class ExpressionTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
public function testFromStringParsing()
|
public function testFromStringParsing()
|
||||||
{
|
{
|
||||||
@ -133,5 +136,4 @@ class ExpressionTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$this->markTestIncomplete('testFilter is not implemented yet');
|
$this->markTestIncomplete('testFilter is not implemented yet');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Tests\Icinga\Protocol\Statusdat\Query;
|
namespace Tests\Icinga\Protocol\Statusdat\Query;
|
||||||
|
|
||||||
use Icinga\Protocol\Statusdat;
|
use Icinga\Test\BaseTestCase;
|
||||||
|
use Icinga\Protocol\Statusdat\Query\Group;
|
||||||
use Icinga\Protocol\Statusdat\Query\IQueryPart;
|
use Icinga\Protocol\Statusdat\Query\IQueryPart;
|
||||||
|
|
||||||
class QueryExpressionMock implements IQueryPart
|
class QueryExpressionMock implements IQueryPart
|
||||||
@ -34,13 +37,17 @@ class QueryExpressionMock implements IQueryPart
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class GroupTest extends \PHPUnit_Framework_TestCase
|
class GroupTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
public function testParsingSingleCondition()
|
public function testParsingSingleCondition()
|
||||||
{
|
{
|
||||||
$testQuery = new Statusdat\Query\Group();
|
$testQuery = new Group();
|
||||||
$value = array(4);
|
$value = array(4);
|
||||||
$testQuery->fromString("numeric_val >= ?", $value, "Tests\Icinga\Protocol\Statusdat\Query\QueryExpressionMock");
|
$testQuery->fromString(
|
||||||
|
"numeric_val >= ?",
|
||||||
|
$value,
|
||||||
|
"Tests\Icinga\Protocol\Statusdat\Query\QueryExpressionMock"
|
||||||
|
);
|
||||||
$this->assertCount(1, $testQuery->getItems());
|
$this->assertCount(1, $testQuery->getItems());
|
||||||
$this->assertCount(0, $value);
|
$this->assertCount(0, $value);
|
||||||
|
|
||||||
@ -53,9 +60,13 @@ class GroupTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testParsingSimpleAndCondition()
|
public function testParsingSimpleAndCondition()
|
||||||
{
|
{
|
||||||
$testQuery = new Statusdat\Query\Group();
|
$testQuery = new Group();
|
||||||
$value = array(4, 'hosta');
|
$value = array(4, 'hosta');
|
||||||
$testQuery->fromString("numeric_val >= ? AND host_name = ?", $value, "Tests\Icinga\Protocol\Statusdat\Query\QueryExpressionMock");
|
$testQuery->fromString(
|
||||||
|
"numeric_val >= ? AND host_name = ?",
|
||||||
|
$value,
|
||||||
|
"Tests\Icinga\Protocol\Statusdat\Query\QueryExpressionMock"
|
||||||
|
);
|
||||||
$this->assertCount(2, $testQuery->getItems());
|
$this->assertCount(2, $testQuery->getItems());
|
||||||
$this->assertCount(0, $value);
|
$this->assertCount(0, $value);
|
||||||
$this->assertEquals("AND", $testQuery->getType());
|
$this->assertEquals("AND", $testQuery->getType());
|
||||||
@ -72,9 +83,13 @@ class GroupTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testParsingSimpleORCondition()
|
public function testParsingSimpleORCondition()
|
||||||
{
|
{
|
||||||
$testQuery = new Statusdat\Query\Group();
|
$testQuery = new Group();
|
||||||
$value = array(4, 'hosta');
|
$value = array(4, 'hosta');
|
||||||
$testQuery->fromString("numeric_val >= ? OR host_name = ?", $value, "Tests\Icinga\Protocol\Statusdat\Query\QueryExpressionMock");
|
$testQuery->fromString(
|
||||||
|
"numeric_val >= ? OR host_name = ?",
|
||||||
|
$value,
|
||||||
|
"Tests\Icinga\Protocol\Statusdat\Query\QueryExpressionMock"
|
||||||
|
);
|
||||||
$this->assertCount(2, $testQuery->getItems());
|
$this->assertCount(2, $testQuery->getItems());
|
||||||
$this->assertCount(0, $value);
|
$this->assertCount(0, $value);
|
||||||
$this->assertEquals("OR", $testQuery->getType());
|
$this->assertEquals("OR", $testQuery->getType());
|
||||||
@ -91,9 +106,13 @@ class GroupTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testParsingExplicitSubgroup()
|
public function testParsingExplicitSubgroup()
|
||||||
{
|
{
|
||||||
$testQuery = new Statusdat\Query\Group();
|
$testQuery = new Group();
|
||||||
$value = array(4, 'service1', 'hosta');
|
$value = array(4, 'service1', 'hosta');
|
||||||
$testQuery->fromString("numeric_val >= ? AND (service_description = ? OR host_name = ?)", $value, "Tests\Icinga\Protocol\Statusdat\Query\QueryExpressionMock");
|
$testQuery->fromString(
|
||||||
|
"numeric_val >= ? AND (service_description = ? OR host_name = ?)",
|
||||||
|
$value,
|
||||||
|
"Tests\Icinga\Protocol\Statusdat\Query\QueryExpressionMock"
|
||||||
|
);
|
||||||
$this->assertCount(2, $testQuery->getItems());
|
$this->assertCount(2, $testQuery->getItems());
|
||||||
$this->assertCount(0, $value);
|
$this->assertCount(0, $value);
|
||||||
$this->assertEquals("AND", $testQuery->getType());
|
$this->assertEquals("AND", $testQuery->getType());
|
||||||
@ -119,9 +138,13 @@ class GroupTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testParsingImplicitSubgroup()
|
public function testParsingImplicitSubgroup()
|
||||||
{
|
{
|
||||||
$testQuery = new Statusdat\Query\Group();
|
$testQuery = new Group();
|
||||||
$value = array(4, 'service1', 'hosta');
|
$value = array(4, 'service1', 'hosta');
|
||||||
$testQuery->fromString("numeric_val >= ? AND service_description = ? OR host_name = ?", $value, "Tests\Icinga\Protocol\Statusdat\Query\QueryExpressionMock");
|
$testQuery->fromString(
|
||||||
|
"numeric_val >= ? AND service_description = ? OR host_name = ?",
|
||||||
|
$value,
|
||||||
|
"Tests\Icinga\Protocol\Statusdat\Query\QueryExpressionMock"
|
||||||
|
);
|
||||||
$this->assertCount(2, $testQuery->getItems());
|
$this->assertCount(2, $testQuery->getItems());
|
||||||
$this->assertCount(0, $value);
|
$this->assertCount(0, $value);
|
||||||
$this->assertEquals("AND", $testQuery->getType());
|
$this->assertEquals("AND", $testQuery->getType());
|
||||||
@ -147,35 +170,41 @@ class GroupTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testAndFilter()
|
public function testAndFilter()
|
||||||
{
|
{
|
||||||
$testQuery = new Statusdat\Query\Group();
|
$testQuery = new Group();
|
||||||
$testQuery->setType(Statusdat\Query\Group::TYPE_AND);
|
$testQuery->setType(Group::TYPE_AND);
|
||||||
$exp1 = new QueryExpressionMock();
|
$exp1 = new QueryExpressionMock();
|
||||||
$exp1->filter = array(1, 2, 3, 4, 5, 6, 8);
|
$exp1->filter = array(1, 2, 3, 4, 5, 6, 8);
|
||||||
$exp2 = new QueryExpressionMock();
|
$exp2 = new QueryExpressionMock();
|
||||||
$exp2->filter = array(3, 4, 8);
|
$exp2->filter = array(3, 4, 8);
|
||||||
$base = array(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
$base = array(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||||
|
|
||||||
$this->assertEquals(array(3, 4, 8), array_values($testQuery->addItem($exp1)->addItem($exp2)->filter($base)));
|
$this->assertEquals(
|
||||||
|
array(3, 4, 8),
|
||||||
|
array_values($testQuery->addItem($exp1)->addItem($exp2)->filter($base))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testOrFilter()
|
public function testOrFilter()
|
||||||
{
|
{
|
||||||
$testQuery = new Statusdat\Query\Group();
|
$testQuery = new Group();
|
||||||
$testQuery->setType(Statusdat\Query\Group::TYPE_OR);
|
$testQuery->setType(Group::TYPE_OR);
|
||||||
$exp1 = new QueryExpressionMock();
|
$exp1 = new QueryExpressionMock();
|
||||||
$exp1->filter = array(1, 2, 3);
|
$exp1->filter = array(1, 2, 3);
|
||||||
$exp2 = new QueryExpressionMock();
|
$exp2 = new QueryExpressionMock();
|
||||||
$exp2->filter = array(3, 4, 6, 8);
|
$exp2->filter = array(3, 4, 6, 8);
|
||||||
$base = array(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
$base = array(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||||
$this->assertEquals(array(1, 2, 3, 4, 6, 8), array_values($testQuery->addItem($exp1)->addItem($exp2)->filter($base)));
|
$this->assertEquals(
|
||||||
|
array(1, 2, 3, 4, 6, 8),
|
||||||
|
array_values($testQuery->addItem($exp1)->addItem($exp2)->filter($base))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCombinedFilter()
|
public function testCombinedFilter()
|
||||||
{
|
{
|
||||||
$testQuery_and = new Statusdat\Query\Group();
|
$testQuery_and = new Group();
|
||||||
$testQuery_and->setType(Statusdat\Query\Group::TYPE_AND);
|
$testQuery_and->setType(Group::TYPE_AND);
|
||||||
$testQuery_or = new Statusdat\Query\Group();
|
$testQuery_or = new Group();
|
||||||
$testQuery_or->setType(Statusdat\Query\Group::TYPE_OR);
|
$testQuery_or->setType(Group::TYPE_OR);
|
||||||
$base = array(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
$base = array(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||||
|
|
||||||
$and_exp1 = new QueryExpressionMock();
|
$and_exp1 = new QueryExpressionMock();
|
||||||
@ -196,4 +225,3 @@ class GroupTest extends \PHPUnit_Framework_TestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Tests\Icinga\Protocol\Statusdat;
|
namespace Tests\Icinga\Protocol\Statusdat;
|
||||||
|
|
||||||
|
use Icinga\Test\BaseTestCase;
|
||||||
use Icinga\Protocol\Statusdat\Query;
|
use Icinga\Protocol\Statusdat\Query;
|
||||||
|
|
||||||
class QueryTest extends \PHPUnit_Framework_TestCase
|
class QueryTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
public function testSimpleServiceSelect()
|
public function testSimpleServiceSelect()
|
||||||
{
|
{
|
||||||
@ -122,6 +125,7 @@ class QueryTest extends \PHPUnit_Framework_TestCase
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
return $readerMock;
|
return $readerMock;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Tests\Icinga\Protocol\Statusdat;
|
namespace Tests\Icinga\Protocol\Statusdat;
|
||||||
|
|
||||||
use Icinga\Data\DatasourceInterface;
|
use Icinga\Data\DatasourceInterface;
|
||||||
@ -21,7 +24,6 @@ class ReaderMock implements IReader, DatasourceInterface
|
|||||||
|
|
||||||
public function getInternalState()
|
public function getInternalState()
|
||||||
{
|
{
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
"objects" => $this->objects,
|
"objects" => $this->objects,
|
||||||
"indices" => $this->indices
|
"indices" => $this->indices
|
||||||
@ -33,7 +35,7 @@ class ReaderMock implements IReader, DatasourceInterface
|
|||||||
return $this->objects;
|
return $this->objects;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __call($arg1,$arg2) {
|
public function __call($arg1, $arg2) {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,9 +46,9 @@ class ReaderMock implements IReader, DatasourceInterface
|
|||||||
|
|
||||||
public function getObjectByName($type, $idx)
|
public function getObjectByName($type, $idx)
|
||||||
{
|
{
|
||||||
if (isset($this->objects[$type]) && isset($this->objects[$type][$idx]))
|
if (isset($this->objects[$type]) && isset($this->objects[$type][$idx])) {
|
||||||
return $this->objects[$type][$idx];
|
return $this->objects[$type][$idx];
|
||||||
return null;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Tests\Icinga\Protocol\Statusdat;
|
namespace Tests\Icinga\Protocol\Statusdat;
|
||||||
|
|
||||||
|
use Icinga\Test\BaseTestCase;
|
||||||
use Icinga\Protocol\Statusdat\Reader;
|
use Icinga\Protocol\Statusdat\Reader;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Test class for Reader
|
|
||||||
* Created Wed, 16 Jan 2013 15:15:16 +0000
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
class ConfigMock
|
class ConfigMock
|
||||||
{
|
{
|
||||||
function __construct($data)
|
function __construct($data)
|
||||||
@ -27,7 +24,6 @@ class ConfigMock
|
|||||||
|
|
||||||
class ParserMock
|
class ParserMock
|
||||||
{
|
{
|
||||||
|
|
||||||
public $runtime = array();
|
public $runtime = array();
|
||||||
public $objects = array();
|
public $objects = array();
|
||||||
|
|
||||||
@ -47,7 +43,7 @@ class ParserMock
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ReaderTest extends \PHPUnit_Framework_TestCase
|
class ReaderTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
protected function tearDown()
|
protected function tearDown()
|
||||||
{
|
{
|
||||||
@ -86,7 +82,6 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testEmptyFileException()
|
public function testEmptyFileException()
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->setExpectedException("Icinga\Exception\ConfigurationError");
|
$this->setExpectedException("Icinga\Exception\ConfigurationError");
|
||||||
$parser = new ParserMock();
|
$parser = new ParserMock();
|
||||||
$reader = new Reader(new ConfigMock(array(
|
$reader = new Reader(new ConfigMock(array(
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Tests\Icinga\Protocol\Statusdat;
|
namespace Tests\Icinga\Protocol\Statusdat;
|
||||||
|
|
||||||
class RuntimestatecontainerTest extends \PHPUnit_Framework_TestCase
|
use Icinga\Test\BaseTestCase;
|
||||||
|
use Icinga\Protocol\Statusdat\RuntimeStateContainer;
|
||||||
|
|
||||||
|
class RuntimestatecontainerTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Test for RuntimeStateContainer::__get()
|
|
||||||
**/
|
|
||||||
public function testPropertyResolving()
|
public function testPropertyResolving()
|
||||||
{
|
{
|
||||||
$container = new \Icinga\Protocol\Statusdat\RuntimeStateContainer("
|
$container = new RuntimeStateContainer("
|
||||||
host_name=test host
|
host_name=test host
|
||||||
current_state=0
|
current_state=0
|
||||||
plugin_output=test 1234 test test
|
plugin_output=test 1234 test test
|
||||||
|
@ -1,30 +1,5 @@
|
|||||||
<?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 Tests\Icinga\Session;
|
namespace Tests\Icinga\Session;
|
||||||
|
@ -1,30 +1,5 @@
|
|||||||
<?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 Tests\Icinga\Session;
|
namespace Tests\Icinga\Session;
|
||||||
@ -33,7 +8,6 @@ use \Exception;
|
|||||||
use Icinga\Test\BaseTestCase;
|
use Icinga\Test\BaseTestCase;
|
||||||
use Icinga\Web\Session\SessionNamespace;
|
use Icinga\Web\Session\SessionNamespace;
|
||||||
|
|
||||||
|
|
||||||
class SessionNamespaceTest extends BaseTestCase
|
class SessionNamespaceTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -1,30 +1,5 @@
|
|||||||
<?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 Tests\Icinga\Test;
|
namespace Tests\Icinga\Test;
|
||||||
@ -42,16 +17,6 @@ class BaseTestCaseDbTest extends BaseTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testExistingTestDirectories()
|
|
||||||
{
|
|
||||||
$this->assertFileExists(self::$appDir);
|
|
||||||
$this->assertFileExists(self::$libDir);
|
|
||||||
$this->assertFileExists(self::$etcDir);
|
|
||||||
$this->assertFileExists(self::$testDir);
|
|
||||||
$this->assertFileExists(self::$moduleDir);
|
|
||||||
// $this->assertFileExists(self::$shareDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider mysqlDb
|
* @dataProvider mysqlDb
|
||||||
*/
|
*/
|
||||||
@ -67,7 +32,6 @@ class BaseTestCaseDbTest extends BaseTestCase
|
|||||||
public function testMySqlCreateTablePart1($resource)
|
public function testMySqlCreateTablePart1($resource)
|
||||||
{
|
{
|
||||||
$this->setupDbProvider($resource);
|
$this->setupDbProvider($resource);
|
||||||
/** @var \Zend_Db_Adapter_Pdo_Abstract $resource **/
|
|
||||||
$resource->exec('CREATE TABLE test(uid INT NOT NULL PRIMARY KEY);');
|
$resource->exec('CREATE TABLE test(uid INT NOT NULL PRIMARY KEY);');
|
||||||
|
|
||||||
$tables = $resource->listTables();
|
$tables = $resource->listTables();
|
||||||
|
@ -1,32 +1,31 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Tests\Icinga;
|
namespace Tests\Icinga;
|
||||||
|
|
||||||
use \DateTimeZone;
|
use \DateTimeZone;
|
||||||
use Icinga\User as IcingaUser;
|
use Icinga\User;
|
||||||
use Icinga\User\Preferences as UserPreferences;
|
use Icinga\User\Preferences;
|
||||||
|
use Icinga\Test\BaseTestCase;
|
||||||
|
|
||||||
class UserTest extends \PHPUnit_Framework_TestCase
|
class UserTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
public function testGetDefaultTimezoneIfTimezoneNotSet()
|
public function testGetDefaultTimezoneIfTimezoneNotSet()
|
||||||
{
|
{
|
||||||
$defaultTz = 'UTC';
|
$user = new User('unittest');
|
||||||
date_default_timezone_set($defaultTz);
|
$prefs = new Preferences(array());
|
||||||
$user = new IcingaUser('unittest');
|
|
||||||
$prefs = new UserPreferences(array());
|
|
||||||
$user->setPreferences($prefs);
|
$user->setPreferences($prefs);
|
||||||
$this->assertEquals($user->getTimeZone(), new DateTimeZone($defaultTz),
|
$this->assertEquals($user->getTimeZone(), new DateTimeZone(date_default_timezone_get()),
|
||||||
'User\'s timezone does not match the default timezone'
|
'User\'s timezone does not match the default timezone'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetTimezoneIfTimezoneSet()
|
public function testGetTimezoneIfTimezoneSet()
|
||||||
{
|
{
|
||||||
$defaultTz = 'UTC';
|
|
||||||
$explicitTz = 'Europe/Berlin';
|
$explicitTz = 'Europe/Berlin';
|
||||||
date_default_timezone_set($defaultTz);
|
$user = new User('unittest');
|
||||||
$user = new IcingaUser('unittest');
|
$prefs = new Preferences(array(
|
||||||
$prefs = new UserPreferences(array(
|
|
||||||
'timezone' => $explicitTz
|
'timezone' => $explicitTz
|
||||||
));
|
));
|
||||||
$user->setPreferences($prefs);
|
$user->setPreferences($prefs);
|
||||||
|
@ -1,19 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Tests\Icinga\Util;
|
namespace Tests\Icinga\Util;
|
||||||
|
|
||||||
use Icinga\Util\Dimension;
|
use Icinga\Util\Dimension;
|
||||||
|
use Icinga\Test\BaseTestCase;
|
||||||
|
|
||||||
/**
|
class DimensionTest extends BaseTestCase
|
||||||
* Tests for the dimension class
|
{
|
||||||
*
|
|
||||||
*/
|
|
||||||
class DimensionTest extends \PHPUnit_Framework_TestCase {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test Dimension creation from string
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function testStringFactoryWithValidInput()
|
public function testStringFactoryWithValidInput()
|
||||||
{
|
{
|
||||||
$d = Dimension::fromString("200px");
|
$d = Dimension::fromString("200px");
|
||||||
@ -33,10 +28,6 @@ class DimensionTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$this->assertEquals(Dimension::UNIT_PT, $d->getUnit(), "Asserting the unit of pt input to be correctly parsed");
|
$this->assertEquals(Dimension::UNIT_PT, $d->getUnit(), "Asserting the unit of pt input to be correctly parsed");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test string creation from Dimension
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function testStringCreation()
|
public function testStringCreation()
|
||||||
{
|
{
|
||||||
$d = new Dimension(1000, Dimension::UNIT_PX);
|
$d = new Dimension(1000, Dimension::UNIT_PX);
|
||||||
@ -46,9 +37,6 @@ class DimensionTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$this->assertEquals("40pt", (string) $d, "Asserting float values being truncated by now");
|
$this->assertEquals("40pt", (string) $d, "Asserting float values being truncated by now");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function testInvalidDimensions()
|
public function testInvalidDimensions()
|
||||||
{
|
{
|
||||||
$d = new Dimension(-20, Dimension::UNIT_PX);
|
$d = new Dimension(-20, Dimension::UNIT_PX);
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Tests\Icinga\Web\Form\Element;
|
namespace Tests\Icinga\Web\Form\Element;
|
||||||
|
|
||||||
|
@ -1,40 +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 Tests\Icinga\Web\Form\Validator;
|
namespace Tests\Icinga\Web\Form\Validator;
|
||||||
|
|
||||||
use \PHPUnit_Framework_TestCase;
|
use Icinga\Test\BaseTestCase;
|
||||||
use Icinga\Web\Form\Validator\DateFormatValidator;
|
use Icinga\Web\Form\Validator\DateFormatValidator;
|
||||||
|
|
||||||
class DateFormatValidatorTest extends PHPUnit_Framework_TestCase
|
class DateFormatValidatorTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function testValidateCorrectInput()
|
public function testValidateCorrectInput()
|
||||||
{
|
{
|
||||||
$validator = new DateFormatValidator();
|
$validator = new DateFormatValidator();
|
||||||
|
@ -1,38 +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 Tests\Icinga\Web\Form\Validator;
|
namespace Tests\Icinga\Web\Form\Validator;
|
||||||
|
|
||||||
use \PHPUnit_Framework_TestCase;
|
use Icinga\Test\BaseTestCase;
|
||||||
use Icinga\Web\Form\Validator\TimeFormatValidator;
|
use Icinga\Web\Form\Validator\TimeFormatValidator;
|
||||||
|
|
||||||
class TimeFormatValidatorTest extends PHPUnit_Framework_TestCase
|
class TimeFormatValidatorTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
public function testValidateCorrectInput()
|
public function testValidateCorrectInput()
|
||||||
{
|
{
|
||||||
|
@ -1,38 +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 Tests\Icinga\Web\Form\Validator;
|
namespace Tests\Icinga\Web\Form\Validator;
|
||||||
|
|
||||||
use \PHPUnit_Framework_TestCase;
|
use Icinga\Test\BaseTestCase;
|
||||||
use Icinga\Web\Form\Validator\WritablePathValidator;
|
use Icinga\Web\Form\Validator\WritablePathValidator;
|
||||||
|
|
||||||
class WritablePathValidatorTest extends PHPUnit_Framework_TestCase
|
class WritablePathValidatorTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
public function testValidateInputWithWritablePath()
|
public function testValidateInputWithWritablePath()
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Tests\Icinga\Web;
|
namespace Tests\Icinga\Web;
|
||||||
|
|
||||||
use Icinga\Web\Form;
|
use Icinga\Web\Form;
|
||||||
use \Zend_Test_PHPUnit_ControllerTestCase;
|
use Icinga\Test\BaseTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dummy extension class as Icinga\Web\Form is an abstract one
|
* Dummy extension class as Icinga\Web\Form is an abstract one
|
||||||
@ -12,14 +14,13 @@ class TestForm extends Form
|
|||||||
{
|
{
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
// pass
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for the Icinga\Web\Form class (Base class for all other forms)
|
* Tests for the Icinga\Web\Form class (Base class for all other forms)
|
||||||
*/
|
*/
|
||||||
class FormTest extends Zend_Test_PHPUnit_ControllerTestCase
|
class FormTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Tests whether the cancel label will be added to the form
|
* Tests whether the cancel label will be added to the form
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Tests\Icinga\Web\Hook\Configuration;
|
namespace Tests\Icinga\Web\Hook\Configuration;
|
||||||
|
|
||||||
|
use Icinga\Test\BaseTestCase;
|
||||||
use Icinga\Web\Hook\Configuration\ConfigurationTab;
|
use Icinga\Web\Hook\Configuration\ConfigurationTab;
|
||||||
|
use Icinga\Web\Hook\Configuration\ConfigurationTabBuilder;
|
||||||
use Icinga\Web\Hook;
|
use Icinga\Web\Hook;
|
||||||
use Icinga\Web\Url;
|
use Icinga\Web\Url;
|
||||||
use Icinga\Web\Widget\Tabs;
|
use Icinga\Web\Widget\Tabs;
|
||||||
@ -16,7 +20,7 @@ class RequestMock
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ConfigurationTabBuilderTest extends \PHPUnit_Framework_TestCase
|
class ConfigurationTabBuilderTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
@ -35,7 +39,7 @@ class ConfigurationTabBuilderTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testDefaultTabs()
|
public function testDefaultTabs()
|
||||||
{
|
{
|
||||||
$widget = new Tabs();
|
$widget = new Tabs();
|
||||||
$builder = new Hook\Configuration\ConfigurationTabBuilder($widget);
|
$builder = new ConfigurationTabBuilder($widget);
|
||||||
|
|
||||||
$array = $builder->build();
|
$array = $builder->build();
|
||||||
$tabs = $builder->getTabs();
|
$tabs = $builder->getTabs();
|
||||||
@ -46,15 +50,15 @@ class ConfigurationTabBuilderTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testTabCreation1()
|
public function testTabCreation1()
|
||||||
{
|
{
|
||||||
$widget = new Tabs();
|
$widget = new Tabs();
|
||||||
$builder = new Hook\Configuration\ConfigurationTabBuilder($widget);
|
$builder = new ConfigurationTabBuilder($widget);
|
||||||
|
|
||||||
$tab1 = new ConfigurationTab('test1', '/test1', 'TEST1');
|
$tab1 = new ConfigurationTab('test1', '/test1', 'TEST1');
|
||||||
$tab2 = new ConfigurationTab('test2', '/test2', 'TEST2');
|
$tab2 = new ConfigurationTab('test2', '/test2', 'TEST2');
|
||||||
$tab3 = new ConfigurationTab('test3', '/test3', 'TEST3');
|
$tab3 = new ConfigurationTab('test3', '/test3', 'TEST3');
|
||||||
|
|
||||||
Hook::registerObject(Hook\Configuration\ConfigurationTabBuilder::HOOK_NAMESPACE, 'test1', $tab1);
|
Hook::registerObject(ConfigurationTabBuilder::HOOK_NAMESPACE, 'test1', $tab1);
|
||||||
Hook::registerObject(Hook\Configuration\ConfigurationTabBuilder::HOOK_NAMESPACE, 'test2', $tab2);
|
Hook::registerObject(ConfigurationTabBuilder::HOOK_NAMESPACE, 'test2', $tab2);
|
||||||
Hook::registerObject(Hook\Configuration\ConfigurationTabBuilder::HOOK_NAMESPACE, 'test3', $tab3);
|
Hook::registerObject(ConfigurationTabBuilder::HOOK_NAMESPACE, 'test3', $tab3);
|
||||||
|
|
||||||
$builder->build();
|
$builder->build();
|
||||||
|
|
||||||
@ -68,10 +72,10 @@ class ConfigurationTabBuilderTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testTabCreation2()
|
public function testTabCreation2()
|
||||||
{
|
{
|
||||||
$widget = new Tabs();
|
$widget = new Tabs();
|
||||||
$builder = new Hook\Configuration\ConfigurationTabBuilder($widget);
|
$builder = new ConfigurationTabBuilder($widget);
|
||||||
|
|
||||||
$tab = new \stdClass();
|
$tab = new \stdClass();
|
||||||
Hook::registerObject(Hook\Configuration\ConfigurationTabBuilder::HOOK_NAMESPACE, 'misc', $tab);
|
Hook::registerObject(ConfigurationTabBuilder::HOOK_NAMESPACE, 'misc', $tab);
|
||||||
$builder->build();
|
$builder->build();
|
||||||
|
|
||||||
$this->assertCount(5, $builder->getTabs());
|
$this->assertCount(5, $builder->getTabs());
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Tests\Icinga\Web\Hook\Configuration;
|
namespace Tests\Icinga\Web\Hook\Configuration;
|
||||||
|
|
||||||
|
use Icinga\Test\BaseTestCase;
|
||||||
use Icinga\Web\Hook\Configuration\ConfigurationTab;
|
use Icinga\Web\Hook\Configuration\ConfigurationTab;
|
||||||
|
|
||||||
class ConfigurationTabTest extends \PHPUnit_Framework_TestCase
|
class ConfigurationTabTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
public function testCreate1()
|
public function testCreate1()
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Tests\Icinga\Web;
|
namespace Tests\Icinga\Web;
|
||||||
|
|
||||||
use Icinga\Web\Hook;
|
use Icinga\Web\Hook;
|
||||||
|
use Icinga\Test\BaseTestCase;
|
||||||
|
|
||||||
class Base
|
class Base
|
||||||
{
|
{
|
||||||
@ -28,17 +31,11 @@ class ObjectHookImplementation
|
|||||||
{
|
{
|
||||||
private $test;
|
private $test;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param mixed $test
|
|
||||||
*/
|
|
||||||
public function setTest($test)
|
public function setTest($test)
|
||||||
{
|
{
|
||||||
$this->test = $test;
|
$this->test = $test;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getTest()
|
public function getTest()
|
||||||
{
|
{
|
||||||
return $this->test;
|
return $this->test;
|
||||||
@ -50,7 +47,7 @@ class ObjectHookImplementation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class HookTest extends \PHPUnit_Framework_TestCase
|
class HookTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
@ -64,11 +61,6 @@ class HookTest extends \PHPUnit_Framework_TestCase
|
|||||||
Hook::clean();
|
Hook::clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test for Hook::Has()
|
|
||||||
* Note: This method is static!
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
public function testHas()
|
public function testHas()
|
||||||
{
|
{
|
||||||
$this->assertFalse(Hook::has("a"));
|
$this->assertFalse(Hook::has("a"));
|
||||||
@ -79,11 +71,6 @@ class HookTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertTrue(Hook::has("a","b"));
|
$this->assertTrue(Hook::has("a","b"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test for Hook::CreateInstance()
|
|
||||||
* Note: This method is static!
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
public function testCreateInstance()
|
public function testCreateInstance()
|
||||||
{
|
{
|
||||||
Hook::$BASE_NS = "Tests\\Icinga\\Web\\";
|
Hook::$BASE_NS = "Tests\\Icinga\\Web\\";
|
||||||
@ -92,12 +79,6 @@ class HookTest extends \PHPUnit_Framework_TestCase
|
|||||||
Hook::clean();
|
Hook::clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test for Hook::CreateInstance()
|
|
||||||
* Note: This method is static!
|
|
||||||
*
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
public function testCreateInvalidInstance1()
|
public function testCreateInvalidInstance1()
|
||||||
{
|
{
|
||||||
$this->setExpectedException('\Icinga\Exception\ProgrammingError');
|
$this->setExpectedException('\Icinga\Exception\ProgrammingError');
|
||||||
@ -122,11 +103,6 @@ class HookTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertNull($test);
|
$this->assertNull($test);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test for Hook::All()
|
|
||||||
* Note: This method is static!
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
public function testAll()
|
public function testAll()
|
||||||
{
|
{
|
||||||
Hook::$BASE_NS = "Tests\\Icinga\\Web\\";
|
Hook::$BASE_NS = "Tests\\Icinga\\Web\\";
|
||||||
@ -137,14 +113,8 @@ class HookTest extends \PHPUnit_Framework_TestCase
|
|||||||
foreach(Hook::all("Base") as $instance) {
|
foreach(Hook::all("Base") as $instance) {
|
||||||
$this->assertInstanceOf("Tests\\Icinga\\Web\\TestHookImplementation",$instance);
|
$this->assertInstanceOf("Tests\\Icinga\\Web\\TestHookImplementation",$instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test for Hook::First()
|
|
||||||
* Note: This method is static!
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
public function testFirst()
|
public function testFirst()
|
||||||
{
|
{
|
||||||
Hook::$BASE_NS = "Tests\\Icinga\\Web\\";
|
Hook::$BASE_NS = "Tests\\Icinga\\Web\\";
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Tests\Icinga\Web;
|
namespace Tests\Icinga\Web;
|
||||||
|
|
||||||
|
use \Zend_Session;
|
||||||
|
use Icinga\Test\BaseTestCase;
|
||||||
use Icinga\Logger\Logger;
|
use Icinga\Logger\Logger;
|
||||||
use Icinga\Web\Notification;
|
use Icinga\Web\Notification;
|
||||||
|
|
||||||
class NotificationTest extends \PHPUnit_Framework_TestCase
|
class NotificationTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var Logger
|
* @var Logger
|
||||||
@ -19,7 +23,7 @@ class NotificationTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
\Zend_Session::$_unitTestEnabled = true;
|
Zend_Session::$_unitTestEnabled = true;
|
||||||
|
|
||||||
$this->loggerPath = "/tmp/icinga2-web-notify-test";
|
$this->loggerPath = "/tmp/icinga2-web-notify-test";
|
||||||
$this->dropLog();
|
$this->dropLog();
|
||||||
@ -34,8 +38,6 @@ class NotificationTest extends \PHPUnit_Framework_TestCase
|
|||||||
));
|
));
|
||||||
|
|
||||||
$this->logger = new Logger($logConfig);
|
$this->logger = new Logger($logConfig);
|
||||||
|
|
||||||
// $this->notification = Notification::getInstance();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function dropLog()
|
protected function dropLog()
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Tests\Icinga\Web\Paginator\Adapter;
|
namespace Tests\Icinga\Web\Paginator\Adapter;
|
||||||
|
|
||||||
use \Zend_Config;
|
use \Zend_Config;
|
||||||
use \PHPUnit_Framework_TestCase;
|
use Icinga\Test\BaseTestCase;
|
||||||
use Icinga\Protocol\Statusdat\Reader;
|
use Icinga\Protocol\Statusdat\Reader;
|
||||||
use Icinga\Module\Monitoring\Backend;
|
use Icinga\Module\Monitoring\Backend;
|
||||||
use Icinga\Web\Paginator\Adapter\QueryAdapter;
|
use Icinga\Web\Paginator\Adapter\QueryAdapter;
|
||||||
|
|
||||||
class QueryAdapterTest extends PHPUnit_Framework_TestCase
|
class QueryAdapterTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
private $cacheDir;
|
private $cacheDir;
|
||||||
|
|
||||||
@ -24,8 +26,8 @@ class QueryAdapterTest extends PHPUnit_Framework_TestCase
|
|||||||
mkdir($this->cacheDir);
|
mkdir($this->cacheDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
$statusdatFile = dirname(__FILE__) . '/../../../../../res/status/icinga.status.dat';
|
$statusdatFile = BaseTestCase::$testDir . '/res/status/icinga.status.dat';
|
||||||
$cacheFile = dirname(__FILE__) . '/../../../../../res/status/icinga.objects.cache';
|
$cacheFile = BaseTestCase::$testDir . '/res/status/icinga.objects.cache';
|
||||||
|
|
||||||
$this->backendConfig = new Zend_Config(
|
$this->backendConfig = new Zend_Config(
|
||||||
array(
|
array(
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Tests\Icinga\Web\Paginator\ScrollingStyle;
|
namespace Tests\Icinga\Web\Paginator\ScrollingStyle;
|
||||||
|
|
||||||
@ -8,6 +10,7 @@ require_once realpath(ICINGA_LIBDIR . '/Icinga/Web/Paginator/ScrollingStyle/Slid
|
|||||||
|
|
||||||
use \Zend_Config;
|
use \Zend_Config;
|
||||||
use \Zend_Paginator_Adapter_Interface;
|
use \Zend_Paginator_Adapter_Interface;
|
||||||
|
use Icinga\Test\BaseTestCase;
|
||||||
use Icinga\Protocol\Statusdat\Reader;
|
use Icinga\Protocol\Statusdat\Reader;
|
||||||
use Icinga\Web\Paginator\Adapter\QueryAdapter;
|
use Icinga\Web\Paginator\Adapter\QueryAdapter;
|
||||||
use Icinga\Module\Monitoring\Backend;
|
use Icinga\Module\Monitoring\Backend;
|
||||||
@ -54,7 +57,7 @@ class TestPaginatorAdapter implements Zend_Paginator_Adapter_Interface
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class SlidingwithborderTest extends \PHPUnit_Framework_TestCase
|
class SlidingwithborderTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
private $cacheDir;
|
private $cacheDir;
|
||||||
|
|
||||||
@ -70,8 +73,8 @@ class SlidingwithborderTest extends \PHPUnit_Framework_TestCase
|
|||||||
mkdir($this->cacheDir);
|
mkdir($this->cacheDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
$statusdatFile = dirname(__FILE__). '/../../../../../res/status/icinga.status.dat';
|
$statusdatFile = BaseTestCase::$testDir . '/res/status/icinga.status.dat';
|
||||||
$cacheFile = dirname(__FILE__). '/../../../../../res/status/icinga.objects.cache';
|
$cacheFile = BaseTestCase::$testDir . '/res/status/icinga.objects.cache';
|
||||||
|
|
||||||
$this->backendConfig = new Zend_Config(
|
$this->backendConfig = new Zend_Config(
|
||||||
array(
|
array(
|
||||||
|
@ -1,38 +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 Tests\Icinga\Web;
|
namespace Tests\Icinga\Web;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request mock that implements all methods required by the
|
* Request mock that implements all methods required by the Url class
|
||||||
* Url class
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
class RequestMock
|
class RequestMock
|
||||||
{
|
{
|
||||||
|
@ -1,45 +1,61 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Tests\Icinga\Web;
|
namespace Tests\Icinga\Web;
|
||||||
|
|
||||||
use Icinga\Web\Url;
|
use Icinga\Web\Url;
|
||||||
|
use Icinga\Test\BaseTestCase;
|
||||||
use Tests\Icinga\Web\RequestMock;
|
use Tests\Icinga\Web\RequestMock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for the Icinga\Web\Url class that provides convenient access to Url manipulation method
|
* Tests for the Icinga\Web\Url class that provides convenient access to Url manipulation method
|
||||||
*/
|
*/
|
||||||
class UrlTest extends \PHPUnit_Framework_TestCase
|
class UrlTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Tests whether a simple Url without query parameters and baseUrl is correctly parsed and returns correct Urls
|
* Tests whether a simple Url without query parameters and baseUrl is correctly parsed and returns correct Urls
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function testFromStringWithoutQuery()
|
function testFromStringWithoutQuery()
|
||||||
{
|
{
|
||||||
$url = Url::fromPath('http://myHost/my/test/url.html', array(), new RequestMock());
|
$url = Url::fromPath('http://myHost/my/test/url.html', array(), new RequestMock());
|
||||||
$this->assertEquals('/my/test/url.html', $url->getPath(), 'Assert the parsed url path to be equal to the input path');
|
$this->assertEquals(
|
||||||
$this->assertEquals($url->getPath(), '/'.$url->getRelativeUrl(), 'Assert the path of an url without query to be equal the relative path');
|
'/my/test/url.html',
|
||||||
|
$url->getPath(),
|
||||||
|
'Assert the parsed url path to be equal to the input path'
|
||||||
|
);
|
||||||
|
$this->assertEquals(
|
||||||
|
$url->getPath(),
|
||||||
|
'/' . $url->getRelativeUrl(),
|
||||||
|
'Assert the path of an url without query to be equal the relative path'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests whether a simple Url without query parameters and with baseUrl is correctly parsed and returns correct Urls
|
* Tests whether a simple Url without query parameters and with baseUrl is correctly parsed and returns correct Urls
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function testFromUrlWithBasePath()
|
function testFromUrlWithBasePath()
|
||||||
{
|
{
|
||||||
$url = Url::fromPath('my/test/url.html', array(), new RequestMock());
|
$url = Url::fromPath('my/test/url.html', array(), new RequestMock());
|
||||||
$url->setBaseUrl('the/path/to');
|
$url->setBaseUrl('the/path/to');
|
||||||
$this->assertEquals('/the/path/to/my/test/url.html', $url->getAbsoluteUrl(), 'Assert the url path to be the base path with the relative path');
|
$this->assertEquals(
|
||||||
|
'/the/path/to/my/test/url.html',
|
||||||
|
$url->getAbsoluteUrl(),
|
||||||
|
'Assert the url path to be the base path with the relative path'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests whether query parameters in Urls are correctly recognized and decoded
|
* Tests whether query parameters in Urls are correctly recognized and decoded
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function testFromUrlWithKeyValueQuery()
|
function testFromUrlWithKeyValueQuery()
|
||||||
{
|
{
|
||||||
$url = Url::fromPath('/my/test/url.html?param1=%25arg1¶m2=arg2', array(), new RequestMock());
|
$url = Url::fromPath('/my/test/url.html?param1=%25arg1¶m2=arg2', array(), new RequestMock());
|
||||||
$this->assertEquals('/my/test/url.html', $url->getPath(), 'Assert the parsed url path to be equal to the input path');
|
$this->assertEquals(
|
||||||
|
'/my/test/url.html',
|
||||||
|
$url->getPath(),
|
||||||
|
'Assert the parsed url path to be equal to the input path'
|
||||||
|
);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
array(
|
array(
|
||||||
'param1' => '%arg1',
|
'param1' => '%arg1',
|
||||||
@ -52,7 +68,6 @@ class UrlTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests whether unnamed query parameters in Urls are correctly recognized and decoded
|
* Tests whether unnamed query parameters in Urls are correctly recognized and decoded
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function testFromUrlWithArrayInQuery()
|
function testFromUrlWithArrayInQuery()
|
||||||
{
|
{
|
||||||
@ -68,11 +83,14 @@ class UrlTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests whether named query parameters in Urls are correctly recognized and decoded
|
* Tests whether named query parameters in Urls are correctly recognized and decoded
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function testFromUrlWithAssociativeArrayInQuery()
|
function testFromUrlWithAssociativeArrayInQuery()
|
||||||
{
|
{
|
||||||
$url = Url::fromPath('/my/test/url.html?param[value]=%25val1¶m[value2]=%40val2', array(), new RequestMock());
|
$url = Url::fromPath(
|
||||||
|
'/my/test/url.html?param[value]=%25val1¶m[value2]=%40val2',
|
||||||
|
array(),
|
||||||
|
new RequestMock()
|
||||||
|
);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
array(
|
array(
|
||||||
'param' => array(
|
'param' => array(
|
||||||
@ -87,7 +105,6 @@ class UrlTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests whether simple query parameters can be correctly added on an existing query and ends up in correct Urls
|
* Tests whether simple query parameters can be correctly added on an existing query and ends up in correct Urls
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function testAddQueryParameterToUrlWithoutQuery()
|
function testAddQueryParameterToUrlWithoutQuery()
|
||||||
{
|
{
|
||||||
@ -108,9 +125,8 @@ class UrlTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test whether parameters are correctly added to existing query parameters and existing ones are correctly overwritten
|
* Test whether parameters are correctly added to existing query parameters
|
||||||
* if they have the same key
|
* and existing ones are correctly overwritten if they have the same key
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function testOverwritePartialQuery()
|
function testOverwritePartialQuery()
|
||||||
{
|
{
|
||||||
@ -132,7 +148,6 @@ class UrlTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test whether array parameters are correctly added to an existing Url and end up in correct Urls
|
* Test whether array parameters are correctly added to an existing Url and end up in correct Urls
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function testSetQueryWithArrayParameter()
|
function testSetQueryWithArrayParameter()
|
||||||
{
|
{
|
||||||
@ -157,7 +172,6 @@ class UrlTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test whether Urls from the request are correctly parsed when no query is given
|
* Test whether Urls from the request are correctly parsed when no query is given
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function testUrlFromRequestWithoutQuery()
|
function testUrlFromRequestWithoutQuery()
|
||||||
{
|
{
|
||||||
@ -175,7 +189,6 @@ class UrlTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test whether Urls from the request are correctly parsed when a query is given
|
* Test whether Urls from the request are correctly parsed when a query is given
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function testUrlFromRequestWithQuery()
|
function testUrlFromRequestWithQuery()
|
||||||
{
|
{
|
||||||
@ -198,7 +211,6 @@ class UrlTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the @see Url::getParam($name, $default) function
|
* Test the @see Url::getParam($name, $default) function
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function testGetParameterByName()
|
function testGetParameterByName()
|
||||||
{
|
{
|
||||||
@ -222,7 +234,6 @@ class UrlTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the Url::remove function with a single key passed
|
* Test the Url::remove function with a single key passed
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function testRemoveSingleParameter()
|
function testRemoveSingleParameter()
|
||||||
{
|
{
|
||||||
@ -242,7 +253,6 @@ class UrlTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the Url::remove function with an array of keys passed
|
* Test the Url::remove function with an array of keys passed
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function testRemoveMultipleParameters()
|
function testRemoveMultipleParameters()
|
||||||
{
|
{
|
||||||
@ -267,7 +277,6 @@ class UrlTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the Url::without call and whether it returns a copy instead of working on the called object
|
* Test the Url::without call and whether it returns a copy instead of working on the called object
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function testWithoutCall()
|
function testWithoutCall()
|
||||||
{
|
{
|
||||||
@ -309,11 +318,14 @@ class UrlTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test whether toString is the same as getAbsoluteUrl
|
* Test whether toString is the same as getAbsoluteUrl
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function testToString()
|
function testToString()
|
||||||
{
|
{
|
||||||
$url = Url::fromPath('/my/test/url.html?param=val¶m2=val2¶m3=val3', array(), new RequestMock());
|
$url = Url::fromPath('/my/test/url.html?param=val¶m2=val2¶m3=val3', array(), new RequestMock());
|
||||||
$this->assertEquals($url->getAbsoluteUrl(), (string) $url, "Asserting whether toString returns the absolute Url");
|
$this->assertEquals(
|
||||||
|
$url->getAbsoluteUrl(),
|
||||||
|
(string) $url,
|
||||||
|
"Asserting whether toString returns the absolute Url"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,49 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
// @codingStandardsIgnoreStart
|
|
||||||
// {{{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 Tests\Icinga\Web;
|
namespace Tests\Icinga\Web;
|
||||||
|
|
||||||
use \Zend_View_Abstract;
|
use \Zend_View_Abstract;
|
||||||
|
|
||||||
/**
|
|
||||||
* ViewMock that does absolutely nothing
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class ViewMock extends Zend_View_Abstract
|
class ViewMock extends Zend_View_Abstract
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* No operation is performed here
|
|
||||||
*/
|
|
||||||
protected function _run()
|
protected function _run()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @codingStandardsIgnoreEnd
|
|
||||||
|
@ -1,35 +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 Tests\Icinga\Web\Widget;
|
namespace Tests\Icinga\Web\Widget;
|
||||||
|
|
||||||
use \PHPUnit_Framework_TestCase;
|
use Icinga\Test\BaseTestCase;
|
||||||
use Tests\Icinga\Web\RequestMock;
|
use Tests\Icinga\Web\RequestMock;
|
||||||
use Tests\Icinga\Web\ViewMock;
|
use Tests\Icinga\Web\ViewMock;
|
||||||
use Icinga\Web\Widget\Tab;
|
use Icinga\Web\Widget\Tab;
|
||||||
@ -38,7 +13,7 @@ use Icinga\Web\Url;
|
|||||||
/**
|
/**
|
||||||
* Test creation and rendering of tabs
|
* Test creation and rendering of tabs
|
||||||
*/
|
*/
|
||||||
class TabTest extends PHPUnit_Framework_TestCase
|
class TabTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Test whether rendering a tab without URL is done correctly
|
* Test whether rendering a tab without URL is done correctly
|
||||||
|
@ -1,42 +1,17 @@
|
|||||||
<?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 Tests\Icinga\Web\Widget;
|
namespace Tests\Icinga\Web\Widget;
|
||||||
|
|
||||||
use \PHPUnit_Framework_TestCase;
|
use Icinga\Test\BaseTestCase;
|
||||||
use Tests\Icinga\Web\ViewMock;
|
use Tests\Icinga\Web\ViewMock;
|
||||||
use Icinga\Web\Widget\Tabs;
|
use Icinga\Web\Widget\Tabs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test rendering of tabs and corretct tab management
|
* Test rendering of tabs and corretct tab management
|
||||||
*/
|
*/
|
||||||
class TabsTest extends PHPUnit_Framework_TestCase
|
class TabsTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Test adding tabs and asserting for correct count
|
* Test adding tabs and asserting for correct count
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
namespace Tests\Icinga\Regression;
|
namespace Tests\Icinga\Regression;
|
||||||
|
|
||||||
|
use Icinga\Test\BaseTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Bug4102
|
* Class Bug4102
|
||||||
*
|
*
|
||||||
@ -11,7 +13,7 @@ namespace Tests\Icinga\Regression;
|
|||||||
*
|
*
|
||||||
* @see https://dev.icinga.org/issues/4102
|
* @see https://dev.icinga.org/issues/4102
|
||||||
*/
|
*/
|
||||||
class Bug4102Test extends \PHPUnit_Framework_TestCase
|
class Bug4102Test extends BaseTestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Test class name to match definition
|
* Test class name to match definition
|
||||||
|
Loading…
x
Reference in New Issue
Block a user