ScannerTest.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Joas Schilling <coding@schilljs.com>
  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_Sharing\Tests\External;
  23. use OCA\Files_Sharing\External\Scanner;
  24. use Test\TestCase;
  25. class ScannerTest extends TestCase {
  26. /** @var \OCA\Files_Sharing\External\Scanner */
  27. protected $scanner;
  28. /** @var \OCA\Files_Sharing\External\Storage|\PHPUnit_Framework_MockObject_MockObject */
  29. protected $storage;
  30. /** @var \OC\Files\Cache\Cache|\PHPUnit_Framework_MockObject_MockObject */
  31. protected $cache;
  32. protected function setUp() {
  33. parent::setUp();
  34. $this->storage = $this->getMockBuilder('\OCA\Files_Sharing\External\Storage')
  35. ->disableOriginalConstructor()
  36. ->getMock();
  37. $this->cache = $this->getMockBuilder('\OC\Files\Cache\Cache')
  38. ->disableOriginalConstructor()
  39. ->getMock();
  40. $this->storage->expects($this->any())
  41. ->method('getCache')
  42. ->willReturn($this->cache);
  43. $this->scanner = new Scanner($this->storage);
  44. }
  45. public function testScanAll() {
  46. $this->storage->expects($this->any())
  47. ->method('getShareInfo')
  48. ->willReturn(['status' => 'success', 'data' => []]);
  49. // FIXME add real tests, we are currently only checking for
  50. // Declaration of OCA\Files_Sharing\External\Scanner::*() should be
  51. // compatible with OC\Files\Cache\Scanner::*()
  52. $this->scanner->scanAll();
  53. $this->assertTrue(true);
  54. }
  55. public function testScan() {
  56. $this->storage->expects($this->any())
  57. ->method('getShareInfo')
  58. ->willReturn(['status' => 'success', 'data' => []]);
  59. // FIXME add real tests, we are currently only checking for
  60. // Declaration of OCA\Files_Sharing\External\Scanner::*() should be
  61. // compatible with OC\Files\Cache\Scanner::*()
  62. $this->scanner->scan('test', Scanner::SCAN_RECURSIVE);
  63. $this->assertTrue(true);
  64. }
  65. public function testScanFile() {
  66. // FIXME add real tests, we are currently only checking for
  67. // Declaration of OCA\Files_Sharing\External\Scanner::*() should be
  68. // compatible with OC\Files\Cache\Scanner::*()
  69. $this->scanner->scanFile('test', Scanner::SCAN_RECURSIVE);
  70. $this->assertTrue(true);
  71. }
  72. }