2014-05-13 21:08:07 +02:00
|
|
|
<?php
|
|
|
|
class ListLogsJobTest extends AbstractTest
|
|
|
|
{
|
|
|
|
public function testListing()
|
|
|
|
{
|
|
|
|
$this->grantAccess('listLogs');
|
|
|
|
|
2014-05-15 10:32:53 +02:00
|
|
|
Core::getConfig()->main->logsPath = TextHelper::absolutePath(Core::getConfig()->rootDir . '/tests/logs/test1.log');
|
2014-05-13 21:08:07 +02:00
|
|
|
Logger::init();
|
|
|
|
|
|
|
|
Logger::log('nonsense');
|
|
|
|
|
2014-05-15 10:32:53 +02:00
|
|
|
Core::getConfig()->main->logsPath = TextHelper::absolutePath(Core::getConfig()->rootDir . '/tests/logs/test2.log');
|
2014-05-13 21:08:07 +02:00
|
|
|
Logger::init();
|
|
|
|
|
|
|
|
Logger::log('nonsense');
|
|
|
|
|
|
|
|
$ret = $this->assert->doesNotThrow(function()
|
|
|
|
{
|
|
|
|
return Api::run(new ListLogsJob(), []);
|
|
|
|
});
|
|
|
|
|
|
|
|
$this->assert->areEqual(2, count($ret));
|
|
|
|
$this->assert->areEqual('test2.log', $ret[0]);
|
|
|
|
$this->assert->areEqual('test1.log', $ret[1]);
|
|
|
|
}
|
|
|
|
}
|