1
0

ScannerTest.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Joas Schilling <coding@schilljs.com>
  6. * @author Morris Jobke <hey@morrisjobke.de>
  7. * @author Roeland Jago Douma <roeland@famdouma.nl>
  8. *
  9. * @license AGPL-3.0
  10. *
  11. * This code is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License, version 3,
  13. * as published by the Free Software Foundation.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License, version 3,
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>
  22. *
  23. */
  24. namespace OCA\Files_Sharing\Tests\External;
  25. use OCA\Files_Sharing\External\Scanner;
  26. use Test\TestCase;
  27. class ScannerTest extends TestCase {
  28. /** @var \OCA\Files_Sharing\External\Scanner */
  29. protected $scanner;
  30. /** @var \OCA\Files_Sharing\External\Storage|\PHPUnit\Framework\MockObject\MockObject */
  31. protected $storage;
  32. /** @var \OC\Files\Cache\Cache|\PHPUnit\Framework\MockObject\MockObject */
  33. protected $cache;
  34. protected function setUp(): void {
  35. parent::setUp();
  36. $this->storage = $this->getMockBuilder('\OCA\Files_Sharing\External\Storage')
  37. ->disableOriginalConstructor()
  38. ->getMock();
  39. $this->cache = $this->getMockBuilder('\OC\Files\Cache\Cache')
  40. ->disableOriginalConstructor()
  41. ->getMock();
  42. $this->storage->expects($this->any())
  43. ->method('getCache')
  44. ->willReturn($this->cache);
  45. $this->scanner = new Scanner($this->storage);
  46. }
  47. public function testScan() {
  48. $this->storage->expects($this->any())
  49. ->method('getShareInfo')
  50. ->willReturn(['status' => 'success', 'data' => []]);
  51. // FIXME add real tests, we are currently only checking for
  52. // Declaration of OCA\Files_Sharing\External\Scanner::*() should be
  53. // compatible with OC\Files\Cache\Scanner::*()
  54. $this->scanner->scan('test', Scanner::SCAN_RECURSIVE);
  55. $this->addToAssertionCount(1);
  56. }
  57. public function testScanFile() {
  58. // FIXME add real tests, we are currently only checking for
  59. // Declaration of OCA\Files_Sharing\External\Scanner::*() should be
  60. // compatible with OC\Files\Cache\Scanner::*()
  61. $this->scanner->scanFile('test', Scanner::SCAN_RECURSIVE);
  62. $this->addToAssertionCount(1);
  63. }
  64. }