PersonalMountTest.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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 Test\TestCase;
  13. class PersonalMountTest extends TestCase {
  14. public function testFindByStorageId() {
  15. $storageConfig = $this->createMock(StorageConfig::class);
  16. /** @var \OCA\Files_External\Service\UserStoragesService $storageService */
  17. $storageService = $this->getMockBuilder('\OCA\Files_External\Service\UserStoragesService')
  18. ->disableOriginalConstructor()
  19. ->getMock();
  20. $storage = $this->getMockBuilder('\OC\Files\Storage\Storage')
  21. ->disableOriginalConstructor()
  22. ->getMock();
  23. $storage->expects($this->any())
  24. ->method('getId')
  25. ->willReturn('dummy');
  26. $mount = new PersonalMount($storageService, $storageConfig, 10, $storage, '/foo');
  27. $mountManager = new Manager($this->createMock(SetupManagerFactory::class));
  28. $mountManager->addMount($mount);
  29. $this->assertEquals([$mount], $mountManager->findByStorageId('dummy'));
  30. }
  31. }