FileInfoTest.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * Copyright (c) 2016 Robin Appelman <robin@icewind.nl>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. namespace Test\Files;
  9. use OC\AllConfig;
  10. use OC\Files\FileInfo;
  11. use OC\Files\Storage\Home;
  12. use OC\Files\Storage\Temporary;
  13. use OC\User\User;
  14. use OCP\IConfig;
  15. use Test\TestCase;
  16. use Test\Traits\UserTrait;
  17. class FileInfoTest extends TestCase {
  18. use UserTrait;
  19. private $config;
  20. public function setUp() {
  21. parent::setUp();
  22. $this->createUser('foo', 'foo');
  23. $this->config = $this->getMockBuilder(IConfig::class)->getMock();
  24. }
  25. public function testIsMountedHomeStorage() {
  26. $fileInfo = new FileInfo(
  27. '',
  28. new Home(['user' => new User('foo', $this->userBackend, null, $this->config)]),
  29. '', [], null);
  30. $this->assertFalse($fileInfo->isMounted());
  31. }
  32. public function testIsMountedNonHomeStorage() {
  33. $fileInfo = new FileInfo(
  34. '',
  35. new Temporary(),
  36. '', [], null);
  37. $this->assertTrue($fileInfo->isMounted());
  38. }
  39. }