1
0

PersonalMountTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCA\Files_External\Tests;
  8. use OC\Files\Mount\Manager;
  9. use OC\Files\SetupManagerFactory;
  10. use OCA\Files_External\Lib\PersonalMount;
  11. use OCA\Files_External\Lib\StorageConfig;
  12. use OCA\Files_External\Service\UserStoragesService;
  13. use Test\TestCase;
  14. class PersonalMountTest extends TestCase {
  15. public function testFindByStorageId(): void {
  16. $storageConfig = $this->createMock(StorageConfig::class);
  17. /** @var UserStoragesService $storageService */
  18. $storageService = $this->getMockBuilder('\OCA\Files_External\Service\UserStoragesService')
  19. ->disableOriginalConstructor()
  20. ->getMock();
  21. $storage = $this->getMockBuilder('\OC\Files\Storage\Storage')
  22. ->disableOriginalConstructor()
  23. ->getMock();
  24. $storage->expects($this->any())
  25. ->method('getId')
  26. ->willReturn('dummy');
  27. $mount = new PersonalMount($storageService, $storageConfig, 10, $storage, '/foo');
  28. $mountManager = new Manager($this->createMock(SetupManagerFactory::class));
  29. $mountManager->addMount($mount);
  30. $this->assertEquals([$mount], $mountManager->findByStorageId('dummy'));
  31. }
  32. }