1
0

ScannerTest.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. /**
  28. * @group DB
  29. */
  30. class ScannerTest extends TestCase {
  31. protected Scanner $scanner;
  32. /** @var \OCA\Files_Sharing\External\Storage|\PHPUnit\Framework\MockObject\MockObject */
  33. protected $storage;
  34. /** @var \OC\Files\Cache\Cache|\PHPUnit\Framework\MockObject\MockObject */
  35. protected $cache;
  36. protected function setUp(): void {
  37. parent::setUp();
  38. $this->storage = $this->getMockBuilder('\OCA\Files_Sharing\External\Storage')
  39. ->disableOriginalConstructor()
  40. ->getMock();
  41. $this->cache = $this->getMockBuilder('\OC\Files\Cache\Cache')
  42. ->disableOriginalConstructor()
  43. ->getMock();
  44. $this->storage->expects($this->any())
  45. ->method('getCache')
  46. ->willReturn($this->cache);
  47. $this->scanner = new Scanner($this->storage);
  48. }
  49. public function testScan() {
  50. $this->storage->expects($this->any())
  51. ->method('getShareInfo')
  52. ->willReturn(['status' => 'success', 'data' => []]);
  53. // FIXME add real tests, we are currently only checking for
  54. // Declaration of OCA\Files_Sharing\External\Scanner::*() should be
  55. // compatible with OC\Files\Cache\Scanner::*()
  56. $this->scanner->scan('test', Scanner::SCAN_RECURSIVE);
  57. $this->addToAssertionCount(1);
  58. }
  59. public function testScanFile() {
  60. // FIXME add real tests, we are currently only checking for
  61. // Declaration of OCA\Files_Sharing\External\Scanner::*() should be
  62. // compatible with OC\Files\Cache\Scanner::*()
  63. $this->scanner->scanFile('test', Scanner::SCAN_RECURSIVE);
  64. $this->addToAssertionCount(1);
  65. }
  66. }