summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/private/files/storage/local.php2
-rw-r--r--tests/lib/avatar.php18
2 files changed, 14 insertions, 6 deletions
diff --git a/lib/private/files/storage/local.php b/lib/private/files/storage/local.php
index 02e8df4af4e..db3c6bfca3a 100644
--- a/lib/private/files/storage/local.php
+++ b/lib/private/files/storage/local.php
@@ -256,7 +256,7 @@ if (\OC_Util::runningOnWindows()) {
public function free_space($path) {
$space = @disk_free_space($this->datadir . $path);
- if ($space === false) {
+ if ($space === false || is_null($space)) {
return \OC\Files\SPACE_UNKNOWN;
}
return $space;
diff --git a/tests/lib/avatar.php b/tests/lib/avatar.php
index 9cc14865a29..0334639afa8 100644
--- a/tests/lib/avatar.php
+++ b/tests/lib/avatar.php
@@ -1,20 +1,28 @@
<?php
+
/**
* Copyright (c) 2013 Christopher Schäpers <christopher@schaepers.it>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
-
class Test_Avatar extends PHPUnit_Framework_TestCase {
+ private $user;
+
+ public function setUp() {
+ $this->user = uniqid();
+ $storage = new \OC\Files\Storage\Temporary(array());
+ \OC\Files\Filesystem::mount($storage, array(), '/' . $this->user . '/');
+ }
+
public function testAvatar() {
- $avatar = new \OC_Avatar(\OC_User::getUser());
+ $avatar = new \OC_Avatar($this->user);
$this->assertEquals(false, $avatar->get());
- $expected = new OC_Image(\OC::$SERVERROOT.'/tests/data/testavatar.png');
+ $expected = new OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png');
$expected->resize(64);
$avatar->set($expected->data());
$this->assertEquals($expected->data(), $avatar->get()->data());
@@ -25,11 +33,11 @@ class Test_Avatar extends PHPUnit_Framework_TestCase {
public function testAvatarApi() {
$avatarManager = \OC::$server->getAvatarManager();
- $avatar = $avatarManager->getAvatar(\OC_User::getUser());
+ $avatar = $avatarManager->getAvatar($this->user);
$this->assertEquals(false, $avatar->get());
- $expected = new OC_Image(\OC::$SERVERROOT.'/tests/data/testavatar.png');
+ $expected = new OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png');
$expected->resize(64);
$avatar->set($expected->data());
$this->assertEquals($expected->data(), $avatar->get()->data());