You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LegacyDependencyCheckPolyfillTest.php 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Robin McCorkell <robin@mccorkell.me.uk>
  6. *
  7. * @license AGPL-3.0
  8. *
  9. * This code is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License, version 3,
  11. * as published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Affero General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public License, version 3,
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>
  20. *
  21. */
  22. namespace OCA\Files_External\Tests;
  23. use \OCA\Files_External\Lib\MissingDependency;
  24. class LegacyDependencyCheckPolyfillTest extends \Test\TestCase {
  25. /**
  26. * @return MissingDependency[]
  27. */
  28. public static function checkDependencies() {
  29. return [
  30. (new MissingDependency('dependency'))->setMessage('missing dependency'),
  31. (new MissingDependency('program'))->setMessage('cannot find program'),
  32. ];
  33. }
  34. public function testCheckDependencies() {
  35. $trait = $this->getMockForTrait('\OCA\Files_External\Lib\LegacyDependencyCheckPolyfill');
  36. $trait->expects($this->once())
  37. ->method('getStorageClass')
  38. ->willReturn('\OCA\Files_External\Tests\LegacyDependencyCheckPolyfillTest');
  39. $dependencies = $trait->checkDependencies();
  40. $this->assertCount(2, $dependencies);
  41. $this->assertEquals('dependency', $dependencies[0]->getDependency());
  42. $this->assertEquals('missing dependency', $dependencies[0]->getMessage());
  43. $this->assertEquals('program', $dependencies[1]->getDependency());
  44. $this->assertEquals('cannot find program', $dependencies[1]->getMessage());
  45. }
  46. }