diff --git a/lib/Alchemy/Phrasea/TaskManager/Log/AbstractLogFile.php b/lib/Alchemy/Phrasea/TaskManager/Log/AbstractLogFile.php index bdc03bed1b..10608d3ba7 100644 --- a/lib/Alchemy/Phrasea/TaskManager/Log/AbstractLogFile.php +++ b/lib/Alchemy/Phrasea/TaskManager/Log/AbstractLogFile.php @@ -66,7 +66,7 @@ abstract class AbstractLogFile implements LogFileInterface */ public function clear($version = '') { - file_put_contents($this->getPath($version), sprintf("File cleared %s\n", date('r'))); + file_put_contents($this->getPath($version), sprintf("[%s] File cleared\n", date(\DateTime::ATOM))); } /** diff --git a/lib/Alchemy/Phrasea/TaskManager/Log/LogFileInterface.php b/lib/Alchemy/Phrasea/TaskManager/Log/LogFileInterface.php index be33b80393..15628b6d3a 100644 --- a/lib/Alchemy/Phrasea/TaskManager/Log/LogFileInterface.php +++ b/lib/Alchemy/Phrasea/TaskManager/Log/LogFileInterface.php @@ -28,7 +28,7 @@ interface LogFileInterface * @param string $version * @return string */ - public function getPath($version); + public function getPath($version = ''); /** * Returns the content of a logfile. @@ -36,7 +36,7 @@ interface LogFileInterface * @param string $version * @return string */ - public function getContent($version); + public function getContent($version = ''); /** * Streams the content of a logfile. @@ -46,14 +46,14 @@ interface LogFileInterface * @param string $version * @return Closure */ - public function getContentStream($version); + public function getContentStream($version = ''); /** * Clears the content of a logfile. * * @param string $version */ - public function clear($version); + public function clear($version = ''); /** * Returns true if the logfile exists diff --git a/tests/Alchemy/Tests/Phrasea/TaskManager/Log/LogFileTestCase.php b/tests/Alchemy/Tests/Phrasea/TaskManager/Log/LogFileTestCase.php index 480eda6864..120f88945a 100644 --- a/tests/Alchemy/Tests/Phrasea/TaskManager/Log/LogFileTestCase.php +++ b/tests/Alchemy/Tests/Phrasea/TaskManager/Log/LogFileTestCase.php @@ -60,7 +60,9 @@ abstract class LogFileTestCase extends \PhraseanetTestCase $log = $this->getLogFile($this->root); file_put_contents($log->getPath(), 'hello world'); $log->clear(); - $this->assertSame('', $log->getContent()); + $matches = []; + $this->assertEquals(1, preg_match('/^\[(.*)\] File cleared/', $log->getContent(), $matches)); + $this->assertDateAtom($matches[1]); } /**