#PHRAS-846 time 1h

fix test
This commit is contained in:
Jean-Yves Gaulier
2015-12-28 17:24:13 +01:00
parent d5536d4195
commit d2ef455ef8
3 changed files with 8 additions and 6 deletions

View File

@@ -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)));
}
/**

View File

@@ -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

View File

@@ -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]);
}
/**