mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-28 08:14:03 +02:00
Fix broken files in Statusdat Expression handler
The function tokens in the Expression handler didn't work after they were rewritten, as the rewrite was missing in certain files. This is fixed now refs #4246
This commit is contained in:
parent
2172937138
commit
f898e2e367
@ -212,10 +212,10 @@ class Expression implements IQueryPart
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->CB == "IS_IN") {
|
if ($this->CB == "isIn") {
|
||||||
return count(array_intersect($values, $this->value)) > 0;
|
return count(array_intersect($values, $this->value)) > 0;
|
||||||
}
|
}
|
||||||
if ($this->CB == "IS_NOT_IN") {
|
if ($this->CB == "isNotIn") {
|
||||||
return count(array_intersect($values, $this->value)) == 0;
|
return count(array_intersect($values, $this->value)) == 0;
|
||||||
}
|
}
|
||||||
if ($this->function) {
|
if ($this->function) {
|
||||||
|
@ -23,14 +23,14 @@ class ExpressionTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testFromStringParsing()
|
public function testFromStringParsing()
|
||||||
{
|
{
|
||||||
$assertions = array(
|
$assertions = array(
|
||||||
"expression > ?" => "IS_GREATER",
|
"expression > ?" => "isGreater",
|
||||||
"expression >= ?" => "isGreaterEq",
|
"expression >= ?" => "isGreaterEq",
|
||||||
"expression <= ?" => "isLessEq",
|
"expression <= ?" => "isLessEq",
|
||||||
"expression < ?" => "isLess",
|
"expression < ?" => "isLess",
|
||||||
"expression = ?" => "isEqual",
|
"expression = ?" => "isEqual",
|
||||||
"expression != ?" => "isNotEqual",
|
"expression != ?" => "isNotEqual",
|
||||||
"expression like ?" => "isLike",
|
"expression like ?" => "isLike",
|
||||||
"expression IN ? " => "IS_IN"
|
"expression IN ? " => "isIn"
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($assertions as $query => $callback) {
|
foreach ($assertions as $query => $callback) {
|
||||||
@ -126,7 +126,8 @@ class ExpressionTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCountQuery() {
|
public function testCountQuery()
|
||||||
|
{
|
||||||
$testArray = array(
|
$testArray = array(
|
||||||
(object)array(
|
(object)array(
|
||||||
"expression" => "atest",
|
"expression" => "atest",
|
||||||
|
@ -45,7 +45,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testFileCaching() {
|
public function testFileCaching() {
|
||||||
$parser = new ParserMock();
|
$parser = new ParserMock();
|
||||||
@system("rm ./tmp/zend_cache*");
|
@system("rm /tmp/zend_cache*");
|
||||||
$parser->runtime = array("host"=>array(
|
$parser->runtime = array("host"=>array(
|
||||||
"test" => (object) array(
|
"test" => (object) array(
|
||||||
"host_name" => "test"
|
"host_name" => "test"
|
||||||
@ -54,21 +54,21 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$object_file = tempnam("./dir","object");
|
$object_file = tempnam("./dir","object");
|
||||||
$status_file = tempnam("./dir","status");
|
$status_file = tempnam("./dir","status");
|
||||||
$reader = new Reader(new ConfigMock(array(
|
$reader = new Reader(new ConfigMock(array(
|
||||||
"cache_path" => "./tmp",
|
"cache_path" => "/tmp",
|
||||||
"objects_file" => $object_file,
|
"objects_file" => $object_file,
|
||||||
"status_file" => $status_file
|
"status_file" => $status_file
|
||||||
)),$parser);
|
)),$parser);
|
||||||
unlink($object_file);
|
unlink($object_file);
|
||||||
unlink($status_file);
|
unlink($status_file);
|
||||||
$this->assertTrue(file_exists("./tmp/zend_cache---objects".md5($object_file)));
|
$this->assertTrue(file_exists("/tmp/zend_cache---objects".md5($object_file)));
|
||||||
$this->assertTrue(file_exists("./tmp/zend_cache---state".md5($object_file)));
|
$this->assertTrue(file_exists("/tmp/zend_cache---state".md5($object_file)));
|
||||||
system("rm ./tmp/zend_cache*");
|
system("rm /tmp/zend_cache*");
|
||||||
}
|
}
|
||||||
public function testEmptyFileException() {
|
public function testEmptyFileException() {
|
||||||
$this->setExpectedException("Icinga\Exception\ConfigurationError");
|
$this->setExpectedException("Icinga\Exception\ConfigurationError");
|
||||||
$parser = new ParserMock();
|
$parser = new ParserMock();
|
||||||
$reader = new Reader(new ConfigMock(array(
|
$reader = new Reader(new ConfigMock(array(
|
||||||
"cache_path" => "./tmp",
|
"cache_path" => "/tmp",
|
||||||
"objects_file" => "",
|
"objects_file" => "",
|
||||||
"status_file" => "",
|
"status_file" => "",
|
||||||
)),$parser);
|
)),$parser);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user