ManagerTest.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2019 Daniel Kesselberg <mail@danielkesselberg.de>
  5. *
  6. * @license GNU AGPL version 3 or any later version
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Affero General Public License as
  10. * published by the Free Software Foundation, either version 3 of the
  11. * License, or (at your option) any later version.
  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
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. namespace Test\Collaboration\Resources;
  23. use OC\Collaboration\Resources\Manager;
  24. use OCP\Collaboration\Resources\IManager;
  25. use OCP\Collaboration\Resources\IProviderManager;
  26. use OCP\IDBConnection;
  27. use Psr\Log\LoggerInterface;
  28. use Test\TestCase;
  29. class ManagerTest extends TestCase {
  30. /** @var LoggerInterface */
  31. protected $logger;
  32. /** @var IProviderManager */
  33. protected $providerManager;
  34. /** @var IManager */
  35. protected $manager;
  36. protected function setUp(): void {
  37. parent::setUp();
  38. $this->logger = $this->createMock(LoggerInterface::class);
  39. $this->providerManager = $this->createMock(IProviderManager::class);
  40. /** @var IDBConnection $connection */
  41. $connection = $this->createMock(IDBConnection::class);
  42. $this->manager = new Manager($connection, $this->providerManager, $this->logger);
  43. }
  44. public function testRegisterResourceProvider(): void {
  45. $this->logger->expects($this->once())
  46. ->method('debug')
  47. ->with($this->equalTo('\OC\Collaboration\Resources\Manager::registerResourceProvider is deprecated'), $this->equalTo(['provider' => 'AwesomeResourceProvider']));
  48. $this->providerManager->expects($this->once())
  49. ->method('registerResourceProvider')
  50. ->with($this->equalTo('AwesomeResourceProvider'));
  51. $this->manager->registerResourceProvider('AwesomeResourceProvider');
  52. }
  53. }