1
0

LegacyDependencyCheckPolyfillTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  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 OCA\Files_External\Lib\MissingDependency;
  9. class LegacyDependencyCheckPolyfillTest extends \Test\TestCase {
  10. /**
  11. * @return MissingDependency[]
  12. */
  13. public static function checkDependencies() {
  14. return [
  15. (new MissingDependency('dependency'))->setMessage('missing dependency'),
  16. (new MissingDependency('program'))->setMessage('cannot find program'),
  17. ];
  18. }
  19. public function testCheckDependencies() {
  20. $trait = $this->getMockForTrait('\OCA\Files_External\Lib\LegacyDependencyCheckPolyfill');
  21. $trait->expects($this->once())
  22. ->method('getStorageClass')
  23. ->willReturn('\OCA\Files_External\Tests\LegacyDependencyCheckPolyfillTest');
  24. $dependencies = $trait->checkDependencies();
  25. $this->assertCount(2, $dependencies);
  26. $this->assertEquals('dependency', $dependencies[0]->getDependency());
  27. $this->assertEquals('missing dependency', $dependencies[0]->getMessage());
  28. $this->assertEquals('program', $dependencies[1]->getDependency());
  29. $this->assertEquals('cannot find program', $dependencies[1]->getMessage());
  30. }
  31. }