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;
|
||||
}
|
||||
|
||||
if ($this->CB == "IS_IN") {
|
||||
if ($this->CB == "isIn") {
|
||||
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;
|
||||
}
|
||||
if ($this->function) {
|
||||
|
|
|
@ -23,14 +23,14 @@ class ExpressionTest extends \PHPUnit_Framework_TestCase
|
|||
public function testFromStringParsing()
|
||||
{
|
||||
$assertions = array(
|
||||
"expression > ?" => "IS_GREATER",
|
||||
"expression > ?" => "isGreater",
|
||||
"expression >= ?" => "isGreaterEq",
|
||||
"expression <= ?" => "isLessEq",
|
||||
"expression < ?" => "isLess",
|
||||
"expression = ?" => "isEqual",
|
||||
"expression != ?" => "isNotEqual",
|
||||
"expression like ?" => "isLike",
|
||||
"expression IN ? " => "IS_IN"
|
||||
"expression IN ? " => "isIn"
|
||||
);
|
||||
|
||||
foreach ($assertions as $query => $callback) {
|
||||
|
@ -126,7 +126,8 @@ class ExpressionTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
}
|
||||
|
||||
public function testCountQuery() {
|
||||
public function testCountQuery()
|
||||
{
|
||||
$testArray = array(
|
||||
(object)array(
|
||||
"expression" => "atest",
|
||||
|
|
|
@ -45,7 +45,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
public function testFileCaching() {
|
||||
$parser = new ParserMock();
|
||||
@system("rm ./tmp/zend_cache*");
|
||||
@system("rm /tmp/zend_cache*");
|
||||
$parser->runtime = array("host"=>array(
|
||||
"test" => (object) array(
|
||||
"host_name" => "test"
|
||||
|
@ -54,21 +54,21 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
|
|||
$object_file = tempnam("./dir","object");
|
||||
$status_file = tempnam("./dir","status");
|
||||
$reader = new Reader(new ConfigMock(array(
|
||||
"cache_path" => "./tmp",
|
||||
"cache_path" => "/tmp",
|
||||
"objects_file" => $object_file,
|
||||
"status_file" => $status_file
|
||||
)),$parser);
|
||||
unlink($object_file);
|
||||
unlink($status_file);
|
||||
$this->assertTrue(file_exists("./tmp/zend_cache---objects".md5($object_file)));
|
||||
$this->assertTrue(file_exists("./tmp/zend_cache---state".md5($object_file)));
|
||||
system("rm ./tmp/zend_cache*");
|
||||
$this->assertTrue(file_exists("/tmp/zend_cache---objects".md5($object_file)));
|
||||
$this->assertTrue(file_exists("/tmp/zend_cache---state".md5($object_file)));
|
||||
system("rm /tmp/zend_cache*");
|
||||
}
|
||||
public function testEmptyFileException() {
|
||||
$this->setExpectedException("Icinga\Exception\ConfigurationError");
|
||||
$parser = new ParserMock();
|
||||
$reader = new Reader(new ConfigMock(array(
|
||||
"cache_path" => "./tmp",
|
||||
"cache_path" => "/tmp",
|
||||
"objects_file" => "",
|
||||
"status_file" => "",
|
||||
)),$parser);
|
||||
|
|
Loading…
Reference in New Issue