Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add rmdir() management.

  • Loading branch information...
commit 551713f9d71f83e6ff1c9e7a6c89415b3ddad708 1 parent fb82173
Frédéric Hardy mageekguy authored
14 classes/mock/streams/fs/directory/controller.php
View
@@ -40,6 +40,20 @@ public function mkdir($path, $mode, $options)
}
}
+ public function rmdir($path, $options)
+ {
+ if ($this->exists === false || $this->checkIfWritable() === false)
+ {
+ return false;
+ }
+ else
+ {
+ $this->exists = false;
+
+ return true;
+ }
+ }
+
public function dir_opendir($path, $useSafeMode)
{
return $this->exists;
20 tests/units/classes/mock/streams/fs/directory/controller.php
View
@@ -66,4 +66,24 @@ public function testMkdir()
->integer($controller->getPermissions())->isEqualTo(0777)
;
}
+
+ public function testRmdir()
+ {
+ $this
+ ->if($controller = new testedClass(uniqid()))
+ ->and($controller->exists())
+ ->then
+ ->boolean($controller->rmdir(uniqid(), STREAM_MKDIR_RECURSIVE))->isTrue()
+ ->variable($controller->getPermissions())->isNull()
+ ->if($controller->exists())
+ ->and($controller->isNotWritable())
+ ->then
+ ->boolean($controller->rmdir(uniqid(), STREAM_MKDIR_RECURSIVE))->isFalse()
+ ->integer($controller->getPermissions())->isNotNull()
+ ->if($controller->notExists())
+ ->then
+ ->boolean($controller->rmdir(uniqid(), STREAM_MKDIR_RECURSIVE))->isFalse()
+ ->variable($controller->getPermissions())->isNull()
+ ;
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.