FileInfoTest.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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\Files\FileInfo;
  10. use OC\Files\Storage\Home;
  11. use OC\Files\Storage\Temporary;
  12. use OCP\IConfig;
  13. use OCP\IUser;
  14. use Test\TestCase;
  15. use Test\Traits\UserTrait;
  16. class FileInfoTest extends TestCase {
  17. use UserTrait;
  18. private $config;
  19. protected function setUp(): void {
  20. parent::setUp();
  21. $this->createUser('foo', 'foo');
  22. $this->config = $this->getMockBuilder(IConfig::class)->getMock();
  23. }
  24. public function testIsMountedHomeStorage() {
  25. $user = $this->createMock(IUser::class);
  26. $user->method('getUID')
  27. ->willReturn('foo');
  28. $user->method('getHome')
  29. ->willReturn('foo');
  30. $fileInfo = new FileInfo(
  31. '',
  32. new Home(['user' => $user]),
  33. '', [], null);
  34. $this->assertFalse($fileInfo->isMounted());
  35. }
  36. public function testIsMountedNonHomeStorage() {
  37. $fileInfo = new FileInfo(
  38. '',
  39. new Temporary(),
  40. '', [], null);
  41. $this->assertTrue($fileInfo->isMounted());
  42. }
  43. }