aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/files/storage/storage.php
diff options
context:
space:
mode:
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'));