Fix errors in tests

refs #6011
This commit is contained in:
Johannes Meyer 2014-04-25 16:39:54 +02:00
parent 07da92ee42
commit 1df56cbfb9
4 changed files with 27 additions and 5 deletions

View File

@ -4,6 +4,10 @@
namespace Tests\Icinga\Form\Config\Authentication; namespace Tests\Icinga\Form\Config\Authentication;
// Necessary as some of these tests disable phpunit's preservation
// of the global state (e.g. autoloaders are in the global state)
require_once realpath(dirname(__FILE__) . '/../../../../bootstrap.php');
use Mockery; use Mockery;
use Icinga\Test\BaseTestCase; use Icinga\Test\BaseTestCase;
use Icinga\Form\Config\Authentication\DbBackendForm; use Icinga\Form\Config\Authentication\DbBackendForm;
@ -18,6 +22,7 @@ class DbBackendFormTest extends BaseTestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled
*/ */
public function testValidBackendIsValid() public function testValidBackendIsValid()
{ {
@ -40,6 +45,7 @@ class DbBackendFormTest extends BaseTestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled
*/ */
public function testInvalidBackendIsNotValid() public function testInvalidBackendIsNotValid()
{ {

View File

@ -4,6 +4,10 @@
namespace Tests\Icinga\Form\Config\Authentication; namespace Tests\Icinga\Form\Config\Authentication;
// Necessary as some of these tests disable phpunit's preservation
// of the global state (e.g. autoloaders are in the global state)
require_once realpath(dirname(__FILE__) . '/../../../../bootstrap.php');
use Mockery; use Mockery;
use Icinga\Test\BaseTestCase; use Icinga\Test\BaseTestCase;
use Icinga\Form\Config\Authentication\LdapBackendForm; use Icinga\Form\Config\Authentication\LdapBackendForm;
@ -18,6 +22,7 @@ class LdapBackendFormTest extends BaseTestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled
*/ */
public function testValidBackendIsValid() public function testValidBackendIsValid()
{ {
@ -40,6 +45,7 @@ class LdapBackendFormTest extends BaseTestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled
*/ */
public function testInvalidBackendIsNotValid() public function testInvalidBackendIsNotValid()
{ {

View File

@ -4,6 +4,10 @@
namespace Tests\Icinga\Form\Config\Resource; namespace Tests\Icinga\Form\Config\Resource;
// Necessary as some of these tests disable phpunit's preservation
// of the global state (e.g. autoloaders are in the global state)
require_once realpath(dirname(__FILE__) . '/../../../../bootstrap.php');
use Mockery; use Mockery;
use Zend_Config; use Zend_Config;
use Icinga\Test\BaseTestCase; use Icinga\Test\BaseTestCase;
@ -64,6 +68,7 @@ class ResourceFormTest extends BaseTestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled
*/ */
public function testValidDbResourceIsValid() public function testValidDbResourceIsValid()
{ {
@ -80,6 +85,7 @@ class ResourceFormTest extends BaseTestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled
*/ */
public function testInvalidDbResourceIsNotValid() public function testInvalidDbResourceIsNotValid()
{ {
@ -96,6 +102,7 @@ class ResourceFormTest extends BaseTestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled
*/ */
public function testValidLdapResourceIsValid() public function testValidLdapResourceIsValid()
{ {
@ -112,6 +119,7 @@ class ResourceFormTest extends BaseTestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled
*/ */
public function testInvalidLdapResourceIsNotValid() public function testInvalidLdapResourceIsNotValid()
{ {
@ -128,6 +136,7 @@ class ResourceFormTest extends BaseTestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled
*/ */
public function testValidLivestatusResourceIsValid() public function testValidLivestatusResourceIsValid()
{ {
@ -145,6 +154,7 @@ class ResourceFormTest extends BaseTestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled
*/ */
public function testInvalidLivestatusResourceIsNotValid() public function testInvalidLivestatusResourceIsNotValid()
{ {

View File

@ -30,7 +30,7 @@ class ConfigTest extends BaseTestCase
public function testAppConfig() public function testAppConfig()
{ {
$config = IcingaConfig::app(); $config = IcingaConfig::app('config', true);
$this->assertEquals(1, $config->logging->enable, 'Unexpected value retrieved from config file'); $this->assertEquals(1, $config->logging->enable, 'Unexpected value retrieved from config file');
// Test non-existent property where null is the default value // Test non-existent property where null is the default value
$this->assertEquals( $this->assertEquals(
@ -70,28 +70,28 @@ class ConfigTest extends BaseTestCase
$config->backend->db->toArray() $config->backend->db->toArray()
); );
// Test singleton // Test singleton
$this->assertEquals($config, IcingaConfig::app()); $this->assertEquals($config, IcingaConfig::app('config'));
$this->assertEquals(array('logging', 'backend'), $config->keys()); $this->assertEquals(array('logging', 'backend'), $config->keys());
$this->assertEquals(array('enable'), $config->keys('logging')); $this->assertEquals(array('enable'), $config->keys('logging'));
} }
public function testAppExtraConfig() public function testAppExtraConfig()
{ {
$extraConfig = IcingaConfig::app('extra'); $extraConfig = IcingaConfig::app('extra', true);
$this->assertEquals(1, $extraConfig->meta->version); $this->assertEquals(1, $extraConfig->meta->version);
$this->assertEquals($extraConfig, IcingaConfig::app('extra')); $this->assertEquals($extraConfig, IcingaConfig::app('extra'));
} }
public function testModuleConfig() public function testModuleConfig()
{ {
$moduleConfig = IcingaConfig::module('amodule'); $moduleConfig = IcingaConfig::module('amodule', 'config', true);
$this->assertEquals(1, $moduleConfig->menu->get('breadcrumb')); $this->assertEquals(1, $moduleConfig->menu->get('breadcrumb'));
$this->assertEquals($moduleConfig, IcingaConfig::module('amodule')); $this->assertEquals($moduleConfig, IcingaConfig::module('amodule'));
} }
public function testModuleExtraConfig() public function testModuleExtraConfig()
{ {
$moduleExtraConfig = IcingaConfig::module('amodule', 'extra'); $moduleExtraConfig = IcingaConfig::module('amodule', 'extra', true);
$this->assertEquals( $this->assertEquals(
'inetOrgPerson', 'inetOrgPerson',
$moduleExtraConfig->ldap->user->get('ldap_object_class') $moduleExtraConfig->ldap->user->get('ldap_object_class')