Remove require instructions from all tests and fix namespaces
refs #4639
This commit is contained in:
parent
0dc4a4f541
commit
91675bac50
|
@ -2,8 +2,6 @@
|
|||
|
||||
namespace Tests\Application\Controller;
|
||||
|
||||
use Icinga\Application\Icinga;
|
||||
|
||||
class IndexControllerTest extends \Zend_Test_PHPUnit_ControllerTestCase {
|
||||
private $applicationPath;
|
||||
|
||||
|
|
|
@ -27,13 +27,13 @@
|
|||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Test\Form\Config;
|
||||
namespace Tests\Icinga\Form\Config;
|
||||
|
||||
use Icinga\Test\BaseTestCase;
|
||||
|
||||
use \Zend_Config;
|
||||
use \Icinga\Web\Url;
|
||||
use \Tests\Icinga\Web\RequestMock;
|
||||
use Tests\Icinga\Web\RequestMock;
|
||||
|
||||
/**
|
||||
* Test for the authentication provider form
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Test\Form\Config;
|
||||
namespace Tests\Icinga\Form\Config;
|
||||
|
||||
use \DateTimeZone;
|
||||
use \DOMDocument;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Test\Form\Config;
|
||||
namespace Tests\Icinga\Form\Config;
|
||||
|
||||
use \Zend_Config;
|
||||
Use Icinga\Test\BaseTestCase;
|
||||
|
|
|
@ -27,14 +27,13 @@
|
|||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Test\Form\Preference;
|
||||
|
||||
use Icinga\Test\BaseTestCase;
|
||||
namespace Tests\Icinga\Form\Preference;
|
||||
|
||||
use \DateTimeZone;
|
||||
use \Icinga\User\Preferences;
|
||||
use \Zend_View_Helper_DateFormat;
|
||||
use \Icinga\Util\DateTimeFactory;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\User\Preferences;
|
||||
use Icinga\Util\DateTimeFactory;
|
||||
|
||||
/**
|
||||
* Test for general form, mainly testing enable/disable behaviour
|
||||
|
|
|
@ -3,12 +3,16 @@
|
|||
$applicationPath = realpath(dirname(__FILE__) . '/../../application/');
|
||||
$modulePath = realpath(dirname(__FILE__) . '/../../modules/');
|
||||
$libraryPath = realpath(dirname(__FILE__) . '/../../library/');
|
||||
$testLibraryPath = realpath(dirname(__FILE__) . '/library/');
|
||||
$configPath = realpath($libraryPath . '/../config');
|
||||
|
||||
// Is usually done in the application's bootstrap and is used by some of our internals
|
||||
if (!defined('ICINGA_APPDIR')) {
|
||||
define('ICINGA_APPDIR', $applicationPath);
|
||||
}
|
||||
if (!defined('ICINGA_LIBDIR')) {
|
||||
define('ICINGA_LIBDIR', $libraryPath);
|
||||
}
|
||||
|
||||
// This is needed to get the Zend Plugin loader working
|
||||
set_include_path(implode(PATH_SEPARATOR, array($libraryPath, get_include_path())));
|
||||
|
@ -16,6 +20,7 @@ set_include_path(implode(PATH_SEPARATOR, array($libraryPath, get_include_path())
|
|||
require_once($libraryPath . '/Icinga/Application/Loader.php');
|
||||
|
||||
$loader = new Icinga\Application\Loader();
|
||||
$loader->registerNamespace('Tests', $testLibraryPath);
|
||||
$loader->registerNamespace('Icinga', $libraryPath . '/Icinga');
|
||||
$loader->registerNamespace('Icinga\\Form', $applicationPath . '/forms');
|
||||
|
||||
|
|
|
@ -29,9 +29,6 @@
|
|||
|
||||
namespace Tests\Icinga\Application;
|
||||
|
||||
require_once 'Zend/Config/Ini.php';
|
||||
require_once realpath(__DIR__ . '/../../../../../library/Icinga/Application/Config.php');
|
||||
|
||||
use \Icinga\Application\Config as IcingaConfig;
|
||||
|
||||
class ConfigTest extends \PHPUnit_Framework_TestCase
|
||||
|
|
|
@ -2,17 +2,8 @@
|
|||
|
||||
namespace Tests\Icinga\Application;
|
||||
|
||||
require_once __DIR__. '/../../../../../library/Icinga/Exception/ProgrammingError.php';
|
||||
require_once __DIR__. '/../../../../../library/Icinga/Application/Loader.php';
|
||||
|
||||
use Icinga\Application\Loader;
|
||||
|
||||
/**
|
||||
*
|
||||
* Test class for Loader
|
||||
* Created Thu, 07 Feb 2013 10:07:13 +0000
|
||||
*
|
||||
**/
|
||||
class LoaderTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
private static $classFile = 'test/My/Library/TestStruct.php';
|
||||
|
|
|
@ -27,19 +27,11 @@
|
|||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
require_once realpath(__DIR__ . '/../../../../../library/Icinga/Test/BaseTestCase.php');
|
||||
// @codingStandardsIgnoreEnd
|
||||
namespace Tests\Icinga\Application;
|
||||
|
||||
use Icinga\Test\BaseTestCase;
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
require_once BaseTestCase::$libDir . '/Logger/Logger.php';
|
||||
require_once BaseTestCase::$libDir . '/Logger/LogWriter.php';
|
||||
require_once BaseTestCase::$libDir . '/Logger/Writer/StreamWriter.php';
|
||||
// @codingStandardsIgnoreEnd
|
||||
|
||||
use \Zend_Config;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\Logger\Logger;
|
||||
|
||||
class LoggerTest extends BaseTestCase
|
||||
|
|
|
@ -2,16 +2,10 @@
|
|||
|
||||
namespace Tests\Icinga\Application\Module\Manager;
|
||||
|
||||
require_once("../../library/Icinga/Application/Modules/Manager.php");
|
||||
require_once("../../library/Icinga/Exception/ProgrammingError.php");
|
||||
require_once("../../library/Icinga/Exception/ConfigurationError.php");
|
||||
require_once("../../library/Icinga/Exception/SystemPermissionException.php");
|
||||
|
||||
use Icinga\Application\Modules\Manager as ModuleManager;
|
||||
|
||||
class ModuleMock
|
||||
{
|
||||
|
||||
public $name = "";
|
||||
public $dir = "";
|
||||
|
||||
|
@ -105,6 +99,5 @@ class ManagerTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$moduleDir = self::MODULE_TARGET;
|
||||
exec("rm -r $moduleDir/enabledModules");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace Tests\Icinga\Application;
|
|||
*/
|
||||
class ZendDbMock
|
||||
{
|
||||
|
||||
/**
|
||||
* The config that was used in the last call of the factory function
|
||||
*
|
||||
|
|
|
@ -29,36 +29,11 @@
|
|||
|
||||
namespace Tests\Icinga\Authentication;
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
require_once realpath(__DIR__ . '/../../../../../library/Icinga/Test/BaseTestCase.php');
|
||||
// @codingStandardsIgnoreEnd
|
||||
|
||||
use \Icinga\Test\BaseTestCase;
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
require_once 'Zend/Config.php';
|
||||
require_once 'Zend/Config/Ini.php';
|
||||
require_once 'Zend/Db/Adapter/Abstract.php';
|
||||
require_once 'Zend/Db.php';
|
||||
require_once 'Zend/Log.php';
|
||||
require_once BaseTestCase::$libDir . '/Exception/ProgrammingError.php';
|
||||
require_once BaseTestCase::$libDir . '/Util/ConfigAwareFactory.php';
|
||||
require_once BaseTestCase::$libDir . '/Authentication/UserBackend.php';
|
||||
require_once BaseTestCase::$libDir . '/Protocol/Ldap/Exception.php';
|
||||
require_once BaseTestCase::$libDir . '/Application/Config.php';
|
||||
require_once BaseTestCase::$libDir . '/Authentication/Credential.php';
|
||||
require_once BaseTestCase::$libDir . '/Authentication/Backend/DbUserBackend.php';
|
||||
require_once BaseTestCase::$libDir . '/User.php';
|
||||
require_once BaseTestCase::$libDir . '/Application/Logger.php';
|
||||
// @codingStandardsIgnoreEnd
|
||||
|
||||
use \PDO;
|
||||
use \Zend_Db_Adapter_Pdo_Abstract;
|
||||
use \Zend_Config;
|
||||
use \Icinga\Authentication\Backend\DbUserBackend;
|
||||
use \Icinga\Authentication\Credential;
|
||||
use \Icinga\User;
|
||||
use \Icinga\Application\Config;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\Authentication\Backend\DbUserBackend;
|
||||
|
||||
/**
|
||||
* Test Class fpr DbUserBackend
|
||||
|
|
|
@ -29,33 +29,12 @@
|
|||
|
||||
namespace Tests\Icinga\Authentication;
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
require_once realpath(__DIR__ . '/../../../../../library/Icinga/Test/BaseTestCase.php');
|
||||
// @codingStandardsIgnoreEnd
|
||||
|
||||
use Icinga\Authentication\Credential;
|
||||
use \Icinga\Test\BaseTestCase;
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
require_once 'Zend/Config.php';
|
||||
require_once BaseTestCase::$libDir . '/Protocol/Ldap/Connection.php';
|
||||
require_once BaseTestCase::$libDir . '/Protocol/Ldap/Query.php';
|
||||
require_once BaseTestCase::$libDir . '/Authentication/Credential.php';
|
||||
require_once BaseTestCase::$libDir . '/Authentication/UserBackend.php';
|
||||
require_once BaseTestCase::$libDir . '/Authentication/Backend/LdapUserBackend.php';
|
||||
// @codingStandardsIgnoreEnd
|
||||
|
||||
use \Exception;
|
||||
use \Zend_Config;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\Authentication\Backend\LdapUserBackend;
|
||||
use Icinga\Protocol\Ldap\Connection as LdapConnection;
|
||||
|
||||
/**
|
||||
*
|
||||
* Test class for Ldapuserbackend
|
||||
* Created Mon, 10 Jun 2013 07:54:34 +0000
|
||||
*
|
||||
**/
|
||||
class LdapUserBackendTest extends BaseTestCase
|
||||
{
|
||||
// Change this according to your ldap test server
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Tests\Authentication;
|
||||
namespace Tests\Icinga\Authentication;
|
||||
|
||||
use Icinga\Test\BaseTestCase;
|
||||
|
||||
|
@ -35,7 +35,6 @@ use \Zend_Config;
|
|||
use Icinga\Web\Session;
|
||||
use Icinga\Authentication\Manager as AuthManager;
|
||||
use Icinga\Authentication\Credential;
|
||||
use Icinga\Exception\ConfigurationError;
|
||||
use Icinga\Test\Authentication\ErrorProneBackendMock;
|
||||
use Icinga\Test\Authentication\SessionMock;
|
||||
use Icinga\Test\Authentication\BackendMock;
|
||||
|
|
|
@ -29,12 +29,11 @@
|
|||
|
||||
namespace Tests\Icinga\Chart;
|
||||
|
||||
use DOMXPath;
|
||||
use DOMDocument;
|
||||
use \DOMXPath;
|
||||
use \DOMDocument;
|
||||
|
||||
use Icinga\Chart\GridChart;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Test\Icinga\LibraryLoader;
|
||||
|
||||
class GraphChartTest extends BaseTestCase
|
||||
{
|
||||
|
|
|
@ -27,12 +27,11 @@
|
|||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Tests\Chart;
|
||||
namespace Tests\Icinga\Chart;
|
||||
|
||||
use \DOMXPath;
|
||||
use \DOMDocument;
|
||||
|
||||
use Icinga\Chart\GridChart;
|
||||
use Icinga\Chart\PieChart;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga Web 2.
|
||||
|
@ -30,14 +29,8 @@
|
|||
|
||||
namespace Tests\Icinga\PreservingIniWriterTest;
|
||||
|
||||
require_once 'Zend/Config.php';
|
||||
require_once 'Zend/Config/Ini.php';
|
||||
require_once 'Zend/Config/Writer/Ini.php';
|
||||
require_once('../../library/Icinga/Config/IniEditor.php');
|
||||
require_once('../../library/Icinga/Config/PreservingIniWriter.php');
|
||||
|
||||
use \Zend_Config;
|
||||
use Icinga\Config\PreservingIniWriter;
|
||||
use Zend_Config;
|
||||
|
||||
class PreservingIniWriterTest extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
|
|
|
@ -35,20 +35,8 @@ use Icinga\Filter\Type\TextFilter;
|
|||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\Filter\Domain;
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
require_once realpath(__DIR__ . '/../../../../../library/Icinga/Test/BaseTestCase.php');
|
||||
require_once realpath(BaseTestCase::$libDir . '/Filter/QueryProposer.php');
|
||||
require_once realpath(BaseTestCase::$libDir . '/Filter/FilterAttribute.php');
|
||||
require_once realpath(BaseTestCase::$libDir . '/Filter/Domain.php');
|
||||
require_once realpath(BaseTestCase::$libDir . '/Filter/Query/Node.php');
|
||||
require_once realpath(BaseTestCase::$libDir . '/Filter/Type/FilterType.php');
|
||||
require_once realpath(BaseTestCase::$libDir . '/Filter/Type/TextFilter.php');
|
||||
|
||||
// @codingStandardsIgnoreEnd
|
||||
|
||||
class DomainTest extends BaseTestCase
|
||||
{
|
||||
|
||||
public function testDomainRecognitionInQueryString()
|
||||
{
|
||||
$domain = new Domain('host');
|
||||
|
@ -99,5 +87,4 @@ class DomainTest extends BaseTestCase
|
|||
$this->assertEquals($node->right, 'my host', 'Assert a domain to insert the value as the right side of a treenode');
|
||||
$this->assertEquals($node->operator, Node::OPERATOR_EQUALS, 'Assert the correct operator to be set in a single query');
|
||||
}
|
||||
|
||||
}
|
|
@ -27,27 +27,13 @@
|
|||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
|
||||
namespace Tests\Icinga\Filter;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
|
||||
use Icinga\Filter\FilterAttribute;
|
||||
use Icinga\Filter\Filter;
|
||||
use Icinga\Filter\Type\TextFilter;
|
||||
use Icinga\Filter\Query\Node;
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
require_once realpath(__DIR__ . '/../../../../../library/Icinga/Test/BaseTestCase.php');
|
||||
require_once realpath(BaseTestCase::$libDir . '/Filter/QueryProposer.php');
|
||||
require_once realpath(BaseTestCase::$libDir . '/Filter/Filter.php');
|
||||
require_once realpath(BaseTestCase::$libDir . '/Filter/FilterAttribute.php');
|
||||
require_once realpath(BaseTestCase::$libDir . '/Filter/Domain.php');
|
||||
require_once realpath(BaseTestCase::$libDir . '/Filter/Query/Node.php');
|
||||
require_once realpath(BaseTestCase::$libDir . '/Filter/Query/Tree.php');
|
||||
require_once realpath(BaseTestCase::$libDir . '/Filter/Type/FilterType.php');
|
||||
require_once realpath(BaseTestCase::$libDir . '/Filter/Type/TextFilter.php');
|
||||
|
||||
// @codingStandardsIgnoreEnd
|
||||
use Icinga\Test\BaseTestCase;
|
||||
|
||||
class FilterTest extends BaseTestCase
|
||||
{
|
||||
|
@ -77,7 +63,6 @@ class FilterTest extends BaseTestCase
|
|||
$searchEngine->getProposalsForQuery('Host name Is test and Hostname contains'),
|
||||
'Assert only proposals for the last query part being made'
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function testSingleQueryTreeCreation()
|
||||
|
@ -245,7 +230,6 @@ class FilterTest extends BaseTestCase
|
|||
->setHandledAttributes('attr5')
|
||||
);
|
||||
|
||||
|
||||
$query = 'attr1 is not \'Hans wurst\''
|
||||
. ' or attr2 contains something '
|
||||
. ' and attr3 starts with bla'
|
||||
|
@ -298,5 +282,4 @@ class FilterTest extends BaseTestCase
|
|||
'Assert the root->right->right->type node to be an OPERATOR (query :"' . $query . '")'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -27,7 +27,6 @@
|
|||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
|
||||
namespace Tests\Icinga\Filter;
|
||||
|
||||
use Icinga\Filter\Query\Node;
|
||||
|
@ -35,14 +34,6 @@ use Icinga\Filter\FilterAttribute;
|
|||
use Icinga\Filter\Type\FilterType;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
require_once realpath(__DIR__ . '/../../../../../library/Icinga/Test/BaseTestCase.php');
|
||||
require_once realpath(BaseTestCase::$libDir .'/Filter/Query/Node.php');
|
||||
require_once realpath(BaseTestCase::$libDir .'/Filter/QueryProposer.php');
|
||||
require_once realpath(BaseTestCase::$libDir .'/Filter/Domain.php');
|
||||
require_once realpath(BaseTestCase::$libDir .'/Filter/FilterAttribute.php');
|
||||
require_once realpath(BaseTestCase::$libDir .'/Filter/Type/FilterType.php');
|
||||
|
||||
class TypeMock extends FilterType
|
||||
{
|
||||
public function isValidQuery($query)
|
||||
|
@ -119,7 +110,6 @@ class QueryHandlerTest extends BaseTestCase
|
|||
|
||||
public function testOperatorProposal()
|
||||
{
|
||||
|
||||
$handler = new FilterAttribute(new TypeMock());
|
||||
$handler->setField('current_status')
|
||||
->setHandledAttributes('status', 'state', 'current state');
|
||||
|
@ -138,5 +128,4 @@ class QueryHandlerTest extends BaseTestCase
|
|||
$node = $handler->convertToTreeNode('status is not \’some kind of magic\'');
|
||||
$this->assertEquals($node->left, 'current_status', 'Assert status to be set to the field');
|
||||
}
|
||||
|
||||
}
|
|
@ -27,26 +27,14 @@
|
|||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
|
||||
namespace Tests\Icinga\Filter;
|
||||
|
||||
use Icinga\Filter\Type\BooleanFilter;
|
||||
use Icinga\Filter\Type\TimeRangeSpecifier;
|
||||
use Icinga\Filter\Query\Node;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
require_once realpath(__DIR__ . '/../../../../../../library/Icinga/Test/BaseTestCase.php');
|
||||
require_once realpath(BaseTestCase::$libDir .'/Filter/Query/Node.php');
|
||||
require_once realpath(BaseTestCase::$libDir .'/Filter/QueryProposer.php');
|
||||
require_once realpath(BaseTestCase::$libDir .'/Filter/Type/FilterType.php');
|
||||
require_once realpath(BaseTestCase::$libDir .'/Filter/Type/BooleanFilter.php');
|
||||
require_once realpath(BaseTestCase::$libDir .'/Filter/Type/TimeRangeSpecifier.php');
|
||||
// @codingStandardsIgnoreEnd
|
||||
|
||||
class BooleanFilterTest extends BaseTestCase
|
||||
{
|
||||
|
||||
public function testOperatorProposal()
|
||||
{
|
||||
$filter = new BooleanFilter(array());
|
||||
|
@ -124,7 +112,6 @@ class BooleanFilterTest extends BaseTestCase
|
|||
$this->assertEquals(Node::OPERATOR_EQUALS, $node->operator, 'Assert the operator to be equals');
|
||||
$this->assertEquals(1, $node->right[0], 'Assert the value to be 1');
|
||||
|
||||
|
||||
$node = $filter->createTreeNode('is not with problem', 'host_status');
|
||||
$this->assertEquals('host_problem', $node->left, 'Assert the left part of the node to be host_problem');
|
||||
$this->assertEquals(Node::OPERATOR_EQUALS, $node->operator, 'Assert the operator to be equals');
|
||||
|
@ -149,6 +136,5 @@ class BooleanFilterTest extends BaseTestCase
|
|||
$this->assertEquals('host_problem', $node->right->left, 'Assert the right part of the node to be host_problem');
|
||||
$this->assertEquals(Node::OPERATOR_EQUALS, $node->right->operator, 'Assert the operator to be equals');
|
||||
$this->assertEquals(1, $node->right->right[0], 'Assert the value to be 1');
|
||||
|
||||
}
|
||||
}
|
|
@ -33,14 +33,6 @@ use Icinga\Filter\Type\TextFilter;
|
|||
use Icinga\Filter\Query\Node;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
require_once realpath(__DIR__ . '/../../../../../../library/Icinga/Test/BaseTestCase.php');
|
||||
require_once realpath(BaseTestCase::$libDir .'/Filter/Query/Node.php');
|
||||
require_once realpath(BaseTestCase::$libDir .'/Filter/QueryProposer.php');
|
||||
require_once realpath(BaseTestCase::$libDir .'/Filter/Type/FilterType.php');
|
||||
require_once realpath(BaseTestCase::$libDir .'/Filter/Type/TextFilter.php');
|
||||
// @codingStandardsIgnoreEnd
|
||||
|
||||
class TextFilterTest extends BaseTestCase
|
||||
{
|
||||
public function testOperatorProposal()
|
||||
|
@ -65,13 +57,11 @@ class TextFilterTest extends BaseTestCase
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
public function testGetOperatorAndValueFromQuery()
|
||||
{
|
||||
$textFilter = new TextFilter();
|
||||
list($operator, $value) = $textFilter->getOperatorAndValueFromQuery('is not \'something\'');
|
||||
$this->assertEquals(Node::OPERATOR_EQUALS_NOT, $operator, 'Asserting text operators to be split via TextFilter');
|
||||
$this->assertEquals('something', $value, 'Asserting quoted values to be recognized in TextFilter');
|
||||
|
||||
}
|
||||
}
|
|
@ -30,17 +30,8 @@
|
|||
namespace Tests\Icinga\Filter;
|
||||
|
||||
use Icinga\Filter\Type\TimeRangeSpecifier;
|
||||
use Icinga\Filter\Query\Node;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
require_once realpath(__DIR__ . '/../../../../../../library/Icinga/Test/BaseTestCase.php');
|
||||
require_once realpath(BaseTestCase::$libDir .'/Filter/Query/Node.php');
|
||||
require_once realpath(BaseTestCase::$libDir .'/Filter/QueryProposer.php');
|
||||
require_once realpath(BaseTestCase::$libDir .'/Filter/Type/FilterType.php');
|
||||
require_once realpath(BaseTestCase::$libDir .'/Filter/Type/TimeRangeSpecifier.php');
|
||||
// @codingStandardsIgnoreEnd
|
||||
|
||||
class TimeRangeSpecifierTest extends BaseTestCase
|
||||
{
|
||||
public function testIsValid()
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
<?php
|
||||
namespace Icinga\Test;
|
||||
|
||||
abstract class LibraryLoader {
|
||||
|
||||
public static function getBasePath()
|
||||
{
|
||||
$path = realpath(dirname(__FILE__));
|
||||
while (!preg_match('/.*test$/', $path) && $path != '/') {
|
||||
$path = realpath($path.'/../');
|
||||
}
|
||||
return realpath($path.'/../');
|
||||
}
|
||||
|
||||
public static function getLibraryPath()
|
||||
{
|
||||
return realpath(self::getBasePath().'/library/Icinga/');
|
||||
}
|
||||
|
||||
public static function getModulePath($module = '')
|
||||
{
|
||||
return realpath(self::getBasePath().'/module/'.$module);
|
||||
}
|
||||
|
||||
/**
|
||||
* Require all php files in the folder $folder
|
||||
*
|
||||
* @param $folder The path to the folder containing PHP files
|
||||
*/
|
||||
public static function loadFolder($folder, $recursive = true)
|
||||
{
|
||||
$files = scandir($folder);
|
||||
foreach ($files as $file) {
|
||||
if ($file[0] == '.') {
|
||||
continue;
|
||||
}
|
||||
if ($recursive && is_dir(realpath($folder."/".$file))) {
|
||||
|
||||
self::loadFolder(realpath($folder."/".$file));
|
||||
}
|
||||
if (!preg_match('/php$/', $file)) {
|
||||
continue;
|
||||
}
|
||||
require_once(realpath($folder.'/'.$file));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Should be abstract but in php this should not be
|
||||
*/
|
||||
public static function requireLibrary()
|
||||
{
|
||||
}
|
||||
}
|
|
@ -27,12 +27,12 @@
|
|||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Tests\Protocol\Commandpipe;
|
||||
namespace Tests\Icinga\Protocol\Commandpipe;
|
||||
|
||||
use \Zend_Config;
|
||||
use \PHPUnit_Framework_TestCase;
|
||||
use Icinga\Protocol\Commandpipe\Comment;
|
||||
use Icinga\Protocol\Commandpipe\Commandpipe as Commandpipe;
|
||||
use Icinga\Protocol\Commandpipe\CommandPipe;
|
||||
use Icinga\Protocol\Commandpipe\PropertyModifier as MONFLAG;
|
||||
use Icinga\Protocol\Ldap\Exception;
|
||||
use Icinga\Module\Monitoring\Command\AcknowledgeCommand;
|
||||
|
@ -68,7 +68,7 @@ class CommandPipeTest extends PHPUnit_Framework_TestCase
|
|||
/**
|
||||
* Return a @see Icinga\Protocal\CommandPipe\CommandPipe instance set up for the local test pipe
|
||||
*
|
||||
* @return Commandpipe
|
||||
* @return CommandPipe
|
||||
*/
|
||||
private function getLocalTestPipe()
|
||||
{
|
||||
|
@ -83,14 +83,14 @@ class CommandPipeTest extends PHPUnit_Framework_TestCase
|
|||
)
|
||||
);
|
||||
|
||||
return new Commandpipe($cfg);
|
||||
return new CommandPipe($cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a @see Icinga\Protocal\CommandPipe\CommandPipe instance set up
|
||||
* for the local test pipe, but with ssh as the transport layer
|
||||
*
|
||||
* @return Commandpipe
|
||||
* @return CommandPipe
|
||||
*/
|
||||
private function getSSHTestPipe()
|
||||
{
|
||||
|
@ -109,7 +109,7 @@ class CommandPipeTest extends PHPUnit_Framework_TestCase
|
|||
)
|
||||
);
|
||||
|
||||
return new Commandpipe($cfg);
|
||||
return new CommandPipe($cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,20 +1,16 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Protocol\Ldap;
|
||||
require_once '../../library/Icinga/Protocol/Ldap/Query.php';
|
||||
require_once '../../library/Icinga/Protocol/Ldap/Connection.php';
|
||||
require_once '../../library/Icinga/Protocol/Ldap/LdapUtils.php';
|
||||
require_once('Zend/Config.php');
|
||||
/**
|
||||
*
|
||||
* Test class for Query
|
||||
* Created Wed, 13 Mar 2013 12:57:11 +0000
|
||||
*
|
||||
**/
|
||||
|
||||
use \Zend_Config;
|
||||
|
||||
class QueryTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
private function emptySelect()
|
||||
{
|
||||
$config = new \Zend_Config(
|
||||
$config = new Zend_Config(
|
||||
array(
|
||||
'hostname' => 'localhost',
|
||||
'root_dn' => 'dc=example,dc=com',
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
namespace Tests\Icinga\Protocol\Statusdat;
|
||||
|
||||
use \Icinga\Protocol\Statusdat as SD;
|
||||
use \Zend_Config;
|
||||
use Icinga\Protocol\Statusdat\Reader;
|
||||
|
||||
/**
|
||||
* This is a high level test for the whole statusdat component, i.e. all parts put together
|
||||
|
@ -11,7 +12,7 @@ use \Icinga\Protocol\Statusdat as SD;
|
|||
class StatusdatComponentTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function getReader() {
|
||||
$reader = new SD\Reader(new \Zend_Config(array(
|
||||
$reader = new Reader(new Zend_Config(array(
|
||||
"status_file" => dirname(__FILE__)."/status.dat",
|
||||
"object_file" => dirname(__FILE__)."/objects.cache"
|
||||
)),null,true);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Protocol\Statusdat\Exceptions;
|
||||
|
||||
class ParsingException extends RuntimeException
|
||||
|
|
|
@ -4,15 +4,8 @@ namespace Tests\Icinga\Protocol\Statusdat;
|
|||
|
||||
use Icinga\Protocol\Statusdat\Parser;
|
||||
|
||||
/**
|
||||
*
|
||||
* Test class for Parser
|
||||
* Created Wed, 16 Jan 2013 15:15:16 +0000
|
||||
*
|
||||
**/
|
||||
class ParserTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
private function getStringAsFileHandle($string)
|
||||
{
|
||||
$maxsize = strlen($string)*2;
|
||||
|
|
|
@ -1,22 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Tests\Protocol\Statusdat\Query;
|
||||
namespace Tests\Icinga\Protocol\Statusdat\Query;
|
||||
|
||||
use Icinga\Protocol\Statusdat\Query\Expression;
|
||||
|
||||
/**
|
||||
*
|
||||
* Test class for Expression
|
||||
* Created Wed, 16 Jan 2013 15:15:16 +0000
|
||||
*
|
||||
**/
|
||||
class ExpressionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Test for Expression::FromString()
|
||||
*
|
||||
**/
|
||||
public function testFromStringParsing()
|
||||
{
|
||||
$assertions = array(
|
||||
|
@ -76,7 +65,6 @@ class ExpressionTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
public function testNestedComparison()
|
||||
{
|
||||
|
||||
$testArray = array(
|
||||
(object)array(
|
||||
"expression" => "atest",
|
||||
|
@ -118,7 +106,6 @@ class ExpressionTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$result = $expression->filter($testArray);
|
||||
$this->assertEquals(1, count($result));
|
||||
|
||||
}
|
||||
|
||||
public function testCountQuery()
|
||||
|
@ -142,10 +129,6 @@ class ExpressionTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals(1, count($result));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for Expression::Filter()
|
||||
*
|
||||
**/
|
||||
public function testFilter()
|
||||
{
|
||||
$this->markTestIncomplete('testFilter is not implemented yet');
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Tests\Protocol\Statusdat\Query;
|
||||
namespace Tests\Icinga\Protocol\Statusdat\Query;
|
||||
|
||||
/**
|
||||
*
|
||||
* Test class for Group
|
||||
* Created Wed, 16 Jan 2013 15:15:16 +0000
|
||||
*
|
||||
**/
|
||||
use Icinga\Protocol\Statusdat as Statusdat;
|
||||
use Icinga\Protocol\Statusdat;
|
||||
use Icinga\Protocol\Statusdat\Query\IQueryPart;
|
||||
|
||||
class QueryExpressionMock implements Statusdat\Query\IQueryPart
|
||||
class QueryExpressionMock implements IQueryPart
|
||||
{
|
||||
public $rawExpression;
|
||||
public $value;
|
||||
|
@ -20,7 +15,6 @@ class QueryExpressionMock implements Statusdat\Query\IQueryPart
|
|||
{
|
||||
$this->value = array_shift($value);
|
||||
$this->rawExpression = $expression;
|
||||
|
||||
}
|
||||
|
||||
public function filter(array &$base, &$idx = null)
|
||||
|
@ -38,8 +32,6 @@ class QueryExpressionMock implements Statusdat\Query\IQueryPart
|
|||
{
|
||||
// TODO: Implement setQuery() method.
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class GroupTest extends \PHPUnit_Framework_TestCase
|
||||
|
@ -48,7 +40,7 @@ class GroupTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$testQuery = new Statusdat\Query\Group();
|
||||
$value = array(4);
|
||||
$testQuery->fromString("numeric_val >= ?", $value, "Icinga\Tests\Protocol\Statusdat\Query\QueryExpressionMock");
|
||||
$testQuery->fromString("numeric_val >= ?", $value, "Tests\Icinga\Protocol\Statusdat\Query\QueryExpressionMock");
|
||||
$this->assertCount(1, $testQuery->getItems());
|
||||
$this->assertCount(0, $value);
|
||||
|
||||
|
@ -57,14 +49,13 @@ class GroupTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->assertEquals("numeric_val >= ?", $expression->rawExpression);
|
||||
$this->assertEquals(4, $expression->value);
|
||||
|
||||
}
|
||||
|
||||
public function testParsingSimpleAndCondition()
|
||||
{
|
||||
$testQuery = new Statusdat\Query\Group();
|
||||
$value = array(4, 'hosta');
|
||||
$testQuery->fromString("numeric_val >= ? AND host_name = ?", $value, "Icinga\Tests\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());
|
||||
|
@ -83,7 +74,7 @@ class GroupTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$testQuery = new Statusdat\Query\Group();
|
||||
$value = array(4, 'hosta');
|
||||
$testQuery->fromString("numeric_val >= ? OR host_name = ?", $value, "Icinga\Tests\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());
|
||||
|
@ -102,7 +93,7 @@ class GroupTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$testQuery = new Statusdat\Query\Group();
|
||||
$value = array(4, 'service1', 'hosta');
|
||||
$testQuery->fromString("numeric_val >= ? AND (service_description = ? OR host_name = ?)", $value, "Icinga\Tests\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());
|
||||
|
@ -130,7 +121,7 @@ class GroupTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$testQuery = new Statusdat\Query\Group();
|
||||
$value = array(4, 'service1', 'hosta');
|
||||
$testQuery->fromString("numeric_val >= ? AND service_description = ? OR host_name = ?", $value, "Icinga\Tests\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());
|
||||
|
@ -165,7 +156,6 @@ class GroupTest extends \PHPUnit_Framework_TestCase
|
|||
$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)));
|
||||
|
||||
}
|
||||
|
||||
public function testOrFilter()
|
||||
|
|
|
@ -1,22 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Tests\Protocol\Statusdat;
|
||||
namespace Tests\Icinga\Protocol\Statusdat;
|
||||
|
||||
use Icinga\Protocol\Statusdat as Statusdat;
|
||||
use Icinga\Protocol\Statusdat\Query;
|
||||
|
||||
/**
|
||||
*
|
||||
* Test class for Query
|
||||
* Created Wed, 16 Jan 2013 15:15:16 +0000
|
||||
*
|
||||
**/
|
||||
class QueryTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function testSimpleServiceSelect()
|
||||
{
|
||||
$readerMock = $this->getServiceTestReader();
|
||||
$query = new Statusdat\Query($readerMock);
|
||||
$query = new Query($readerMock);
|
||||
$objects = $readerMock->getObjects();
|
||||
|
||||
$result = $query->select()->from("services")->getResult();
|
||||
|
@ -26,41 +19,38 @@ class QueryTest extends \PHPUnit_Framework_TestCase
|
|||
public function testSimpleHostSelect()
|
||||
{
|
||||
$readerMock = $this->getServiceTestReader();
|
||||
$query = new Statusdat\Query($readerMock);
|
||||
$query = new Query($readerMock);
|
||||
$objects = $readerMock->getObjects();
|
||||
|
||||
$result = $query->from("hosts")->getResult();
|
||||
$this->assertCount(count($objects["host"]), $result);
|
||||
|
||||
}
|
||||
|
||||
public function testLimit()
|
||||
{
|
||||
$readerMock = $this->getServiceTestReader();
|
||||
$objects = $readerMock->getObjects();
|
||||
$query = new Statusdat\Query($readerMock);
|
||||
$query = new Query($readerMock);
|
||||
|
||||
$result = $query->from("services")->limit(2)->getResult();
|
||||
$this->assertCount(2, $result);
|
||||
|
||||
}
|
||||
|
||||
public function testOffset()
|
||||
{
|
||||
$readerMock = $this->getServiceTestReader();
|
||||
$objects = $readerMock->getObjects();
|
||||
$query = new Statusdat\Query($readerMock);
|
||||
$query = new Query($readerMock);
|
||||
|
||||
$result = $query->from("services")->limit(2, 4)->getResult();
|
||||
$this->assertCount(2, $result);
|
||||
|
||||
}
|
||||
|
||||
public function testGroupByColumn()
|
||||
{
|
||||
$readerMock = $this->getServiceTestReader();
|
||||
$objects = $readerMock->getObjects();
|
||||
$query = new Statusdat\Query($readerMock);
|
||||
$query = new Query($readerMock);
|
||||
$result = $query->from("services")->groupByColumns("numeric_val")->getResult();
|
||||
$this->assertCount(3,$result);
|
||||
foreach($result as $value) {
|
||||
|
@ -68,28 +58,24 @@ class QueryTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertTrue(isset($value->columns));
|
||||
$this->assertEquals(2,$value->count);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function testOrderedGroupByColumn()
|
||||
{
|
||||
$readerMock = $this->getServiceTestReader();
|
||||
$objects = $readerMock->getObjects();
|
||||
$query = new Statusdat\Query($readerMock);
|
||||
$query = new Query($readerMock);
|
||||
$result = $query->from("services")->order('numeric_val ASC')->groupByColumns("numeric_val")->getResult();
|
||||
$this->assertCount(3,$result);
|
||||
foreach($result as $sstatus) {
|
||||
$this->assertTrue(isset($sstatus->count));
|
||||
$this->assertTrue(isset($sstatus->columns));
|
||||
$this->assertEquals(2, $sstatus->count);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function getServiceTestReader()
|
||||
{
|
||||
require_once('ReaderMock.php');
|
||||
$readerMock = new ReaderMock(array(
|
||||
"host" => array(
|
||||
"hosta" => (object) array(
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace Icinga\Tests\Protocol\Statusdat;
|
||||
namespace Tests\Icinga\Protocol\Statusdat;
|
||||
|
||||
use Icinga\Data\DatasourceInterface;
|
||||
use Icinga\Protocol\Statusdat\IReader;
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Tests\Protocol\Statusdat;
|
||||
namespace Tests\Icinga\Protocol\Statusdat;
|
||||
|
||||
use Icinga\Protocol\Statusdat\Reader as Reader;
|
||||
use Icinga\Protocol\Statusdat\Reader;
|
||||
|
||||
if (!defined('APPLICATION_PATH')) {
|
||||
define("APPLICATION_PATH", "./"); // TODO: test boostrap
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Test class for Reader
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Tests\Protocol\Statusdat;
|
||||
namespace Tests\Icinga\Protocol\Statusdat;
|
||||
|
||||
class RuntimestatecontainerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Test for RuntimeStateContainer::__get()
|
||||
*
|
||||
**/
|
||||
public function testPropertyResolving()
|
||||
{
|
||||
|
||||
$container = new \Icinga\Protocol\Statusdat\RuntimeStateContainer("
|
||||
host_name=test host
|
||||
current_state=0
|
||||
|
@ -22,7 +19,5 @@ class RuntimestatecontainerTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals("test host",$container->host_name);
|
||||
$this->assertEquals($container->test,"test123");
|
||||
$this->assertEquals(0,$container->current_state);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,23 +27,9 @@
|
|||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Authentication;
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
require_once realpath(__DIR__ . '/../../../../../library/Icinga/Test/BaseTestCase.php');
|
||||
// @codingStandardsIgnoreEnd
|
||||
namespace Tests\Icinga\Session;
|
||||
|
||||
use Icinga\Test\BaseTestCase;
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
require_once BaseTestCase::$libDir . '/Web/Session/SessionNamespace.php';
|
||||
require_once BaseTestCase::$libDir . '/Web/Session/Session.php';
|
||||
require_once BaseTestCase::$libDir . '/Web/Session/PhpSession.php';
|
||||
require_once BaseTestCase::$libDir . '/Logger/Logger.php';
|
||||
require_once BaseTestCase::$libDir . '/Exception/ConfigurationError.php';
|
||||
require_once 'Zend/Log.php';
|
||||
// @codingStandardsIgnoreEnd
|
||||
|
||||
use Icinga\Web\Session\PhpSession;
|
||||
|
||||
class PhpSessionTest extends BaseTestCase
|
||||
|
|
|
@ -27,17 +27,10 @@
|
|||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
require_once realpath(__DIR__ . '/../../../../../library/Icinga/Test/BaseTestCase.php');
|
||||
// @codingStandardsIgnoreEnd
|
||||
|
||||
use Icinga\Test\BaseTestCase;
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
require_once BaseTestCase::$libDir . '/Web/Session/SessionNamespace.php';
|
||||
// @codingStandardsIgnoreEnd
|
||||
namespace Tests\Icinga\Session;
|
||||
|
||||
use \Exception;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\Web\Session\SessionNamespace;
|
||||
|
||||
|
||||
|
|
|
@ -29,12 +29,6 @@
|
|||
|
||||
namespace Tests\Icinga\Test;
|
||||
|
||||
require_once 'Zend/Db/Adapter/Pdo/Mysql.php';
|
||||
require_once 'Zend/Db/Adapter/Pdo/Pgsql.php';
|
||||
require_once realpath(__DIR__ . '/../../../../../library/Icinga/Test/BaseTestCase.php');
|
||||
|
||||
use \PDO;
|
||||
use \RuntimeException;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
|
||||
class BaseTestCaseDbTest extends BaseTestCase
|
||||
|
|
|
@ -1,21 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Test\Web\Form\Element;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
|
||||
require_once 'Zend/Form/Element/Text.php';
|
||||
require_once 'Zend/Form/Element/Xhtml.php';
|
||||
require_once realpath(__DIR__ . '/../../../../../../../library/Icinga/Test/BaseTestCase.php');
|
||||
require_once realpath(BaseTestCase::$libDir . '/Application/Icinga.php');
|
||||
require_once realpath(BaseTestCase::$libDir . '/Web/Form/Element/DateTimePicker.php');
|
||||
require_once realpath(BaseTestCase::$libDir . '/Web/Form/Validator/DateTimeValidator.php');
|
||||
require_once realpath(BaseTestCase::$libDir . '/Util/ConfigAwareFactory.php');
|
||||
require_once realpath(BaseTestCase::$libDir . '/Util/DateTimeFactory.php');
|
||||
namespace Tests\Icinga\Web\Form\Element;
|
||||
|
||||
use \DateTimeZone;
|
||||
use Icinga\Form\Config\Authentication\BaseBackendForm;
|
||||
use \Icinga\Web\Form\Element\DateTimePicker;
|
||||
use \Icinga\Util\DateTimeFactory;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\Util\DateTimeFactory;
|
||||
use Icinga\Web\Form\Element\DateTimePicker;
|
||||
|
||||
class DateTimeTest extends BaseTestCase
|
||||
{
|
||||
|
|
|
@ -27,13 +27,10 @@
|
|||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Test\Web\Form\Validator;
|
||||
|
||||
require_once('Zend/Validate/Abstract.php');
|
||||
require_once(realpath('../../library/Icinga/Web/Form/Validator/DateFormatValidator.php'));
|
||||
namespace Tests\Icinga\Web\Form\Validator;
|
||||
|
||||
use \PHPUnit_Framework_TestCase;
|
||||
use \Icinga\Web\Form\Validator\DateFormatValidator;
|
||||
use Icinga\Web\Form\Validator\DateFormatValidator;
|
||||
|
||||
class DateFormatValidatorTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
|
|
@ -27,17 +27,13 @@
|
|||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Test\Web\Form\Validator;
|
||||
|
||||
require_once('Zend/Validate/Abstract.php');
|
||||
require_once(realpath('../../library/Icinga/Web/Form/Validator/TimeFormatValidator.php'));
|
||||
namespace Tests\Icinga\Web\Form\Validator;
|
||||
|
||||
use \PHPUnit_Framework_TestCase;
|
||||
use \Icinga\Web\Form\Validator\TimeFormatValidator;
|
||||
use Icinga\Web\Form\Validator\TimeFormatValidator;
|
||||
|
||||
class TimeFormatValidatorTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function testValidateCorrectInput()
|
||||
{
|
||||
$validator = new TimeFormatValidator();
|
||||
|
|
|
@ -27,18 +27,13 @@
|
|||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Test\Web\Form\Validator;
|
||||
|
||||
require_once('Zend/Validate/Abstract.php');
|
||||
require_once(realpath('../../library/Icinga/Web/Form/Validator/WritablePathValidator.php'));
|
||||
require_once(realpath('../../library/Icinga/Application/Config.php'));
|
||||
namespace Tests\Icinga\Web\Form\Validator;
|
||||
|
||||
use \PHPUnit_Framework_TestCase;
|
||||
use \Icinga\Web\Form\Validator\WritablePathValidator;
|
||||
use Icinga\Web\Form\Validator\WritablePathValidator;
|
||||
|
||||
class WritablePathValidatorTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function testValidateInputWithWritablePath()
|
||||
{
|
||||
$validator = new WritablePathValidator();
|
||||
|
|
|
@ -2,13 +2,6 @@
|
|||
|
||||
namespace Tests\Icinga\Web;
|
||||
|
||||
require_once('Zend/Form.php');
|
||||
require_once 'Zend/Test/PHPUnit/ControllerTestCase.php';
|
||||
|
||||
require_once('../../library/Icinga/Web/Form.php');
|
||||
require_once('../../library/Icinga/Exception/ProgrammingError.php');
|
||||
require_once('../../library/Icinga/Web/Form/InvalidCSRFTokenException.php');
|
||||
|
||||
use Icinga\Web\Form;
|
||||
use \Zend_Test_PHPUnit_ControllerTestCase;
|
||||
|
||||
|
|
|
@ -2,20 +2,10 @@
|
|||
|
||||
namespace Tests\Icinga\Web\Hook\Configuration;
|
||||
|
||||
require_once '../../library/Icinga/Web/Hook/Configuration/ConfigurationTabInterface.php';
|
||||
require_once '../../library/Icinga/Web/Hook/Configuration/ConfigurationTab.php';
|
||||
require_once '../../library/Icinga/Web/Hook/Configuration/ConfigurationTabBuilder.php';
|
||||
require_once '../../library/Icinga/Web/Hook.php';
|
||||
require_once '../../library/Icinga/Web/Widget/Widget.php';
|
||||
require_once '../../library/Icinga/Web/Widget/Tabs.php';
|
||||
require_once '../../library/Icinga/Web/Widget/Tab.php';
|
||||
require_once '../../library/Icinga/Exception/ProgrammingError.php';
|
||||
|
||||
use Icinga\Web\Hook\Configuration\ConfigurationTab;
|
||||
use Icinga\Web\Hook;
|
||||
use Icinga\Web\Url;
|
||||
use Icinga\Web\Widget\Tabs;
|
||||
use PHPUnit_Framework_TestResult;
|
||||
|
||||
class RequestMock
|
||||
{
|
||||
|
|
|
@ -2,10 +2,6 @@
|
|||
|
||||
namespace Tests\Icinga\Web\Hook\Configuration;
|
||||
|
||||
require_once '../../library/Icinga/Web/Hook/Configuration/ConfigurationTabInterface.php';
|
||||
require_once '../../library/Icinga/Web/Hook/Configuration/ConfigurationTab.php';
|
||||
require_once '../../library/Icinga/Exception/ProgrammingError.php';
|
||||
|
||||
use Icinga\Web\Hook\Configuration\ConfigurationTab;
|
||||
|
||||
class ConfigurationTabTest extends \PHPUnit_Framework_TestCase
|
||||
|
|
|
@ -1,19 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Icinga\Web;
|
||||
/**
|
||||
*
|
||||
* Test class for Hook
|
||||
* Created Fri, 22 Mar 2013 09:44:40 +0000
|
||||
*
|
||||
**/
|
||||
require_once("../../library/Icinga/Exception/ProgrammingError.php");
|
||||
require_once("../../library/Icinga/Web/Hook.php");
|
||||
|
||||
require_once("Zend/Log.php");
|
||||
require_once("../../library/Icinga/Application/Logger.php");
|
||||
|
||||
use Icinga\Web\Hook as Hook;
|
||||
use Icinga\Web\Hook;
|
||||
|
||||
class Base
|
||||
{
|
||||
|
|
|
@ -2,18 +2,6 @@
|
|||
|
||||
namespace Tests\Icinga\Web;
|
||||
|
||||
require_once "../../library/Icinga/Exception/ProgrammingError.php";
|
||||
require_once "../../library/Icinga/Web/Notification.php";
|
||||
require_once "../../library/Icinga/Application/Platform.php";
|
||||
require_once "../../library/Icinga/Application/Logger.php";
|
||||
|
||||
require_once "Zend/Session/Namespace.php";
|
||||
require_once "Zend/Config.php";
|
||||
require_once "Zend/Log.php";
|
||||
require_once "Zend/Session.php";
|
||||
require_once "Zend/Log/Writer/Abstract.php";
|
||||
require_once "Zend/Log/Writer/Stream.php";
|
||||
|
||||
use Icinga\Logger\Logger;
|
||||
use Icinga\Web\Notification;
|
||||
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Tests\Web\Paginator\Adapter;
|
||||
namespace Tests\Icinga\Web\Paginator\Adapter;
|
||||
|
||||
use PHPUnit_Framework_TestCase;
|
||||
use Zend_Config;
|
||||
use \Zend_Config;
|
||||
use \PHPUnit_Framework_TestCase;
|
||||
use Icinga\Protocol\Statusdat\Reader;
|
||||
use Icinga\Web\Paginator\Adapter\QueryAdapter;
|
||||
use Icinga\Module\Monitoring\Backend;
|
||||
use Tests\Icinga\Protocol\Statusdat\StatusdatTestLoader;
|
||||
use Icinga\Web\Paginator\Adapter\QueryAdapter;
|
||||
|
||||
class QueryAdapterTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Tests\Web\Paginator\ScrollingStyle;
|
||||
namespace Tests\Icinga\Web\Paginator\ScrollingStyle;
|
||||
|
||||
require_once('Icinga/Web/Paginator/ScrollingStyle/SlidingWithBorder.php');
|
||||
// @codingStandardsIgnoreStart
|
||||
require_once realpath(ICINGA_LIBDIR . '/Icinga/Web/Paginator/ScrollingStyle/SlidingWithBorder.php');
|
||||
// @codingStandardsIgnoreEnd
|
||||
|
||||
use Zend_Config;
|
||||
use Zend_Paginator_Adapter_Interface;
|
||||
use Icinga\Module\Monitoring\Backend\Statusdat;
|
||||
use \Zend_Config;
|
||||
use \Zend_Paginator_Adapter_Interface;
|
||||
use Icinga\Protocol\Statusdat\Reader;
|
||||
use Icinga\Web\Paginator\Adapter\QueryAdapter;
|
||||
use Tests\Icinga\Protocol\Statusdat\StatusdatTestLoader;
|
||||
use Icinga\Module\Monitoring\Backend;
|
||||
|
||||
class TestPaginatorAdapter implements Zend_Paginator_Adapter_Interface
|
||||
|
@ -54,12 +54,6 @@ class TestPaginatorAdapter implements Zend_Paginator_Adapter_Interface
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Test class for Slidingwithborder
|
||||
* Created Wed, 16 Jan 2013 15:15:16 +0000
|
||||
*
|
||||
**/
|
||||
class SlidingwithborderTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
private $cacheDir;
|
||||
|
@ -145,5 +139,4 @@ class SlidingwithborderTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals('...', $pages[3]);
|
||||
$this->assertEquals('...', $pages[14]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,20 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Icinga\Web;
|
||||
require_once('../../library/Icinga/Web/Url.php');
|
||||
require_once('library/Icinga/Web/RequestMock.php');
|
||||
|
||||
use Icinga\Web\Url;
|
||||
use Tests\Icinga\Web\RequestMock;
|
||||
|
||||
/**
|
||||
* Tests for the Icinga\Web\Url class that provides convenient access to Url manipulation method
|
||||
*
|
||||
*
|
||||
*/
|
||||
class UrlTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Tests whether a simple Url without query parameters and baseUrl is correctly parsed and returns correct Urls
|
||||
*
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
namespace Tests\Icinga\Web;
|
||||
|
||||
require_once('Zend/View/Abstract.php');
|
||||
use \Zend_View_Abstract;
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,32 +29,19 @@
|
|||
|
||||
namespace Tests\Icinga\Web\Widget;
|
||||
|
||||
require_once('../../library/Icinga/Web/Widget/Widget.php');
|
||||
require_once('../../library/Icinga/Web/Widget/Tab.php');
|
||||
require_once('../../library/Icinga/Web/Url.php');
|
||||
require_once('library/Icinga/Web/RequestMock.php');
|
||||
require_once('library/Icinga/Web/ViewMock.php');
|
||||
require_once('Zend/View/Abstract.php');
|
||||
|
||||
use Icinga\Web\View;
|
||||
use \PHPUnit_Framework_TestCase;
|
||||
use Tests\Icinga\Web\RequestMock;
|
||||
use Tests\Icinga\Web\ViewMock;
|
||||
use Icinga\Web\Widget\Tab;
|
||||
use Icinga\Web\Url;
|
||||
use Tests\Icinga\Web\RequestMock;
|
||||
use \Zend_View_Abstract;
|
||||
use \PHPUnit_Framework_TestCase;
|
||||
|
||||
use Tests\Icinga\Web\ViewMock;
|
||||
|
||||
/**
|
||||
* Test creation and rendering of tabs
|
||||
*
|
||||
*/
|
||||
class TabTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Test whether rendering a tab without URL is done correctly
|
||||
*
|
||||
*/
|
||||
public function testRenderWithoutUrl()
|
||||
{
|
||||
|
@ -73,7 +60,6 @@ class TabTest extends PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* Test whether rendering an active tab adds the 'class' property
|
||||
*
|
||||
*/
|
||||
public function testActiveTab()
|
||||
{
|
||||
|
@ -93,7 +79,6 @@ class TabTest extends PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* Test whether rendering a tab with URL adds a n >a< tag correctly
|
||||
*
|
||||
*/
|
||||
public function testTabWithUrl()
|
||||
{
|
||||
|
@ -117,7 +102,6 @@ class TabTest extends PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* Test wheter the 'icon' property adds an img tag
|
||||
*
|
||||
*/
|
||||
public function testTabWithIconImage()
|
||||
{
|
||||
|
@ -141,7 +125,6 @@ class TabTest extends PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* Test wheter the iconCls property adds an i tag with the icon
|
||||
*
|
||||
*/
|
||||
public function testTabWithIconClass()
|
||||
{
|
||||
|
|
|
@ -29,32 +29,17 @@
|
|||
|
||||
namespace Tests\Icinga\Web\Widget;
|
||||
|
||||
require_once('../../library/Icinga/Web/Widget/Widget.php');
|
||||
require_once('../../library/Icinga/Web/Widget/Tab.php');
|
||||
require_once('../../library/Icinga/Web/Widget/Tabs.php');
|
||||
require_once('../../library/Icinga/Web/Url.php');
|
||||
|
||||
require_once('library/Icinga/Web/ViewMock.php');
|
||||
require_once('Zend/View/Abstract.php');
|
||||
|
||||
use Icinga\Web\View;
|
||||
use Icinga\Web\Url;
|
||||
use Icinga\Web\Widget\Tabs;
|
||||
use Tests\Icinga\Web\ViewMock;
|
||||
|
||||
use \Zend_View_Abstract;
|
||||
use \PHPUnit_Framework_TestCase;
|
||||
use Tests\Icinga\Web\ViewMock;
|
||||
use Icinga\Web\Widget\Tabs;
|
||||
|
||||
/**
|
||||
* Test rendering of tabs and corretct tab management
|
||||
*
|
||||
*/
|
||||
class TabsTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Test adding tabs and asserting for correct count
|
||||
*
|
||||
*/
|
||||
public function testAddTabs()
|
||||
{
|
||||
|
@ -77,7 +62,6 @@ class TabsTest extends PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* Test rendering of tabs when no dropdown is requested
|
||||
*
|
||||
*/
|
||||
public function testRenderTabsWithoutDropdown()
|
||||
{
|
||||
|
@ -94,7 +78,6 @@ class TabsTest extends PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* Test rendering of tabs when dropdown is requested
|
||||
*
|
||||
*/
|
||||
public function testRenderDropdown()
|
||||
{
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Icinga2-Web regression test
|
||||
* (c) 2013 Icinga Development Team
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Tests\Icinga\Regression;
|
||||
|
||||
|
@ -12,7 +10,6 @@ namespace Tests\Icinga\Regression;
|
|||
* Bogus regression test
|
||||
*
|
||||
* @see https://dev.icinga.org/issues/4102
|
||||
* @package Tests\Icinga\Regression
|
||||
*/
|
||||
class Bug4102Test extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
<?php
|
||||
namespace {
|
||||
if (!function_exists('t')) {
|
||||
function t() {
|
||||
return func_get_arg(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('mt')) {
|
||||
function mt() {
|
||||
return func_get_arg(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace Tests\Icinga\Regression
|
||||
{
|
||||
|
||||
use Icinga\Form\Authentication\LoginForm;
|
||||
|
||||
require_once 'Zend/Test/PHPUnit/ControllerTestCase.php';
|
||||
require_once 'Zend/Form.php';
|
||||
require_once 'Zend/View.php';
|
||||
require_once 'Zend/Form/Element/Submit.php';
|
||||
require_once 'Zend/Form/Element/Reset.php';
|
||||
require_once 'Zend/Form/Element/Checkbox.php';
|
||||
require_once 'Zend/Form/Element/Hidden.php';
|
||||
require_once 'Zend/Validate/Date.php';
|
||||
require_once '../../library/Icinga/Web/Form.php';
|
||||
require_once realpath('../../application/forms/Authentication/LoginForm.php');
|
||||
|
||||
class LoginMaskBrokenRegression_4459Test extends \Zend_Test_PHPUnit_ControllerTestCase
|
||||
{
|
||||
|
||||
public function testShowLoginForm()
|
||||
{
|
||||
$view = new \Zend_View();
|
||||
$form = new LoginForm();
|
||||
$form->buildForm();
|
||||
$rendered = $form->render($view);
|
||||
|
||||
$this->assertContains("<form", $rendered, "Asserting a form being returned when displaying the login form");
|
||||
}
|
||||
|
||||
public function testSubmitLoginForm()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$request->setMethod("POST")->setPost(
|
||||
array(
|
||||
"username" => "test",
|
||||
"password" => "test",
|
||||
"btn_submit" => "1"
|
||||
)
|
||||
);
|
||||
|
||||
$view = new \Zend_View();
|
||||
$form = new LoginForm();
|
||||
$form->setRequest($request);
|
||||
$form->buildForm();
|
||||
$this->assertTrue($form->isSubmittedAndValid());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue