Make the statusdat reader test using its own cache location

refs #4639
This commit is contained in:
Johannes Meyer 2014-04-09 14:56:25 +02:00
parent f9324032cb
commit e1793c9ea1
3 changed files with 8 additions and 6 deletions

1
.gitignore vendored
View File

@ -22,6 +22,7 @@ test/php/bin/extcmd_test
# misc test output
test/frontend/static/public
test/php/library/Icinga/Protocol/Statusdat/.cache
# Generated API documentation
doc/api

View File

@ -69,18 +69,19 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
)
)
);
$cacheDir = realpath(dirname(__FILE__) . '/.cache');
$object_file = tempnam("./dir", "object");
$status_file = tempnam("./dir", "status");
$reader = new Reader(new ConfigMock(array(
"cache_path" => "/tmp",
"object_file" => $object_file,
"status_file" => $status_file
"cache_path" => $cacheDir,
"object_file" => $object_file,
"status_file" => $status_file
)), $parser);
unlink($object_file);
unlink($status_file);
$this->assertTrue(file_exists("/tmp/zend_cache---object" . md5($object_file)));
$this->assertTrue(file_exists("/tmp/zend_cache---state" . md5($object_file)));
system("rm /tmp/zend_cache*");
$this->assertTrue(file_exists($cacheDir . '/zend_cache---object' . md5($object_file)));
$this->assertTrue(file_exists($cacheDir . '/zend_cache---state' . md5($object_file)));
system('rm ' . $cacheDir . '/zend_cache*');
}
public function testEmptyFileException()