loosen tests for mtime and ctime a bit

This commit is contained in:
Robin Appelman 2012-03-22 19:54:24 +01:00
parent 5b03de9a66
commit 0a93d4eccf
1 changed files with 10 additions and 8 deletions

View File

@ -135,10 +135,12 @@ abstract class Test_FileStorage extends UnitTestCase {
$ctimeEnd=time(); $ctimeEnd=time();
$cTime=$this->instance->filectime('/lorem.txt'); $cTime=$this->instance->filectime('/lorem.txt');
$mTime=$this->instance->filemtime('/lorem.txt'); $mTime=$this->instance->filemtime('/lorem.txt');
$this->assertTrue($ctimeStart<=$cTime); if($cTime!=-1){//not everything can support ctime
$this->assertTrue($cTime<=$ctimeEnd); $this->assertTrue(($ctimeStart-1)<=$cTime);
$this->assertTrue($ctimeStart<=$mTime); $this->assertTrue($cTime<=($ctimeEnd+1));
$this->assertTrue($mTime<=$ctimeEnd); }
$this->assertTrue(($ctimeStart-1)<=$mTime);
$this->assertTrue($mTime<=($ctimeEnd+1));
$this->assertEqual(filesize($textFile),$this->instance->filesize('/lorem.txt')); $this->assertEqual(filesize($textFile),$this->instance->filesize('/lorem.txt'));
$stat=$this->instance->stat('/lorem.txt'); $stat=$this->instance->stat('/lorem.txt');
@ -153,8 +155,8 @@ abstract class Test_FileStorage extends UnitTestCase {
$originalCTime=$cTime; $originalCTime=$cTime;
$cTime=$this->instance->filectime('/lorem.txt'); $cTime=$this->instance->filectime('/lorem.txt');
$mTime=$this->instance->filemtime('/lorem.txt'); $mTime=$this->instance->filemtime('/lorem.txt');
$this->assertTrue($mtimeStart<=$mTime); $this->assertTrue(($mtimeStart-1)<=$mTime);
$this->assertTrue($mTime<=$mtimeEnd); $this->assertTrue($mTime<=($mtimeEnd+1));
$this->assertEqual($cTime,$originalCTime); $this->assertEqual($cTime,$originalCTime);
if($this->instance->touch('/lorem.txt',100)!==false){ if($this->instance->touch('/lorem.txt',100)!==false){
@ -170,8 +172,8 @@ abstract class Test_FileStorage extends UnitTestCase {
$mtimeEnd=time(); $mtimeEnd=time();
$originalCTime=$cTime; $originalCTime=$cTime;
$mTime=$this->instance->filemtime('/lorem.txt'); $mTime=$this->instance->filemtime('/lorem.txt');
$this->assertTrue($mtimeStart<=$mTime); $this->assertTrue(($mtimeStart-1)<=$mTime);
$this->assertTrue($mTime<=$mtimeEnd); $this->assertTrue($mTime<=($mtimeEnd+1));
} }
public function testSearch(){ public function testSearch(){