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
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace {
|
||||
|
@ -48,12 +23,12 @@ namespace Icinga\Test {
|
|||
|
||||
use \Exception;
|
||||
use \RuntimeException;
|
||||
use Zend_Test_PHPUnit_ControllerTestCase;
|
||||
use Zend_Config;
|
||||
use Zend_Db_Adapter_Pdo_Abstract;
|
||||
use Zend_Db_Adapter_Pdo_Mysql;
|
||||
use Zend_Db_Adapter_Pdo_Pgsql;
|
||||
use Zend_Db_Adapter_Pdo_Oci;
|
||||
use \Zend_Test_PHPUnit_ControllerTestCase;
|
||||
use \Zend_Config;
|
||||
use \Zend_Db_Adapter_Pdo_Abstract;
|
||||
use \Zend_Db_Adapter_Pdo_Mysql;
|
||||
use \Zend_Db_Adapter_Pdo_Pgsql;
|
||||
use \Zend_Db_Adapter_Pdo_Oci;
|
||||
use Icinga\Data\ResourceFactory;
|
||||
use Icinga\User\Preferences;
|
||||
use Icinga\Web\Form;
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Application\Controller;
|
||||
namespace Tests\Icinga\Application\Controller;
|
||||
|
||||
class IndexControllerTest extends \Zend_Test_PHPUnit_ControllerTestCase {
|
||||
private $applicationPath;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
|
||||
class IndexControllerTest extends BaseTestCase
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
$this->applicationPath = realpath(__DIR__. '/../../../../application');
|
||||
|
||||
if (!defined('APPLICATION_PATH')) {
|
||||
define('APPLICATION_PATH', $this->applicationPath);
|
||||
define('APPLICATION_PATH', BaseTestCase::$appDir);
|
||||
}
|
||||
|
||||
if (!defined('APPLICATION_ENV')) {
|
||||
|
@ -25,7 +26,7 @@ class IndexControllerTest extends \Zend_Test_PHPUnit_ControllerTestCase {
|
|||
|
||||
public function appBootstrap()
|
||||
{
|
||||
$this->getFrontController()->setControllerDirectory($this->applicationPath. '/controllers');
|
||||
$this->getFrontController()->setControllerDirectory(BaseTestCase::$appDir . '/controllers');
|
||||
}
|
||||
|
||||
public function testIndexAction()
|
||||
|
|
|
@ -1,74 +1,19 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Form\Config;
|
||||
|
||||
use Icinga\Test\BaseTestCase;
|
||||
|
||||
use \Zend_Config;
|
||||
use \Icinga\Web\Url;
|
||||
use Icinga\Web\Url;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Tests\Icinga\Web\RequestMock;
|
||||
|
||||
/**
|
||||
* Test for the authentication provider form
|
||||
*
|
||||
*/
|
||||
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
|
||||
*/
|
||||
|
|
|
@ -1,30 +1,5 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Form\Config;
|
||||
|
|
|
@ -1,30 +1,5 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Form\Config;
|
||||
|
@ -34,13 +9,11 @@ Use Icinga\Test\BaseTestCase;
|
|||
|
||||
/**
|
||||
* Test for the authentication provider form
|
||||
*
|
||||
*/
|
||||
class LoggingFormTest extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* Test the logging form to be correctly populated from configuration
|
||||
*
|
||||
*/
|
||||
public function testLoggingFormPopulation()
|
||||
{
|
||||
|
@ -88,7 +61,6 @@ class LoggingFormTest extends BaseTestCase
|
|||
|
||||
/**
|
||||
* Test the logging form to create correct modified configurations when submit
|
||||
*
|
||||
*/
|
||||
public function testCorrectConfigCreation()
|
||||
{
|
||||
|
|
|
@ -1,30 +1,5 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*#
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Form\Preference;
|
||||
|
@ -42,7 +17,6 @@ class GeneralFormTest extends BaseTestCase
|
|||
{
|
||||
/**
|
||||
* Test whether fields using the default values have input disabled
|
||||
*
|
||||
*/
|
||||
public function testDisableFormIfUsingDefault()
|
||||
{
|
||||
|
@ -60,7 +34,6 @@ class GeneralFormTest extends BaseTestCase
|
|||
|
||||
/**
|
||||
* Test whether fields with preferences are enabled
|
||||
*
|
||||
*/
|
||||
public function testEnableFormIfUsingPreference()
|
||||
{
|
||||
|
|
|
@ -1,37 +1,13 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Application;
|
||||
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use \Icinga\Application\Config as IcingaConfig;
|
||||
|
||||
class ConfigTest extends \PHPUnit_Framework_TestCase
|
||||
class ConfigTest extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* Set up config dir
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Application;
|
||||
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\Application\Loader;
|
||||
|
||||
class LoaderTest extends \PHPUnit_Framework_TestCase
|
||||
class LoaderTest extends BaseTestCase
|
||||
{
|
||||
private static $classFile = 'test/My/Library/TestStruct.php';
|
||||
|
||||
|
|
|
@ -1,38 +1,12 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Application;
|
||||
|
||||
|
||||
use \Zend_Config;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\Logger\Logger;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
|
||||
class LoggerTest extends BaseTestCase
|
||||
{
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Application\Module\Manager;
|
||||
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\Application\Modules\Manager as ModuleManager;
|
||||
|
||||
class ModuleMock
|
||||
|
@ -20,7 +23,7 @@ class ModuleMock
|
|||
}
|
||||
}
|
||||
|
||||
class ManagerTest extends \PHPUnit_Framework_TestCase
|
||||
class ManagerTest extends BaseTestCase
|
||||
{
|
||||
const MODULE_TARGET = "/tmp";
|
||||
|
||||
|
@ -31,11 +34,11 @@ class ManagerTest extends \PHPUnit_Framework_TestCase
|
|||
$this->markTestSkipped("Temporary folder not writable for this user");
|
||||
return;
|
||||
}
|
||||
if (is_dir($moduleDir."/enabledModules")) {
|
||||
if (is_dir($moduleDir . "/enabledModules")) {
|
||||
exec("rm -r $moduleDir/enabledModules");
|
||||
}
|
||||
|
||||
mkdir($moduleDir."/enabledModules");
|
||||
mkdir($moduleDir . "/enabledModules");
|
||||
}
|
||||
|
||||
public function testDetectEnabledModules()
|
||||
|
@ -43,11 +46,11 @@ class ManagerTest extends \PHPUnit_Framework_TestCase
|
|||
$manager = new ModuleManager(null, "/tmp/enabledModules", array("none"));
|
||||
$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"));
|
||||
$this->assertEquals(array("module1"), $manager->listEnabledModules());
|
||||
symlink(getcwd()."/res/testModules/module2", "/tmp/enabledModules/module2");
|
||||
symlink(getcwd()."/res/???", "/tmp/enabledModules/module3");
|
||||
symlink(getcwd() . "/res/testModules/module2", "/tmp/enabledModules/module2");
|
||||
symlink(getcwd() . "/res/???", "/tmp/enabledModules/module3");
|
||||
$manager = new ModuleManager(null, "/tmp/enabledModules", array("none"));
|
||||
$this->assertEquals(array("module1", "module2"), $manager->listEnabledModules());
|
||||
}
|
||||
|
@ -67,7 +70,7 @@ class ManagerTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
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());
|
||||
$manager->enableModule("module1");
|
||||
$elems = $manager->listEnabledModules();
|
||||
|
@ -82,8 +85,8 @@ class ManagerTest extends \PHPUnit_Framework_TestCase
|
|||
public function testDisableModule()
|
||||
{
|
||||
clearstatcache(true);
|
||||
symlink(getcwd()."/res/testModules/module1", "/tmp/enabledModules/module1");
|
||||
$manager = new ModuleManager(null, "/tmp/enabledModules", array(getcwd()."/res/testModules"));
|
||||
symlink(getcwd() . "/res/testModules/module1", "/tmp/enabledModules/module1");
|
||||
$manager = new ModuleManager(null, "/tmp/enabledModules", array(getcwd() . "/res/testModules"));
|
||||
$elems = $manager->listEnabledModules();
|
||||
$this->assertNotEmpty($elems);
|
||||
$this->assertEquals($elems[0], "module1");
|
||||
|
|
|
@ -1,30 +1,5 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Application;
|
||||
|
@ -53,7 +28,7 @@ class ZendDbMock
|
|||
*
|
||||
* @param $adapter String name of base adapter class, or Zend_Config object
|
||||
* @param $config mixed OPTIONAL; an array or Zend_Config object with adapter
|
||||
* parameters
|
||||
* parameters
|
||||
*
|
||||
* @return stdClass Empty object
|
||||
*/
|
||||
|
|
|
@ -1,30 +1,5 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Authentication;
|
||||
|
@ -289,5 +264,4 @@ class DbUserBackendTest extends BaseTestCase
|
|||
|
||||
$this->assertGreaterThan(0, $backend->getUserCount());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,30 +1,5 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Authentication;
|
||||
|
|
|
@ -1,30 +1,5 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Authentication;
|
||||
|
@ -58,7 +33,6 @@ class ManagerTest extends BaseTestCase
|
|||
&$session = null,
|
||||
$write = false,
|
||||
$nobackend = false,
|
||||
|
||||
Zend_Config $managerConfig = null
|
||||
) {
|
||||
if ($session == null) {
|
||||
|
|
|
@ -1,37 +1,11 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Chart;
|
||||
|
||||
use \DOMXPath;
|
||||
use \DOMDocument;
|
||||
|
||||
use Icinga\Chart\GridChart;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
|
||||
|
|
|
@ -1,37 +1,11 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Chart;
|
||||
|
||||
use \DOMXPath;
|
||||
use \DOMDocument;
|
||||
|
||||
use Icinga\Chart\PieChart;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
|
||||
|
|
|
@ -1,39 +1,15 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\PreservingIniWriterTest;
|
||||
namespace Tests\Icinga\Config;
|
||||
|
||||
use \Zend_Config;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\Config\PreservingIniWriter;
|
||||
|
||||
class PreservingIniWriterTest extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
class PreservingIniWriterTest extends BaseTestCase
|
||||
{
|
||||
private $tmpfiles = array();
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,30 +1,5 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Filter;
|
||||
|
|
|
@ -1,30 +1,5 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Filter;
|
||||
|
|
|
@ -1,30 +1,5 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Filter;
|
||||
|
@ -48,7 +23,6 @@ class TypeMock extends FilterType
|
|||
return $node;
|
||||
}
|
||||
|
||||
|
||||
public function getProposalsForQuery($query)
|
||||
{
|
||||
return $this->getOperators();
|
||||
|
|
|
@ -1,30 +1,5 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Filter;
|
||||
|
|
|
@ -1,30 +1,5 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Filter;
|
||||
|
|
|
@ -1,30 +1,5 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Filter;
|
||||
|
|
|
@ -1,36 +1,11 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Protocol\Commandpipe;
|
||||
|
||||
use \Zend_Config;
|
||||
use \PHPUnit_Framework_TestCase;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\Protocol\Commandpipe\Comment;
|
||||
use Icinga\Protocol\Commandpipe\CommandPipe;
|
||||
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
|
||||
* 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
|
||||
|
|
|
@ -5,8 +5,10 @@
|
|||
namespace Tests\Icinga\Protocol\Ldap;
|
||||
|
||||
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()
|
||||
{
|
||||
|
@ -19,7 +21,7 @@ class QueryTest extends \PHPUnit_Framework_TestCase
|
|||
)
|
||||
);
|
||||
|
||||
$connection = new \Icinga\Protocol\Ldap\Connection($config);
|
||||
$connection = new Connection($config);
|
||||
return $connection->select();
|
||||
}
|
||||
|
||||
|
@ -35,18 +37,6 @@ class QueryTest extends \PHPUnit_Framework_TestCase
|
|||
return $select;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for Query::Count() - shall be tested with connection
|
||||
*
|
||||
**/
|
||||
public function testCount()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for Query::Limit()
|
||||
*
|
||||
**/
|
||||
public function testLimit()
|
||||
{
|
||||
$select = $this->prepareSelect();
|
||||
|
@ -54,10 +44,6 @@ class QueryTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals(4, $select->getOffset());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for Query::HasLimit()
|
||||
*
|
||||
**/
|
||||
public function testHasLimit()
|
||||
{
|
||||
$select = $this->emptySelect();
|
||||
|
@ -66,10 +52,6 @@ class QueryTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertTrue($select->hasLimit());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for Query::HasOffset()
|
||||
*
|
||||
**/
|
||||
public function testHasOffset()
|
||||
{
|
||||
$select = $this->emptySelect();
|
||||
|
@ -78,99 +60,39 @@ class QueryTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertTrue($select->hasOffset());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for Query::GetLimit()
|
||||
*
|
||||
**/
|
||||
public function testGetLimit()
|
||||
{
|
||||
$select = $this->prepareSelect();
|
||||
$this->assertEquals(10, $select->getLimit());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for Query::GetOffset()
|
||||
*
|
||||
**/
|
||||
public function testGetOffset()
|
||||
{
|
||||
$select = $this->prepareSelect();
|
||||
$this->assertEquals(10, $select->getLimit());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for Query::FetchTree()
|
||||
*
|
||||
**/
|
||||
public function testFetchTree()
|
||||
{
|
||||
$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()
|
||||
{
|
||||
return $this->testListFields();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for Query::Where()
|
||||
*
|
||||
**/
|
||||
public function testWhere()
|
||||
{
|
||||
$this->markTestIncomplete('testWhere is not implemented yet');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for Query::Order()
|
||||
*
|
||||
**/
|
||||
public function testOrder()
|
||||
{
|
||||
$select = $this->emptySelect()->order('bla');
|
||||
// tested by testGetSortColumns
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for Query::ListFields()
|
||||
*
|
||||
**/
|
||||
public function testListFields()
|
||||
{
|
||||
$select = $this->prepareSelect();
|
||||
|
@ -180,10 +102,6 @@ class QueryTest extends \PHPUnit_Framework_TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for Query::GetSortColumns()
|
||||
*
|
||||
**/
|
||||
public function testGetSortColumns()
|
||||
{
|
||||
$select = $this->prepareSelect();
|
||||
|
@ -191,31 +109,10 @@ class QueryTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals('testIntColumn', $cols[0][0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for Query::Paginate() - requires real result
|
||||
*
|
||||
**/
|
||||
public function testPaginate()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for Query::__toString()
|
||||
*
|
||||
**/
|
||||
public function test__toString()
|
||||
{
|
||||
$select = $this->prepareSelect();
|
||||
$res = '(&(objectClass=dummyClass)(testIntColumn=1)(testStringColumn=test)(testWildcard=abc*))';
|
||||
$this->assertEquals($res, (string) $select);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for Query::__destruct()
|
||||
*
|
||||
**/
|
||||
public function test__destruct()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Protocol\Statusdat;
|
||||
|
||||
use \Zend_Config;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\Protocol\Statusdat\Reader;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
class StatusdatComponentTest extends \PHPUnit_Framework_TestCase
|
||||
class StatusdatComponentTest extends BaseTestCase
|
||||
{
|
||||
public function getReader() {
|
||||
$reader = new Reader(new Zend_Config(array(
|
||||
|
@ -53,7 +56,7 @@ class StatusdatComponentTest extends \PHPUnit_Framework_TestCase
|
|||
public function testHostgroupFilterFromService() {
|
||||
$r = $this->getReader();
|
||||
$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);
|
||||
foreach($result as $obj) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Protocol\Statusdat\Exceptions;
|
||||
|
||||
class ParsingException extends RuntimeException
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Protocol\Statusdat;
|
||||
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\Protocol\Statusdat\Parser;
|
||||
|
||||
class ParserTest extends \PHPUnit_Framework_TestCase
|
||||
class ParserTest extends BaseTestCase
|
||||
{
|
||||
private function getStringAsFileHandle($string)
|
||||
{
|
||||
$maxsize = strlen($string)*2;
|
||||
$fhandle = fopen("php://memory", 'r+');
|
||||
fputs($fhandle,$string);
|
||||
fputs($fhandle, $string);
|
||||
rewind($fhandle);
|
||||
return $fhandle;
|
||||
}
|
||||
|
@ -136,7 +138,6 @@ define servicegroup {
|
|||
*/
|
||||
public function testRuntimeParsingForBigFile()
|
||||
{
|
||||
//$this->markTestSkipped('Skipped slow tests');
|
||||
$objects = fopen("./res/status/icinga.objects.cache","r");
|
||||
$status = fopen("./res/status/icinga.status.dat","r");
|
||||
$testParser = new Parser($objects);
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Protocol\Statusdat\Query;
|
||||
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\Protocol\Statusdat\Query\Expression;
|
||||
|
||||
class ExpressionTest extends \PHPUnit_Framework_TestCase
|
||||
class ExpressionTest extends BaseTestCase
|
||||
{
|
||||
public function testFromStringParsing()
|
||||
{
|
||||
|
@ -133,5 +136,4 @@ class ExpressionTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$this->markTestIncomplete('testFilter is not implemented yet');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
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;
|
||||
|
||||
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()
|
||||
{
|
||||
$testQuery = new Statusdat\Query\Group();
|
||||
$testQuery = new Group();
|
||||
$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(0, $value);
|
||||
|
||||
|
@ -53,9 +60,13 @@ class GroupTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
public function testParsingSimpleAndCondition()
|
||||
{
|
||||
$testQuery = new Statusdat\Query\Group();
|
||||
$testQuery = new Group();
|
||||
$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(0, $value);
|
||||
$this->assertEquals("AND", $testQuery->getType());
|
||||
|
@ -72,9 +83,13 @@ class GroupTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
public function testParsingSimpleORCondition()
|
||||
{
|
||||
$testQuery = new Statusdat\Query\Group();
|
||||
$testQuery = new Group();
|
||||
$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(0, $value);
|
||||
$this->assertEquals("OR", $testQuery->getType());
|
||||
|
@ -91,9 +106,13 @@ class GroupTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
public function testParsingExplicitSubgroup()
|
||||
{
|
||||
$testQuery = new Statusdat\Query\Group();
|
||||
$testQuery = new Group();
|
||||
$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(0, $value);
|
||||
$this->assertEquals("AND", $testQuery->getType());
|
||||
|
@ -119,9 +138,13 @@ class GroupTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
public function testParsingImplicitSubgroup()
|
||||
{
|
||||
$testQuery = new Statusdat\Query\Group();
|
||||
$testQuery = new Group();
|
||||
$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(0, $value);
|
||||
$this->assertEquals("AND", $testQuery->getType());
|
||||
|
@ -147,35 +170,41 @@ class GroupTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
public function testAndFilter()
|
||||
{
|
||||
$testQuery = new Statusdat\Query\Group();
|
||||
$testQuery->setType(Statusdat\Query\Group::TYPE_AND);
|
||||
$testQuery = new Group();
|
||||
$testQuery->setType(Group::TYPE_AND);
|
||||
$exp1 = new QueryExpressionMock();
|
||||
$exp1->filter = array(1, 2, 3, 4, 5, 6, 8);
|
||||
$exp2 = new QueryExpressionMock();
|
||||
$exp2->filter = array(3, 4, 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()
|
||||
{
|
||||
$testQuery = new Statusdat\Query\Group();
|
||||
$testQuery->setType(Statusdat\Query\Group::TYPE_OR);
|
||||
$testQuery = new Group();
|
||||
$testQuery->setType(Group::TYPE_OR);
|
||||
$exp1 = new QueryExpressionMock();
|
||||
$exp1->filter = array(1, 2, 3);
|
||||
$exp2 = new QueryExpressionMock();
|
||||
$exp2->filter = array(3, 4, 6, 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()
|
||||
{
|
||||
$testQuery_and = new Statusdat\Query\Group();
|
||||
$testQuery_and->setType(Statusdat\Query\Group::TYPE_AND);
|
||||
$testQuery_or = new Statusdat\Query\Group();
|
||||
$testQuery_or->setType(Statusdat\Query\Group::TYPE_OR);
|
||||
$testQuery_and = new Group();
|
||||
$testQuery_and->setType(Group::TYPE_AND);
|
||||
$testQuery_or = new Group();
|
||||
$testQuery_or->setType(Group::TYPE_OR);
|
||||
$base = array(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
|
||||
$and_exp1 = new QueryExpressionMock();
|
||||
|
@ -196,4 +225,3 @@ class GroupTest extends \PHPUnit_Framework_TestCase
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Protocol\Statusdat;
|
||||
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\Protocol\Statusdat\Query;
|
||||
|
||||
class QueryTest extends \PHPUnit_Framework_TestCase
|
||||
class QueryTest extends BaseTestCase
|
||||
{
|
||||
public function testSimpleServiceSelect()
|
||||
{
|
||||
|
@ -122,6 +125,7 @@ class QueryTest extends \PHPUnit_Framework_TestCase
|
|||
)
|
||||
)
|
||||
));
|
||||
|
||||
return $readerMock;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Protocol\Statusdat;
|
||||
|
||||
use Icinga\Data\DatasourceInterface;
|
||||
|
@ -21,7 +24,6 @@ class ReaderMock implements IReader, DatasourceInterface
|
|||
|
||||
public function getInternalState()
|
||||
{
|
||||
|
||||
return array(
|
||||
"objects" => $this->objects,
|
||||
"indices" => $this->indices
|
||||
|
@ -33,7 +35,7 @@ class ReaderMock implements IReader, DatasourceInterface
|
|||
return $this->objects;
|
||||
}
|
||||
|
||||
public function __call($arg1,$arg2) {
|
||||
public function __call($arg1, $arg2) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -44,9 +46,9 @@ class ReaderMock implements IReader, DatasourceInterface
|
|||
|
||||
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 null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Protocol\Statusdat;
|
||||
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\Protocol\Statusdat\Reader;
|
||||
|
||||
/**
|
||||
*
|
||||
* Test class for Reader
|
||||
* Created Wed, 16 Jan 2013 15:15:16 +0000
|
||||
*
|
||||
**/
|
||||
class ConfigMock
|
||||
{
|
||||
function __construct($data)
|
||||
|
@ -27,7 +24,6 @@ class ConfigMock
|
|||
|
||||
class ParserMock
|
||||
{
|
||||
|
||||
public $runtime = array();
|
||||
public $objects = array();
|
||||
|
||||
|
@ -47,7 +43,7 @@ class ParserMock
|
|||
}
|
||||
}
|
||||
|
||||
class ReaderTest extends \PHPUnit_Framework_TestCase
|
||||
class ReaderTest extends BaseTestCase
|
||||
{
|
||||
protected function tearDown()
|
||||
{
|
||||
|
@ -86,7 +82,6 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
public function testEmptyFileException()
|
||||
{
|
||||
|
||||
$this->setExpectedException("Icinga\Exception\ConfigurationError");
|
||||
$parser = new ParserMock();
|
||||
$reader = new Reader(new ConfigMock(array(
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
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()
|
||||
{
|
||||
$container = new \Icinga\Protocol\Statusdat\RuntimeStateContainer("
|
||||
$container = new RuntimeStateContainer("
|
||||
host_name=test host
|
||||
current_state=0
|
||||
plugin_output=test 1234 test test
|
||||
|
|
|
@ -1,30 +1,5 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Session;
|
||||
|
|
|
@ -1,30 +1,5 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Session;
|
||||
|
@ -33,7 +8,6 @@ use \Exception;
|
|||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\Web\Session\SessionNamespace;
|
||||
|
||||
|
||||
class SessionNamespaceTest extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -1,30 +1,5 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace 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
|
||||
*/
|
||||
|
@ -67,7 +32,6 @@ class BaseTestCaseDbTest extends BaseTestCase
|
|||
public function testMySqlCreateTablePart1($resource)
|
||||
{
|
||||
$this->setupDbProvider($resource);
|
||||
/** @var \Zend_Db_Adapter_Pdo_Abstract $resource **/
|
||||
$resource->exec('CREATE TABLE test(uid INT NOT NULL PRIMARY KEY);');
|
||||
|
||||
$tables = $resource->listTables();
|
||||
|
|
|
@ -1,32 +1,31 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga;
|
||||
|
||||
use \DateTimeZone;
|
||||
use Icinga\User as IcingaUser;
|
||||
use Icinga\User\Preferences as UserPreferences;
|
||||
use Icinga\User;
|
||||
use Icinga\User\Preferences;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
|
||||
class UserTest extends \PHPUnit_Framework_TestCase
|
||||
class UserTest extends BaseTestCase
|
||||
{
|
||||
public function testGetDefaultTimezoneIfTimezoneNotSet()
|
||||
{
|
||||
$defaultTz = 'UTC';
|
||||
date_default_timezone_set($defaultTz);
|
||||
$user = new IcingaUser('unittest');
|
||||
$prefs = new UserPreferences(array());
|
||||
$user = new User('unittest');
|
||||
$prefs = new Preferences(array());
|
||||
$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'
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetTimezoneIfTimezoneSet()
|
||||
{
|
||||
$defaultTz = 'UTC';
|
||||
$explicitTz = 'Europe/Berlin';
|
||||
date_default_timezone_set($defaultTz);
|
||||
$user = new IcingaUser('unittest');
|
||||
$prefs = new UserPreferences(array(
|
||||
$user = new User('unittest');
|
||||
$prefs = new Preferences(array(
|
||||
'timezone' => $explicitTz
|
||||
));
|
||||
$user->setPreferences($prefs);
|
||||
|
|
|
@ -1,19 +1,14 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Util;
|
||||
|
||||
use Icinga\Util\Dimension;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
|
||||
/**
|
||||
* Tests for the dimension class
|
||||
*
|
||||
*/
|
||||
class DimensionTest extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
/**
|
||||
* Test Dimension creation from string
|
||||
*
|
||||
*/
|
||||
class DimensionTest extends BaseTestCase
|
||||
{
|
||||
public function testStringFactoryWithValidInput()
|
||||
{
|
||||
$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");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test string creation from Dimension
|
||||
*
|
||||
*/
|
||||
public function testStringCreation()
|
||||
{
|
||||
$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");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function testInvalidDimensions()
|
||||
{
|
||||
$d = new Dimension(-20, Dimension::UNIT_PX);
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Web\Form\Element;
|
||||
|
||||
|
|
|
@ -1,40 +1,14 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Web\Form\Validator;
|
||||
|
||||
use \PHPUnit_Framework_TestCase;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\Web\Form\Validator\DateFormatValidator;
|
||||
|
||||
class DateFormatValidatorTest extends PHPUnit_Framework_TestCase
|
||||
class DateFormatValidatorTest extends BaseTestCase
|
||||
{
|
||||
|
||||
public function testValidateCorrectInput()
|
||||
{
|
||||
$validator = new DateFormatValidator();
|
||||
|
|
|
@ -1,38 +1,13 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Web\Form\Validator;
|
||||
|
||||
use \PHPUnit_Framework_TestCase;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\Web\Form\Validator\TimeFormatValidator;
|
||||
|
||||
class TimeFormatValidatorTest extends PHPUnit_Framework_TestCase
|
||||
class TimeFormatValidatorTest extends BaseTestCase
|
||||
{
|
||||
public function testValidateCorrectInput()
|
||||
{
|
||||
|
|
|
@ -1,38 +1,13 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Web\Form\Validator;
|
||||
|
||||
use \PHPUnit_Framework_TestCase;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\Web\Form\Validator\WritablePathValidator;
|
||||
|
||||
class WritablePathValidatorTest extends PHPUnit_Framework_TestCase
|
||||
class WritablePathValidatorTest extends BaseTestCase
|
||||
{
|
||||
public function testValidateInputWithWritablePath()
|
||||
{
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Web;
|
||||
|
||||
use Icinga\Web\Form;
|
||||
use \Zend_Test_PHPUnit_ControllerTestCase;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
|
||||
/**
|
||||
* Dummy extension class as Icinga\Web\Form is an abstract one
|
||||
|
@ -12,14 +14,13 @@ class TestForm extends Form
|
|||
{
|
||||
public function create()
|
||||
{
|
||||
// pass
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Web\Hook\Configuration;
|
||||
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\Web\Hook\Configuration\ConfigurationTab;
|
||||
use Icinga\Web\Hook\Configuration\ConfigurationTabBuilder;
|
||||
use Icinga\Web\Hook;
|
||||
use Icinga\Web\Url;
|
||||
use Icinga\Web\Widget\Tabs;
|
||||
|
@ -16,7 +20,7 @@ class RequestMock
|
|||
|
||||
}
|
||||
|
||||
class ConfigurationTabBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
class ConfigurationTabBuilderTest extends BaseTestCase
|
||||
{
|
||||
protected function setUp()
|
||||
{
|
||||
|
@ -35,7 +39,7 @@ class ConfigurationTabBuilderTest extends \PHPUnit_Framework_TestCase
|
|||
public function testDefaultTabs()
|
||||
{
|
||||
$widget = new Tabs();
|
||||
$builder = new Hook\Configuration\ConfigurationTabBuilder($widget);
|
||||
$builder = new ConfigurationTabBuilder($widget);
|
||||
|
||||
$array = $builder->build();
|
||||
$tabs = $builder->getTabs();
|
||||
|
@ -46,15 +50,15 @@ class ConfigurationTabBuilderTest extends \PHPUnit_Framework_TestCase
|
|||
public function testTabCreation1()
|
||||
{
|
||||
$widget = new Tabs();
|
||||
$builder = new Hook\Configuration\ConfigurationTabBuilder($widget);
|
||||
$builder = new ConfigurationTabBuilder($widget);
|
||||
|
||||
$tab1 = new ConfigurationTab('test1', '/test1', 'TEST1');
|
||||
$tab2 = new ConfigurationTab('test2', '/test2', 'TEST2');
|
||||
$tab3 = new ConfigurationTab('test3', '/test3', 'TEST3');
|
||||
|
||||
Hook::registerObject(Hook\Configuration\ConfigurationTabBuilder::HOOK_NAMESPACE, 'test1', $tab1);
|
||||
Hook::registerObject(Hook\Configuration\ConfigurationTabBuilder::HOOK_NAMESPACE, 'test2', $tab2);
|
||||
Hook::registerObject(Hook\Configuration\ConfigurationTabBuilder::HOOK_NAMESPACE, 'test3', $tab3);
|
||||
Hook::registerObject(ConfigurationTabBuilder::HOOK_NAMESPACE, 'test1', $tab1);
|
||||
Hook::registerObject(ConfigurationTabBuilder::HOOK_NAMESPACE, 'test2', $tab2);
|
||||
Hook::registerObject(ConfigurationTabBuilder::HOOK_NAMESPACE, 'test3', $tab3);
|
||||
|
||||
$builder->build();
|
||||
|
||||
|
@ -68,10 +72,10 @@ class ConfigurationTabBuilderTest extends \PHPUnit_Framework_TestCase
|
|||
public function testTabCreation2()
|
||||
{
|
||||
$widget = new Tabs();
|
||||
$builder = new Hook\Configuration\ConfigurationTabBuilder($widget);
|
||||
$builder = new ConfigurationTabBuilder($widget);
|
||||
|
||||
$tab = new \stdClass();
|
||||
Hook::registerObject(Hook\Configuration\ConfigurationTabBuilder::HOOK_NAMESPACE, 'misc', $tab);
|
||||
Hook::registerObject(ConfigurationTabBuilder::HOOK_NAMESPACE, 'misc', $tab);
|
||||
$builder->build();
|
||||
|
||||
$this->assertCount(5, $builder->getTabs());
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Web\Hook\Configuration;
|
||||
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\Web\Hook\Configuration\ConfigurationTab;
|
||||
|
||||
class ConfigurationTabTest extends \PHPUnit_Framework_TestCase
|
||||
class ConfigurationTabTest extends BaseTestCase
|
||||
{
|
||||
public function testCreate1()
|
||||
{
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Web;
|
||||
|
||||
use Icinga\Web\Hook;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
|
||||
class Base
|
||||
{
|
||||
|
@ -28,17 +31,11 @@ class ObjectHookImplementation
|
|||
{
|
||||
private $test;
|
||||
|
||||
/**
|
||||
* @param mixed $test
|
||||
*/
|
||||
public function setTest($test)
|
||||
{
|
||||
$this->test = $test;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getTest()
|
||||
{
|
||||
return $this->test;
|
||||
|
@ -50,7 +47,7 @@ class ObjectHookImplementation
|
|||
}
|
||||
}
|
||||
|
||||
class HookTest extends \PHPUnit_Framework_TestCase
|
||||
class HookTest extends BaseTestCase
|
||||
{
|
||||
protected function setUp()
|
||||
{
|
||||
|
@ -64,11 +61,6 @@ class HookTest extends \PHPUnit_Framework_TestCase
|
|||
Hook::clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for Hook::Has()
|
||||
* Note: This method is static!
|
||||
*
|
||||
**/
|
||||
public function testHas()
|
||||
{
|
||||
$this->assertFalse(Hook::has("a"));
|
||||
|
@ -79,11 +71,6 @@ class HookTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertTrue(Hook::has("a","b"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for Hook::CreateInstance()
|
||||
* Note: This method is static!
|
||||
*
|
||||
**/
|
||||
public function testCreateInstance()
|
||||
{
|
||||
Hook::$BASE_NS = "Tests\\Icinga\\Web\\";
|
||||
|
@ -92,12 +79,6 @@ class HookTest extends \PHPUnit_Framework_TestCase
|
|||
Hook::clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for Hook::CreateInstance()
|
||||
* Note: This method is static!
|
||||
*
|
||||
*
|
||||
**/
|
||||
public function testCreateInvalidInstance1()
|
||||
{
|
||||
$this->setExpectedException('\Icinga\Exception\ProgrammingError');
|
||||
|
@ -122,11 +103,6 @@ class HookTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertNull($test);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for Hook::All()
|
||||
* Note: This method is static!
|
||||
*
|
||||
**/
|
||||
public function testAll()
|
||||
{
|
||||
Hook::$BASE_NS = "Tests\\Icinga\\Web\\";
|
||||
|
@ -137,14 +113,8 @@ class HookTest extends \PHPUnit_Framework_TestCase
|
|||
foreach(Hook::all("Base") as $instance) {
|
||||
$this->assertInstanceOf("Tests\\Icinga\\Web\\TestHookImplementation",$instance);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for Hook::First()
|
||||
* Note: This method is static!
|
||||
*
|
||||
**/
|
||||
public function testFirst()
|
||||
{
|
||||
Hook::$BASE_NS = "Tests\\Icinga\\Web\\";
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Web;
|
||||
|
||||
use \Zend_Session;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\Logger\Logger;
|
||||
use Icinga\Web\Notification;
|
||||
|
||||
class NotificationTest extends \PHPUnit_Framework_TestCase
|
||||
class NotificationTest extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* @var Logger
|
||||
|
@ -19,7 +23,7 @@ class NotificationTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
protected function setUp()
|
||||
{
|
||||
\Zend_Session::$_unitTestEnabled = true;
|
||||
Zend_Session::$_unitTestEnabled = true;
|
||||
|
||||
$this->loggerPath = "/tmp/icinga2-web-notify-test";
|
||||
$this->dropLog();
|
||||
|
@ -34,8 +38,6 @@ class NotificationTest extends \PHPUnit_Framework_TestCase
|
|||
));
|
||||
|
||||
$this->logger = new Logger($logConfig);
|
||||
|
||||
// $this->notification = Notification::getInstance();
|
||||
}
|
||||
|
||||
protected function dropLog()
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Web\Paginator\Adapter;
|
||||
|
||||
use \Zend_Config;
|
||||
use \PHPUnit_Framework_TestCase;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\Protocol\Statusdat\Reader;
|
||||
use Icinga\Module\Monitoring\Backend;
|
||||
use Icinga\Web\Paginator\Adapter\QueryAdapter;
|
||||
|
||||
class QueryAdapterTest extends PHPUnit_Framework_TestCase
|
||||
class QueryAdapterTest extends BaseTestCase
|
||||
{
|
||||
private $cacheDir;
|
||||
|
||||
|
@ -24,8 +26,8 @@ class QueryAdapterTest extends PHPUnit_Framework_TestCase
|
|||
mkdir($this->cacheDir);
|
||||
}
|
||||
|
||||
$statusdatFile = dirname(__FILE__) . '/../../../../../res/status/icinga.status.dat';
|
||||
$cacheFile = dirname(__FILE__) . '/../../../../../res/status/icinga.objects.cache';
|
||||
$statusdatFile = BaseTestCase::$testDir . '/res/status/icinga.status.dat';
|
||||
$cacheFile = BaseTestCase::$testDir . '/res/status/icinga.objects.cache';
|
||||
|
||||
$this->backendConfig = new Zend_Config(
|
||||
array(
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
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_Paginator_Adapter_Interface;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\Protocol\Statusdat\Reader;
|
||||
use Icinga\Web\Paginator\Adapter\QueryAdapter;
|
||||
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;
|
||||
|
||||
|
@ -70,8 +73,8 @@ class SlidingwithborderTest extends \PHPUnit_Framework_TestCase
|
|||
mkdir($this->cacheDir);
|
||||
}
|
||||
|
||||
$statusdatFile = dirname(__FILE__). '/../../../../../res/status/icinga.status.dat';
|
||||
$cacheFile = dirname(__FILE__). '/../../../../../res/status/icinga.objects.cache';
|
||||
$statusdatFile = BaseTestCase::$testDir . '/res/status/icinga.status.dat';
|
||||
$cacheFile = BaseTestCase::$testDir . '/res/status/icinga.objects.cache';
|
||||
|
||||
$this->backendConfig = new Zend_Config(
|
||||
array(
|
||||
|
|
|
@ -1,38 +1,11 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Web;
|
||||
|
||||
/**
|
||||
* Request mock that implements all methods required by the
|
||||
* Url class
|
||||
*
|
||||
* Request mock that implements all methods required by the Url class
|
||||
*/
|
||||
class RequestMock
|
||||
{
|
||||
|
|
|
@ -1,45 +1,61 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Web;
|
||||
|
||||
use Icinga\Web\Url;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
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
|
||||
*
|
||||
*/
|
||||
function testFromStringWithoutQuery()
|
||||
{
|
||||
$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($url->getPath(), '/'.$url->getRelativeUrl(), 'Assert the path of an url without query to be equal the relative path');
|
||||
$this->assertEquals(
|
||||
'/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
|
||||
*
|
||||
*/
|
||||
function testFromUrlWithBasePath()
|
||||
{
|
||||
$url = Url::fromPath('my/test/url.html', array(), new RequestMock());
|
||||
$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
|
||||
*
|
||||
*/
|
||||
function testFromUrlWithKeyValueQuery()
|
||||
{
|
||||
$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(
|
||||
array(
|
||||
'param1' => '%arg1',
|
||||
|
@ -52,7 +68,6 @@ class UrlTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* Tests whether unnamed query parameters in Urls are correctly recognized and decoded
|
||||
*
|
||||
*/
|
||||
function testFromUrlWithArrayInQuery()
|
||||
{
|
||||
|
@ -68,11 +83,14 @@ class UrlTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* Tests whether named query parameters in Urls are correctly recognized and decoded
|
||||
*
|
||||
*/
|
||||
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(
|
||||
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
|
||||
*
|
||||
*/
|
||||
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
|
||||
* if they have the same key
|
||||
*
|
||||
* Test whether parameters are correctly added to existing query parameters
|
||||
* and existing ones are correctly overwritten if they have the same key
|
||||
*/
|
||||
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
|
||||
*
|
||||
*/
|
||||
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
|
||||
*
|
||||
*/
|
||||
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
|
||||
*
|
||||
*/
|
||||
function testUrlFromRequestWithQuery()
|
||||
{
|
||||
|
@ -198,7 +211,6 @@ class UrlTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* Test the @see Url::getParam($name, $default) function
|
||||
*
|
||||
*/
|
||||
function testGetParameterByName()
|
||||
{
|
||||
|
@ -222,7 +234,6 @@ class UrlTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* Test the Url::remove function with a single key passed
|
||||
*
|
||||
*/
|
||||
function testRemoveSingleParameter()
|
||||
{
|
||||
|
@ -242,7 +253,6 @@ class UrlTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* Test the Url::remove function with an array of keys passed
|
||||
*
|
||||
*/
|
||||
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
|
||||
*
|
||||
*/
|
||||
function testWithoutCall()
|
||||
{
|
||||
|
@ -309,11 +318,14 @@ class UrlTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* Test whether toString is the same as getAbsoluteUrl
|
||||
*
|
||||
*/
|
||||
function testToString()
|
||||
{
|
||||
$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
|
||||
// @codingStandardsIgnoreStart
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Web;
|
||||
|
||||
use \Zend_View_Abstract;
|
||||
|
||||
/**
|
||||
* ViewMock that does absolutely nothing
|
||||
*
|
||||
*/
|
||||
class ViewMock extends Zend_View_Abstract
|
||||
{
|
||||
/**
|
||||
* No operation is performed here
|
||||
*/
|
||||
protected function _run()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// @codingStandardsIgnoreEnd
|
||||
|
|
|
@ -1,35 +1,10 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Web\Widget;
|
||||
|
||||
use \PHPUnit_Framework_TestCase;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Tests\Icinga\Web\RequestMock;
|
||||
use Tests\Icinga\Web\ViewMock;
|
||||
use Icinga\Web\Widget\Tab;
|
||||
|
@ -38,7 +13,7 @@ use Icinga\Web\Url;
|
|||
/**
|
||||
* 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
|
||||
|
|
|
@ -1,42 +1,17 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
*
|
||||
* Icinga Web 2 - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Web\Widget;
|
||||
|
||||
use \PHPUnit_Framework_TestCase;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Tests\Icinga\Web\ViewMock;
|
||||
use Icinga\Web\Widget\Tabs;
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
namespace Tests\Icinga\Regression;
|
||||
|
||||
use Icinga\Test\BaseTestCase;
|
||||
|
||||
/**
|
||||
* Class Bug4102
|
||||
*
|
||||
|
@ -11,7 +13,7 @@ namespace Tests\Icinga\Regression;
|
|||
*
|
||||
* @see https://dev.icinga.org/issues/4102
|
||||
*/
|
||||
class Bug4102Test extends \PHPUnit_Framework_TestCase
|
||||
class Bug4102Test extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* Test class name to match definition
|
||||
|
|
Loading…
Reference in New Issue