]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix unit test by always initializing the root of the storage in the constructor
authorJörn Friedrich Dreyer <jfd@butonic.de>
Fri, 13 Jun 2014 13:05:54 +0000 (15:05 +0200)
committerJörn Friedrich Dreyer <jfd@butonic.de>
Wed, 18 Jun 2014 10:53:20 +0000 (12:53 +0200)
lib/private/files/objectstore/abstractobjectstore.php
lib/private/util.php
tests/lib/files/objectstore/swift.php

index 3f67ad9a494e5daff30ace75595618c029555470..db4c398018e4dd5d5ee932f10c3f6342b3d5ef33 100644 (file)
@@ -57,6 +57,18 @@ abstract class AbstractObjectStore extends \OC\Files\Storage\Common {
         */
        private static $tmpFiles = array();
 
+       public function __construct($params) {
+               if (isset($params['user']) && is_object($params['user'])) {
+                       $this->user = $params['user'];
+               } else {
+                       $this->user = null;
+               }
+               //initialize cache with root directory in cache
+               if ( ! $this->is_dir('/') ) {
+                       $this->mkdir('/');
+               }
+       }
+
        /**
         * @param string $path
         * @return \OC\Files\Cache\Cache
@@ -125,14 +137,6 @@ abstract class AbstractObjectStore extends \OC\Files\Storage\Common {
                return 'objstore::root';
        }
 
-       public function __construct($params) {
-               if (isset($params['user']) && is_object($params['user'])) {
-                       $this->user = $params['user'];
-               } else {
-                       $this->user = null;
-               }
-       }
-
        public function mkdir($path) {
                $path = $this->normalizePath($path);
 
index 435a29145550b147709dd066fbe87b9cc22e70bb..b4772f149604263f625fa86a9b84e9eaf5f4a188 100755 (executable)
@@ -110,17 +110,8 @@ class OC_Util {
 
                        $userDir = '/'.$user.'/files';
 
-                       //autocreate users "home" directory
-                       if ( isset( $root_storage ) ) {
-                               $root = \OC\Files\Filesystem::getStorage('/');
-                               if ( $root->instanceOfStorage('\OC\Files\ObjectStore\AbstractObjectStore') ) {
-                                       //initialize cache with root directory in cache
-                                       if ( ! $root->is_dir('/') ) {
-                                               $root->mkdir('/');
-                                       }
-                               }
-                       } else {
-                               //copy skeleton for local storage only
+                       // copy skeleton for local storage only
+                       if ( ! isset( $root_storage ) ) {
                                $userRoot = OC_User::getHome($user);
                                $userDirectory = $userRoot . '/files';
                                if( !is_dir( $userDirectory )) {
index 7687818f43d23a539546b872565bce50003895c5..1e7495e0a22c137501ca794bba2f00f2d7de472d 100644 (file)
@@ -35,7 +35,6 @@ class Swift extends PHPUnit_Framework_TestCase {
                
                \OC_App::disable('files_sharing');
                \OC_App::disable('files_versions');
-               \OC_App::enable('objectstore');
 
                // reset backend
                \OC_User::clearBackends();