Fix phpcs complaints

This commit is contained in:
Thomas Gelf 2017-01-13 19:47:54 +01:00
parent f6fca75eae
commit 9e771f2d5a
33 changed files with 174 additions and 147 deletions

View File

@ -12,4 +12,3 @@ use Icinga\Module\Director\Cli\ObjectsCommand;
class CommandsCommand extends ObjectsCommand
{
}

View File

@ -12,4 +12,3 @@ use Icinga\Module\Director\Cli\ObjectsCommand;
class HostsCommand extends ObjectsCommand
{
}

View File

@ -12,7 +12,7 @@ class ServicesetController extends ObjectController
public function init()
{
if ($host = $this->params->get('host')) {
if ($host = $this->params->get('host')) {
$this->host = IcingaHost::load($host, $this->db());
}

View File

@ -84,7 +84,7 @@ class IcingaNotificationForm extends DirectorObjectForm
}
/**
* @return self
* @return $this
*/
protected function addUsersElement()
{
@ -109,7 +109,7 @@ class IcingaNotificationForm extends DirectorObjectForm
}
/**
* @return self
* @return $this
*/
protected function addUsergroupsElement()
{
@ -256,4 +256,4 @@ class IcingaNotificationForm extends DirectorObjectForm
return $db->fetchPairs($select);
}
}
}

View File

@ -62,7 +62,7 @@ class IcingaServiceSetForm extends DirectorObjectForm
protected function setupHost()
{
$object = $this->object();
$object = $this->object();
if ($this->hasBeenSent()) {
$object->set('object_name', $this->getSentValue('imports'));
$object->set('imports', $object->object_name);

View File

@ -362,7 +362,7 @@ class SyncPropertyForm extends DirectorObjectForm
$this->removeElement('source_column');
if ($sourceColumn !== self::EXPRESSION) {
$object->source_expression = $sourceColumn;
$object->source_expression = $sourceColumn;
}
$destination = $this->getValue('destination_field');

View File

@ -24,7 +24,7 @@ class IcingaHostTable extends QuickTable
);
}
protected function getActionUrl($row)
protected function getActionUrl($row)
{
return $this->url('director/host', array('name' => $row->host));
}

View File

@ -50,11 +50,11 @@ class IcingaServiceTable extends QuickTable
if (empty($extra)) {
if ($row->check_command_id) {
$htm .= ' ' . $v->qlink(
'Create apply-rule',
'director/service/add',
array('apply' => $row->service),
array('class' => 'icon-plus')
);
'Create apply-rule',
'director/service/add',
array('apply' => $row->service),
array('class' => 'icon-plus')
);
}
} else {
@ -67,8 +67,7 @@ class IcingaServiceTable extends QuickTable
$prettyFilter = AssignRenderer::forFilter(
Filter::fromQueryString($service->assign_filter)
)->renderAssign();
}
catch (IcingaException $e) {
} catch (IcingaException $e) {
// ignore errors in filter rendering
$prettyFilter = 'Error in Filter rendering: ' . $e->getMessage();
}

View File

@ -84,8 +84,7 @@ class LegacyDeploymentApi implements DeploymentApiInterface
// try to expire old deployments
foreach ($uncollected as $name => $deployment) {
/** @var DirectorDeploymentLog $deployment */
if (
$deployment->get('dump_succeeded') === 'n'
if ($deployment->get('dump_succeeded') === 'n'
|| $deployment->get('startup_succeeded') === null
) {
$start_time = strtotime($deployment->start_time);
@ -100,16 +99,13 @@ class LegacyDeploymentApi implements DeploymentApiInterface
}
foreach ($this->listModuleStages($moduleName) as $stage) {
if (
array_key_exists($stage, $uncollected)
if (array_key_exists($stage, $uncollected)
&& $uncollected[$stage]->get('startup_succeeded') === null
) {
continue;
}
elseif ($stage === $currentStage) {
} elseif ($stage === $currentStage) {
continue;
}
else {
} else {
$this->deleteStage($moduleName, $stage);
}
}
@ -132,15 +128,15 @@ class LegacyDeploymentApi implements DeploymentApiInterface
return $linkTargetName;
} else {
throw new IcingaException(
'Active stage link pointing to a invalid target: %s -> %s', $path, $linkTarget
'Active stage link pointing to a invalid target: %s -> %s',
$path,
$linkTarget
);
}
}
else {
} else {
throw new IcingaException('Active stage is not a symlink: %s', $path);
}
}
else {
} else {
return false;
}
}
@ -170,14 +166,13 @@ class LegacyDeploymentApi implements DeploymentApiInterface
while ($file = readdir($dh)) {
if ($file === '.' || $file === '..') {
continue;
}
elseif (
is_dir($this->deploymentPath . DIRECTORY_SEPARATOR . $file)
} elseif (is_dir($this->deploymentPath . DIRECTORY_SEPARATOR . $file)
&& substr($file, 0, 9) === 'director-'
) {
$stages[] = $file;
}
}
return $stages;
}
@ -190,8 +185,7 @@ class LegacyDeploymentApi implements DeploymentApiInterface
if (! file_exists($filePath)) {
throw new IcingaException('Could not find file %s', $filePath);
}
else {
} else {
return file_get_contents($filePath);
}
}
@ -267,8 +261,7 @@ class LegacyDeploymentApi implements DeploymentApiInterface
if (file_exists($path)) {
throw new IcingaException('Stage "%s" does already exist at: ', $stage, $path);
}
else {
} else {
try {
mkdir($path);
} catch (Exception $e) {
@ -291,6 +284,7 @@ class LegacyDeploymentApi implements DeploymentApiInterface
if ($fh === null) {
throw new IcingaException('Could not open file "%s" for writing.', $fullPath);
}
fwrite($fh, $content);
fclose($fh);
}
@ -315,8 +309,7 @@ class LegacyDeploymentApi implements DeploymentApiInterface
if ($this->activationScript === null || trim($this->activationScript) === '') {
// skip activation, could be done by external cron worker
return true;
}
else {
} else {
$command = sprintf('%s %s 2>&1', escapeshellcmd($this->activationScript), escapeshellarg($stage));
$output = null;
$rc = null;
@ -339,7 +332,7 @@ class LegacyDeploymentApi implements DeploymentApiInterface
*
* @throws IcingaException When directory could not be opened
*/
protected function listDirectoryContents($path, $depth=0)
protected function listDirectoryContents($path, $depth = 0)
{
$dh = @opendir($path);
if ($dh === null) {
@ -351,20 +344,20 @@ class LegacyDeploymentApi implements DeploymentApiInterface
$fullPath = $path . DIRECTORY_SEPARATOR . $file;
if ($file === '.' || $file === '..') {
continue;
}
elseif (is_dir($fullPath)) {
} elseif (is_dir($fullPath)) {
$subdirFiles = $this->listDirectoryContents($fullPath, $depth + 1);
foreach ($subdirFiles as $subFile) {
$files[] = $file . DIRECTORY_SEPARATOR . $subFile;
}
}
else {
} else {
$files[] = $file;
}
}
if ($depth === 0) {
sort($files);
}
return $files;
}
@ -390,11 +383,9 @@ class LegacyDeploymentApi implements DeploymentApiInterface
{
if ($this->deploymentPath === null) {
throw new IcingaException('Deployment path is not configured for legacy config!');
}
elseif (! is_dir($this->deploymentPath)) {
} elseif (! is_dir($this->deploymentPath)) {
throw new IcingaException('Deployment path is not a directory: %s', $this->deploymentPath);
}
elseif (! is_writeable($this->deploymentPath)) {
} elseif (! is_writeable($this->deploymentPath)) {
throw new IcingaException('Deployment path is not a writeable: %s', $this->deploymentPath);
}
}
@ -445,13 +436,16 @@ class LegacyDeploymentApi implements DeploymentApiInterface
* @from https://php.net/manual/de/function.rmdir.php#108113
* @param $dir
*/
protected static function rrmdir($dir) {
foreach(glob($dir . '/*') as $file) {
if(is_dir($file))
protected static function rrmdir($dir)
{
foreach (glob($dir . '/*') as $file) {
if (is_dir($file)) {
static::rrmdir($file);
else
} else {
unlink($file);
}
}
rmdir($dir);
}
}

View File

@ -21,4 +21,4 @@ class DbConnection extends IcingaDbConnection
return (int) $db->fetchOne($query) === 1;
}
}
}

View File

@ -50,6 +50,7 @@ class IcingaObjectFilterRenderer
/**
* @param Filter $filter
* @return string
*/
protected function renderFilter(Filter $filter)
{
@ -122,11 +123,11 @@ class IcingaObjectFilterRenderer
protected function renderFilterExpression(FilterExpression $filter)
{
$query = $this->query;
$column = $query->getAliasforRequiredFilterColumn($filter->getColumn());
$column = $query->getAliasForRequiredFilterColumn($filter->getColumn());
return $query->whereToSql(
$column,
$filter->getSign(),
$filter->getExpression()
);
}
}
}

View File

@ -97,7 +97,7 @@ class IcingaObjectQuery
return $this;
}
public function list()
public function listNames()
{
return $this->db->fetchCol(
$this->baseQuery
@ -135,10 +135,11 @@ class IcingaObjectQuery
/**
* @param $column
*
* @return string
* @throws NotFoundError
* @throws NotImplementedError
*/
public function getAliasforRequiredFilterColumn($column)
public function getAliasForRequiredFilterColumn($column)
{
$dot = strpos($column, '.');
list($key, $sub) = $this->splitFilterKey($column);
@ -215,7 +216,7 @@ class IcingaObjectQuery
}
$cnt = 1;
{
do {
$cnt++;
if (! $this->hasAlias($alias . $cnt)) {
return $alias . $cnt;

View File

@ -4,4 +4,6 @@ namespace Icinga\Module\Director\Exception;
use Icinga\Exception\IcingaException;
class DuplicateKeyException extends IcingaException {}
class DuplicateKeyException extends IcingaException
{
}

View File

@ -4,4 +4,6 @@ namespace Icinga\Module\Director\Exception;
use Icinga\Exception\IcingaException;
class NestingError extends IcingaException {}
class NestingError extends IcingaException
{
}

View File

@ -67,7 +67,7 @@ class AssignRenderer
$column,
$expression
);
} else if (substr($column, -7) === '.groups') {
} elseif (substr($column, -7) === '.groups') {
return sprintf(
'%s in %s',
$expression,

View File

@ -81,8 +81,7 @@ class IcingaConfig
{
if ($this->isLegacy()) {
return $this->deploymentModeV1;
}
else {
} else {
throw new ProgrammingError('There is no deployment mode for Icinga 2 config format!');
}
}
@ -504,7 +503,8 @@ class IcingaConfig
sprintf(
'director/%s/001-director-basics',
$this->connection->getDefaultGlobalZoneName()
), '.cfg'
),
'.cfg'
)->prepend(
$this->renderLegacyDefaultNotification()
);

View File

@ -351,8 +351,7 @@ class Sync
if ($object instanceof IcingaService) {
if (strstr($destinationKeyPattern, '${host}') && $object->host_id === null) {
continue;
}
elseif (strstr($destinationKeyPattern, '${service_set}') && $object->service_set_id === null) {
} elseif (strstr($destinationKeyPattern, '${service_set}') && $object->service_set_id === null) {
continue;
}
}
@ -454,7 +453,7 @@ class Sync
}
foreach ($newProps as $prop => $value) {
// TODO: data type?
// TODO: data type?
$object->set($prop, $value);
}
@ -615,10 +614,12 @@ class Sync
if ($object !== null && $object instanceof IcingaObject) {
throw new IcingaException(
'Exception while syncing %s %s: %s',
get_class($object), $object->get('object_name'), $e->getMessage(), $e
get_class($object),
$object->get('object_name'),
$e->getMessage(),
$e
);
}
else {
} else {
throw $e;
}
}

View File

@ -61,17 +61,15 @@ class IcingaEndpoint extends IcingaObject
$user = $this->getApiUser();
$client->setCredentials(
// TODO: $user->client_dn,
// TODO: $user->client_dn,
$user->object_name,
$user->password
);
return new CoreApi($client);
}
elseif ($format === 'v1') {
} elseif ($format === 'v1') {
return new LegacyDeploymentApi($this->connection);
}
else {
} else {
throw new ProgrammingError('Unsupported config format: %s', $format);
}
}

View File

@ -337,8 +337,14 @@ class IcingaHost extends IcingaObject
return '';
}
/**
* @codingStandardsIgnoreStart
*
* @return string
*/
protected function renderLegacyDisplay_Name()
{
// @codingStandardsIgnoreEnd
return c1::renderKeyValue('display_name', $this->display_name);
}

View File

@ -80,7 +80,7 @@ class IcingaHostGroup extends IcingaObjectGroup
$this->properties['members'] = $allMembers;
$this->legacyZoneHostgroupFile($config, 0)
->addLegacyObject($this);
} else if ($deploymentMode == 'masterless') {
} elseif ($deploymentMode == 'masterless') {
// nothing to add
} else {
throw new ProgrammingError('Unsupported deployment mode: %s' . $deploymentMode);
@ -96,7 +96,8 @@ class IcingaHostGroup extends IcingaObjectGroup
$zone = $this->connection->getDefaultGlobalZoneName();
}
return $config->configFile(
'director/' . $zone . '/hostgroups', '.cfg'
'director/' . $zone . '/hostgroups',
'.cfg'
);
}
@ -112,9 +113,12 @@ class IcingaHostGroup extends IcingaObjectGroup
* Note: rendered with renderLegacyMembers()
*
* @return string
*
* @codingStandardsIgnoreStart
*/
protected function renderLegacyAssign_filter()
{
// @codingStandardsIgnoreEnd
return '';
}
}

View File

@ -1440,7 +1440,8 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
if (! $this->isSupportedInLegacy()) {
$config->configFile(
'director/ignored-objects', '.cfg'
'director/ignored-objects',
'.cfg'
)->prepend(
sprintf(
"# Not supported for legacy config: %s object_name=%s\n",
@ -1455,8 +1456,7 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
$deploymentMode = $config->getDeploymentMode();
if ($deploymentMode === 'active-passive') {
if (
$this->getSingleResolvedProperty('zone_id')
if ($this->getSingleResolvedProperty('zone_id')
&& array_key_exists('enable_active_checks', $this->defaultProperties)
) {
$passive = clone($this);
@ -1467,11 +1467,9 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
'.cfg'
)->addLegacyObject($passive);
}
}
elseif ($deploymentMode === 'masterless') {
} elseif ($deploymentMode === 'masterless') {
// no additional config
}
else {
} else {
throw new ProgrammingError('Unsupported deployment mode: %s' .$deploymentMode);
}
@ -1691,8 +1689,10 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
protected function renderLegacyProperties()
{
$out = '';
$blacklist = array_merge($this->propertiesNotForRendering,
array() /* $this->prioritizedProperties */);
$blacklist = array_merge(
$this->propertiesNotForRendering,
array() /* $this->prioritizedProperties */
);
foreach ($this->properties as $key => $value) {
if (in_array($key, $blacklist)) {
@ -1957,10 +1957,16 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
);
}
/**
* @param $value
* @return string
* @codingStandardsIgnoreStart
*/
protected function renderLegacyCheck_command($value)
{
// @codingStandardsIgnoreEnd
$args = array();
foreach($this->vars() as $k => $v) {
foreach ($this->vars() as $k => $v) {
if (substr($k, 0, 3) == 'ARG') {
$args[] = $v->getValue();
}
@ -1970,8 +1976,14 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
return c1::renderKeyValue('check_command', join('!', $args));
}
/**
* @param $value
* @return string
* @codingStandardsIgnoreStart
*/
protected function renderLegacyEvent_command($value)
{
// @codingStandardsIgnoreEnd
return c1::renderKeyValue('event_handler', $value);
}
@ -1999,8 +2011,7 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
$str = '';
// Set notification settings for the object to suppress warnings
if (
array_key_exists('enable_notifications', $this->defaultProperties)
if (array_key_exists('enable_notifications', $this->defaultProperties)
&& $this->isTemplate()
) {
$str .= c1::renderKeyValue('notification_period', 'notification_none');
@ -2010,8 +2021,7 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
// force rendering of check_command when ARG1 is set
if ($this->supportsCustomVars() && array_key_exists('check_command_id', $this->defaultProperties)) {
if (
$this->vars()->get('ARG1') !== null
if ($this->vars()->get('ARG1') !== null
&& $this->get('check_command') === null
) {
$command = $this->getResolvedRelated('check_command');
@ -2123,8 +2133,7 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
if (preg_match('/^\s{4}([^\t]+)\t+(.+)$/', $line, $m)) {
if ($len - strlen($m[1]) < 0) {
$fill = ' ';
}
else {
} else {
$fill = str_repeat(' ', $len - strlen($m[1]));
}
@ -2289,9 +2298,9 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
foreach ($class::prefetchAll($db) as $row) {
$result[$row->object_name] = $row;
}
return $result;
}
else {
} else {
return $class::loadAll($db, $query, $keyColumn);
}
}

View File

@ -179,8 +179,7 @@ class IcingaService extends IcingaObject
{
if ($this->get('service_set_id') !== null) {
return;
}
else if ($this->isApplyRule()) {
} elseif ($this->isApplyRule()) {
$this->renderLegacyApplyToConfig($config);
} else {
parent::renderToLegacyConfig($config);
@ -325,7 +324,7 @@ class IcingaService extends IcingaObject
{
$output = '';
if ($this->hasBeenAssignedToHostTemplate()) {
if ($this->hasBeenAssignedToHostTemplate()) {
// TODO: use assignment renderer?
$filter = sprintf(
'assign where %s in host.templates',
@ -335,7 +334,7 @@ class IcingaService extends IcingaObject
$output .= "\n " . $filter . "\n";
}
// A hand-crafted command endpoint overrides use_agent
// A hand-crafted command endpoint overrides use_agent
if ($this->command_endpoint_id !== null) {
return $output;
}

View File

@ -7,7 +7,6 @@ use Icinga\Exception\IcingaException;
use Icinga\Module\Director\Exception\DuplicateKeyException;
use Icinga\Module\Director\IcingaConfig\IcingaConfig;
class IcingaServiceSet extends IcingaObject
{
protected $table = 'icinga_service_set';
@ -54,8 +53,7 @@ class IcingaServiceSet extends IcingaObject
if (count($keyComponents) === 1) {
$this->set('object_name', $keyComponents[0]);
$this->set('object_type', 'template');
}
else {
} else {
throw new IcingaException('Can not parse key: %s', $key);
}
} else {

View File

@ -118,8 +118,13 @@ class PlainObjectRenderer
*/
protected static function isAssocArray($arr)
{
if (! is_array($arr)) return false;
if (array() === $arr) return false;
if (! is_array($arr)) {
return false;
}
if (array() === $arr) {
return false;
}
return array_keys($arr) !== range(0, count($arr) - 1);
}
}

View File

@ -94,4 +94,4 @@ class StartupLogRenderer
)
) . $suffix;
}
}
}

View File

@ -66,9 +66,10 @@ abstract class ActionController extends Controller
{
$auth = $this->Auth();
foreach ($permissions as $permission)
if ($auth->hasPermission($permission)) {
return;
foreach ($permissions as $permission) {
if ($auth->hasPermission($permission)) {
return;
}
}
throw new SecurityException(
@ -267,14 +268,14 @@ abstract class ActionController extends Controller
if ($this->params->get('modifyFilter')) {
$this->view->addLink .= ' ' . $this->view->qlink(
$this->translate('Show unfiltered'),
$this->getRequest()->getUrl()->setParams(array()),
null,
array(
'class' => 'icon-cancel',
'data-base-target' => '_self',
)
);
$this->translate('Show unfiltered'),
$this->getRequest()->getUrl()->setParams(array()),
null,
array(
'class' => 'icon-cancel',
'data-base-target' => '_self',
)
);
} else {
$this->view->addLink .= ' ' . $this->view->qlink(
$this->translate('Filter'),
@ -410,12 +411,4 @@ abstract class ActionController extends Controller
return $this->monitoring;
}
protected function IcingaConfig() {
if ($this->icingaConfig === null) {
$this->icingaConfig = new IcingaConfig($this->db);
}
return $this->icingaConfig;
}
}

View File

@ -56,8 +56,7 @@ abstract class ObjectsController extends ActionController
/** @var IcingaObject $baseType */
$baseType = $this->getObjectClassname($type);
$baseObject = $baseType::create(array());
}
else {
} else {
$baseObject = $object;
}

View File

@ -28,8 +28,14 @@ class Boolean extends ZfSelect
return null;
}
/**
* @param string $value
* @param string $key
* @codingStandardsIgnoreStart
*/
protected function _filterValue(&$value, &$key)
{
// @codingStandardsIgnoreEnd
if ($value === true) {
$value = 'y';
} elseif ($value === false) {

View File

@ -3,14 +3,15 @@
use Icinga\Application\Cli;
## Load Composer environment, if existing
call_user_func(function() {
call_user_func(function () {
$MODULE_HOME = dirname(dirname(__FILE__));
$composer_load = $MODULE_HOME . '/vendor/autoload.php';
if (file_exists($composer_load)) {
require_once $composer_load;
# include Icinga Web
ini_set('include_path',
ini_set(
'include_path',
$MODULE_HOME . '/vendor/icinga/icingaweb2/library'
. PATH_SEPARATOR . $MODULE_HOME . '/vendor/icinga/icingaweb2/library/vendor'
. PATH_SEPARATOR . ini_get('include_path')
@ -18,7 +19,7 @@ call_user_func(function() {
}
});
call_user_func(function() {
call_user_func(function () {
error_reporting(E_ALL | E_STRICT);
$testbase = __DIR__;

View File

@ -14,7 +14,7 @@ class StateFilterSetTest extends BaseTestCase
public function testIsEmptyForAnUnstoredUser()
{
$this->assertEquals(
$this->assertEquals(
array(),
StateFilterSet::forIcingaObject(
IcingaUser::create(),

View File

@ -370,7 +370,7 @@ class IcingaHostTest extends BaseTestCase
$host->zone = '___TEST___zone';
$host->renderToConfig($config);
$this->assertEquals(
array('zones.d/___TEST___zone/hosts.conf'),
array('zones.d/___TEST___zone/hosts.conf'),
$config->getFileNames()
);
@ -483,7 +483,8 @@ class IcingaHostTest extends BaseTestCase
IcingaHost::loadWithApiKey('No___such___key', $db);
}
public function testEnumProperties() {
public function testEnumProperties()
{
if ($this->skipForMissingDb()) {
return;
}
@ -499,7 +500,8 @@ class IcingaHostTest extends BaseTestCase
);
}
public function testEnumPropertiesWithCustomVars() {
public function testEnumPropertiesWithCustomVars()
{
if ($this->skipForMissingDb()) {
return;
}
@ -524,7 +526,8 @@ class IcingaHostTest extends BaseTestCase
);
}
public function testEnumPropertiesWithPrefix() {
public function testEnumPropertiesWithPrefix()
{
if ($this->skipForMissingDb()) {
return;
}
@ -549,7 +552,8 @@ class IcingaHostTest extends BaseTestCase
);
}
public function testEnumPropertiesWithFilter() {
public function testEnumPropertiesWithFilter()
{
if ($this->skipForMissingDb()) {
return;
}
@ -583,7 +587,8 @@ class IcingaHostTest extends BaseTestCase
);
}
public function testEnumPropertiesWithArrayFilter() {
public function testEnumPropertiesWithArrayFilter()
{
if ($this->skipForMissingDb()) {
return;
}
@ -647,7 +652,8 @@ class IcingaHostTest extends BaseTestCase
));
}
protected function getDefaultHostProperties($prefix = '') {
protected function getDefaultHostProperties($prefix = '')
{
return array(
"${prefix}name" => "name",
"${prefix}action_url" => "action_url",
@ -705,7 +711,8 @@ class IcingaHostTest extends BaseTestCase
}
}
protected function deleteDatafields() {
protected function deleteDatafields()
{
$db = $this->getDb();
$dbAdapter = $db->getDbAdapter();
$kill = array($this->testDatafieldName);

View File

@ -90,8 +90,8 @@ class IcingaNotificationTest extends BaseTestCase
$user2->object_name
)
),
$n->toPlainObject(null, true))
;
$n->toPlainObject(null, true)
);
$n = IcingaNotification::load($n->object_name, $db);
$this->assertEquals(
@ -103,8 +103,8 @@ class IcingaNotificationTest extends BaseTestCase
$user2->object_name
)
),
$n->toPlainObject(null, true))
;
$n->toPlainObject(null, true)
);
$this->assertEquals(
array(),
$n->toPlainObject()->user_groups

View File

@ -2,11 +2,10 @@
namespace Tests\Icinga\Module\Director\Objects;
use Icinga\Data\Db\DbQuery;
use Icinga\Module\Director\Objects\IcingaServiceSet;
use Icinga\Module\Director\Test\IcingaObjectTestCase;
class IcingaServiceSetTestIcinga extends IcingaObjectTestCase
class IcingaServiceSetTest extends IcingaObjectTestCase
{
protected $table = 'icinga_service_set';
protected $testObjectName = '___TEST___set';
@ -33,7 +32,7 @@ class IcingaServiceSetTestIcinga extends IcingaObjectTestCase
$this->assertTrue($set->hasBeenModified());
$set->store();
$set->set('assign_filter','host.name=foobar');
$set->set('assign_filter', 'host.name=foobar');
$this->assertTrue($set->hasBeenModified());
$set->store();
@ -179,7 +178,12 @@ class IcingaServiceSetTestIcinga extends IcingaObjectTestCase
$ids = $db->fetchCol($query);
$this->assertEmpty($ids,
sprintf('Found dangling service_set\'s for a host, without the host in database: %s', join(', ', $ids)));
$this->assertEmpty(
$ids,
sprintf(
'Found dangling service_set\'s for a host, without the host in database: %s',
join(', ', $ids)
)
);
}
}