Exemplo n.º 1
0
 /**
  * Tests that the home storage is used in legacy mode
  * for the user's mount point
  */
 public function testLegacyHomeMount()
 {
     if (getenv('RUN_OBJECTSTORE_TESTS')) {
         $this->markTestSkipped('legacy storage unrelated to objectstore environments');
     }
     $datadir = \OC::$server->getConfig()->getSystemValue("datadirectory", \OC::$SERVERROOT . "/data");
     $userId = $this->getUniqueID('user_');
     // insert storage into DB by constructing it
     // to make initMountsPoint find its existence
     $localStorage = new \OC\Files\Storage\Local(array('datadir' => $datadir . '/' . $userId . '/'));
     // this will trigger the insert
     $cache = $localStorage->getCache();
     \OC::$server->getUserManager()->createUser($userId, $userId);
     \OC\Files\Filesystem::initMountPoints($userId);
     $homeMount = \OC\Files\Filesystem::getStorage('/' . $userId . '/');
     $this->assertTrue($homeMount->instanceOfStorage('\\OC\\Files\\Storage\\Home'));
     $this->assertEquals('local::' . $datadir . '/' . $userId . '/', $homeMount->getId());
     $user = \OC::$server->getUserManager()->get($userId);
     if ($user !== null) {
         $user->delete();
     }
     // delete storage entry
     $cache->clear();
 }
Exemplo n.º 2
0
 /**
  * Tests that the home storage is used in legacy mode
  * for the user's mount point
  */
 public function testLegacyHomeMount()
 {
     $datadir = \OC_Config::getValue("datadirectory", \OC::$SERVERROOT . "/data");
     $userId = $this->getUniqueID('user_');
     // insert storage into DB by constructing it
     // to make initMountsPoint find its existence
     $localStorage = new \OC\Files\Storage\Local(array('datadir' => $datadir . '/' . $userId . '/'));
     // this will trigger the insert
     $cache = $localStorage->getCache();
     \OC_User::createUser($userId, $userId);
     \OC\Files\Filesystem::initMountPoints($userId);
     $homeMount = \OC\Files\Filesystem::getStorage('/' . $userId . '/');
     $this->assertTrue($homeMount->instanceOfStorage('\\OC\\Files\\Storage\\Home'));
     $this->assertEquals('local::' . $datadir . '/' . $userId . '/', $homeMount->getId());
     \OC_User::deleteUser($userId);
     // delete storage entry
     $cache->clear();
 }