Example #1
0
 protected function setUp()
 {
     parent::setUp();
     //clear all proxies and hooks so we can do clean testing
     \OC_Hook::clear('OC_Filesystem');
     //set up temporary storage
     $this->storage = \OC\Files\Filesystem::getStorage('/');
     \OC\Files\Filesystem::clearMounts();
     $storage = new \OC\Files\Storage\Temporary(array());
     \OC\Files\Filesystem::mount($storage, array(), '/');
     $datadir = str_replace('local::', '', $storage->getId());
     $config = \OC::$server->getConfig();
     $this->datadir = $config->getSystemValue('cachedirectory', \OC::$SERVERROOT . '/data/cache');
     $config->setSystemValue('cachedirectory', $datadir);
     \OC_User::clearBackends();
     \OC_User::useBackend(new \Test\Util\User\Dummy());
     //login
     \OC::$server->getUserManager()->createUser('test', 'test');
     $this->user = \OC_User::getUser();
     \OC_User::setUserId('test');
     //set up the users dir
     $this->rootView = new \OC\Files\View('');
     $this->rootView->mkdir('/test');
     $this->instance = new \OC\Cache\File();
     // forces creation of cache folder for subsequent tests
     $this->instance->set('hack', 'hack');
 }
 public function setUp()
 {
     parent::setUp();
     $this->instance = new \OC\Cache\CappedMemoryCache();
 }