PersonalMountTest.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author Julius Härtl <jus@bitgrid.net>
  8. * @author Robin Appelman <robin@icewind.nl>
  9. *
  10. * @license AGPL-3.0
  11. *
  12. * This code is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License, version 3,
  14. * as published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License, version 3,
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>
  23. *
  24. */
  25. namespace OCA\Files_External\Tests;
  26. use OC\Files\Mount\Manager;
  27. use OC\Files\SetupManagerFactory;
  28. use OCA\Files_External\Lib\PersonalMount;
  29. use OCA\Files_External\Lib\StorageConfig;
  30. use OCP\Diagnostics\IEventLogger;
  31. use OCP\EventDispatcher\IEventDispatcher;
  32. use OCP\Files\Config\IMountProviderCollection;
  33. use OCP\IUserManager;
  34. use Test\TestCase;
  35. class PersonalMountTest extends TestCase {
  36. public function testFindByStorageId() {
  37. $storageConfig = $this->createMock(StorageConfig::class);
  38. /** @var \OCA\Files_External\Service\UserStoragesService $storageService */
  39. $storageService = $this->getMockBuilder('\OCA\Files_External\Service\UserStoragesService')
  40. ->disableOriginalConstructor()
  41. ->getMock();
  42. $storage = $this->getMockBuilder('\OC\Files\Storage\Storage')
  43. ->disableOriginalConstructor()
  44. ->getMock();
  45. $storage->expects($this->any())
  46. ->method('getId')
  47. ->willReturn('dummy');
  48. $mount = new PersonalMount($storageService, $storageConfig, 10, $storage, '/foo');
  49. $mountManager = new Manager($this->createMock(SetupManagerFactory::class));
  50. $mountManager->addMount($mount);
  51. $this->assertEquals([$mount], $mountManager->findByStorageId('dummy'));
  52. }
  53. }