diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2014-06-27 12:14:31 +0200 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2014-06-27 12:14:31 +0200 |
commit | ab93f1949dab8e71299b27552e527beb04f89de4 (patch) | |
tree | be3317a079dda0ddf3803f9b162c594068272697 /tests | |
parent | f96a535f80594697061e6405b6243946acc68df1 (diff) | |
download | nextcloud-server-ab93f1949dab8e71299b27552e527beb04f89de4.tar.gz nextcloud-server-ab93f1949dab8e71299b27552e527beb04f89de4.zip |
update hasUpdated description, overwrtie testStat for objectstore test
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/files/objectstore/swift.php | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/lib/files/objectstore/swift.php b/tests/lib/files/objectstore/swift.php index 8ac899288e6..7f3b45c0dab 100644 --- a/tests/lib/files/objectstore/swift.php +++ b/tests/lib/files/objectstore/swift.php @@ -77,7 +77,30 @@ class Swift extends \Test\Files\Storage\Storage { } $this->objectStorage->deleteContainer(true); $this->instance->getCache()->clear(); - //TODO how do I clear hooks? + } + + public function testStat() { + $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; + $ctimeStart = time(); + $this->instance->file_put_contents('/lorem.txt', file_get_contents($textFile)); + $this->assertTrue($this->instance->isReadable('/lorem.txt')); + $ctimeEnd = time(); + $mTime = $this->instance->filemtime('/lorem.txt'); + + // check that ($ctimeStart - 5) <= $mTime <= ($ctimeEnd + 1) + $this->assertGreaterThanOrEqual(($ctimeStart - 5), $mTime); + $this->assertLessThanOrEqual(($ctimeEnd + 1), $mTime); + $this->assertEquals(filesize($textFile), $this->instance->filesize('/lorem.txt')); + + $stat = $this->instance->stat('/lorem.txt'); + //only size and mtime are required in the result + $this->assertEquals($stat['size'], $this->instance->filesize('/lorem.txt')); + $this->assertEquals($stat['mtime'], $mTime); + + if ($this->instance->touch('/lorem.txt', 100) !== false) { + $mTime = $this->instance->filemtime('/lorem.txt'); + $this->assertEquals($mTime, 100); + } } } |