summaryrefslogtreecommitdiffstats
path: root/tests/lib/files/storage/storage.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-02-21 15:33:12 +0100
committerRobin Appelman <icewind@owncloud.com>2014-02-21 15:33:12 +0100
commit3980a7d9c6a20e7c0c9b92342e59e2a7ec443667 (patch)
treefa09b8f5a1a3d5695ce1278122d05fea7a1c8407 /tests/lib/files/storage/storage.php
parent1331de554c0ab619df1826424e502803535481e2 (diff)
parentaa0bcf7ba45d004b0c0226fd07696f9f224f9c1c (diff)
downloadnextcloud-server-3980a7d9c6a20e7c0c9b92342e59e2a7ec443667.tar.gz
nextcloud-server-3980a7d9c6a20e7c0c9b92342e59e2a7ec443667.zip
Merge branch 'master' into folderid-reuse
Diffstat (limited to 'tests/lib/files/storage/storage.php')
-rw-r--r--tests/lib/files/storage/storage.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/lib/files/storage/storage.php b/tests/lib/files/storage/storage.php
index 182c014d999..f9291758606 100644
--- a/tests/lib/files/storage/storage.php
+++ b/tests/lib/files/storage/storage.php
@@ -27,6 +27,17 @@ abstract class Storage extends \PHPUnit_Framework_TestCase {
* @var \OC\Files\Storage\Storage instance
*/
protected $instance;
+ protected $waitDelay = 0;
+
+ /**
+ * Sleep for the number of seconds specified in the
+ * $waitDelay attribute
+ */
+ protected function wait() {
+ if ($this->waitDelay > 0) {
+ sleep($this->waitDelay);
+ }
+ }
/**
* the root folder of the storage should always exist, be readable and be recognized as a directory
@@ -77,6 +88,7 @@ abstract class Storage extends \PHPUnit_Framework_TestCase {
$this->assertFalse($this->instance->mkdir('/'.$directory)); //cant create existing folders
$this->assertTrue($this->instance->rmdir('/'.$directory));
+ $this->wait();
$this->assertFalse($this->instance->file_exists('/'.$directory));
$this->assertFalse($this->instance->rmdir('/'.$directory)); //cant remove non existing folders
@@ -97,6 +109,8 @@ abstract class Storage extends \PHPUnit_Framework_TestCase {
array('folder'),
array(' folder'),
array('folder '),
+ array('folder with space'),
+ array('spéciäl földer'),
);
}
/**
@@ -144,6 +158,7 @@ abstract class Storage extends \PHPUnit_Framework_TestCase {
$this->assertEquals($this->instance->file_get_contents('/source.txt'), $this->instance->file_get_contents('/target.txt'));
$this->instance->rename('/source.txt', '/target2.txt');
+ $this->wait();
$this->assertTrue($this->instance->file_exists('/target2.txt'));
$this->assertFalse($this->instance->file_exists('/source.txt'));
$this->assertEquals(file_get_contents($textFile), $this->instance->file_get_contents('/target2.txt'));
@@ -225,6 +240,7 @@ abstract class Storage extends \PHPUnit_Framework_TestCase {
$this->assertTrue($this->instance->file_exists('/lorem.txt'));
$this->assertTrue($this->instance->unlink('/lorem.txt'));
+ $this->wait();
$this->assertFalse($this->instance->file_exists('/lorem.txt'));
}
@@ -259,9 +275,11 @@ abstract class Storage extends \PHPUnit_Framework_TestCase {
public function testRecursiveRmdir() {
$this->instance->mkdir('folder');
$this->instance->mkdir('folder/bar');
+ $this->wait();
$this->instance->file_put_contents('folder/asd.txt', 'foobar');
$this->instance->file_put_contents('folder/bar/foo.txt', 'asd');
$this->assertTrue($this->instance->rmdir('folder'));
+ $this->wait();
$this->assertFalse($this->instance->file_exists('folder/asd.txt'));
$this->assertFalse($this->instance->file_exists('folder/bar/foo.txt'));
$this->assertFalse($this->instance->file_exists('folder/bar'));
@@ -274,6 +292,7 @@ abstract class Storage extends \PHPUnit_Framework_TestCase {
$this->instance->file_put_contents('folder/asd.txt', 'foobar');
$this->instance->file_put_contents('folder/bar/foo.txt', 'asd');
$this->assertTrue($this->instance->unlink('folder'));
+ $this->wait();
$this->assertFalse($this->instance->file_exists('folder/asd.txt'));
$this->assertFalse($this->instance->file_exists('folder/bar/foo.txt'));
$this->assertFalse($this->instance->file_exists('folder/bar'));