file.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * ownCloud
  4. *
  5. * @author Robin Appelman
  6. * @copyright 2012 Robin Appelman icewind@owncloud.com
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
  10. * License as published by the Free Software Foundation; either
  11. * version 3 of the License, or any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public
  19. * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. class Test_Cache_File extends Test_Cache {
  23. private $user;
  24. function skip() {
  25. //$this->skipUnless(OC_User::isLoggedIn());
  26. }
  27. public function setUp(){
  28. //clear all proxies and hooks so we can do clean testing
  29. OC_FileProxy::clearProxies();
  30. OC_Hook::clear('OC_Filesystem');
  31. //enable only the encryption hook if needed
  32. if(OC_App::isEnabled('files_encryption')){
  33. OC_FileProxy::register(new OC_FileProxy_Encryption());
  34. }
  35. //set up temporary storage
  36. OC_Filesystem::clearMounts();
  37. OC_Filesystem::mount('OC_Filestorage_Temporary',array(),'/');
  38. OC_User::clearBackends();
  39. OC_User::useBackend(new OC_User_Dummy());
  40. //login
  41. OC_User::createUser('test', 'test');
  42. $this->user=OC_User::getUser();
  43. OC_User::setUserId('test');
  44. //set up the users dir
  45. $rootView=new OC_FilesystemView('');
  46. $rootView->mkdir('/test');
  47. $this->instance=new OC_Cache_File();
  48. }
  49. public function tearDown(){
  50. OC_User::setUserId($this->user);
  51. }
  52. }