ManagerTest.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace Test\Collaboration\Resources;
  8. use OC\Collaboration\Resources\Manager;
  9. use OCP\Collaboration\Resources\IManager;
  10. use OCP\Collaboration\Resources\IProviderManager;
  11. use OCP\IDBConnection;
  12. use Psr\Log\LoggerInterface;
  13. use Test\TestCase;
  14. class ManagerTest extends TestCase {
  15. /** @var LoggerInterface */
  16. protected $logger;
  17. /** @var IProviderManager */
  18. protected $providerManager;
  19. /** @var IManager */
  20. protected $manager;
  21. protected function setUp(): void {
  22. parent::setUp();
  23. $this->logger = $this->createMock(LoggerInterface::class);
  24. $this->providerManager = $this->createMock(IProviderManager::class);
  25. /** @var IDBConnection $connection */
  26. $connection = $this->createMock(IDBConnection::class);
  27. $this->manager = new Manager($connection, $this->providerManager, $this->logger);
  28. }
  29. public function testRegisterResourceProvider(): void {
  30. $this->logger->expects($this->once())
  31. ->method('debug')
  32. ->with($this->equalTo('\OC\Collaboration\Resources\Manager::registerResourceProvider is deprecated'), $this->equalTo(['provider' => 'AwesomeResourceProvider']));
  33. $this->providerManager->expects($this->once())
  34. ->method('registerResourceProvider')
  35. ->with($this->equalTo('AwesomeResourceProvider'));
  36. $this->manager->registerResourceProvider('AwesomeResourceProvider');
  37. }
  38. }