Fix touch for creating new files

This commit is contained in:
Robin Appelman 2013-04-10 13:45:36 +02:00
parent 48dabd2c14
commit 258ad38fd3
2 changed files with 7 additions and 1 deletions

View file

@ -95,7 +95,7 @@ class Local extends \OC\Files\Storage\Common{
// sets the modification time of the file to the given value.
// If mtime is nil the current time is set.
// note that the access time of the file always changes to the current time.
if(!$this->isUpdatable($path)) {
if($this->file_exists($path) and !$this->isUpdatable($path)) {
return false;
}
if(!is_null($mtime)) {

View file

@ -257,4 +257,10 @@ abstract class Storage extends \PHPUnit_Framework_TestCase {
$content = stream_get_contents($fh);
$this->assertEquals(file_get_contents($textFile), $content);
}
public function testTouchCreateFile(){
$this->assertFalse($this->instance->file_exists('foo'));
$this->instance->touch('foo');
$this->assertTrue($this->instance->file_exists('foo'));
}
}