scannertest.php 2.7 KB

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