diff options
author | Robin Appelman <robin@icewind.nl> | 2023-02-13 14:47:50 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2023-02-13 22:51:14 +0100 |
commit | b911da3e1eedff9f7df683889f0d425d47a6fd1c (patch) | |
tree | 98f290ad2f92c5aed25717f9f973ee112ba8b05e /tests/lib/AppFramework | |
parent | b68be794644ad1e125257ab4b05e80356655537a (diff) | |
download | nextcloud-server-b911da3e1eedff9f7df683889f0d425d47a6fd1c.tar.gz nextcloud-server-b911da3e1eedff9f7df683889f0d425d47a6fd1c.zip |
DI for Router
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests/lib/AppFramework')
-rw-r--r-- | tests/lib/AppFramework/Routing/RoutingTest.php | 52 |
1 files changed, 46 insertions, 6 deletions
diff --git a/tests/lib/AppFramework/Routing/RoutingTest.php b/tests/lib/AppFramework/Routing/RoutingTest.php index 22037c31d0d..d7fde02dbcb 100644 --- a/tests/lib/AppFramework/Routing/RoutingTest.php +++ b/tests/lib/AppFramework/Routing/RoutingTest.php @@ -6,8 +6,12 @@ use OC\AppFramework\DependencyInjection\DIContainer; use OC\AppFramework\Routing\RouteConfig; use OC\Route\Route; use OC\Route\Router; +use OCP\Diagnostics\IEventLogger; +use OCP\IConfig; +use OCP\IRequest; use OCP\Route\IRouter; use PHPUnit\Framework\MockObject\MockObject; +use Psr\Container\ContainerInterface; use Psr\Log\LoggerInterface; class RoutingTest extends \Test\TestCase { @@ -133,7 +137,13 @@ class RoutingTest extends \Test\TestCase { /** @var IRouter|MockObject $router */ $router = $this->getMockBuilder(Router::class) ->onlyMethods(['create']) - ->setConstructorArgs([$this->createMock(LoggerInterface::class)]) + ->setConstructorArgs([ + $this->createMock(LoggerInterface::class), + $this->createMock(IRequest::class), + $this->createMock(IConfig::class), + $this->createMock(IEventLogger::class), + $this->createMock(ContainerInterface::class) + ]) ->getMock(); // load route configuration @@ -154,7 +164,13 @@ class RoutingTest extends \Test\TestCase { /** @var IRouter|MockObject $router */ $router = $this->getMockBuilder(Router::class) ->onlyMethods(['create']) - ->setConstructorArgs([$this->createMock(LoggerInterface::class)]) + ->setConstructorArgs([ + $this->createMock(LoggerInterface::class), + $this->createMock(IRequest::class), + $this->createMock(IConfig::class), + $this->createMock(IEventLogger::class), + $this->createMock(ContainerInterface::class) + ]) ->getMock(); // load route configuration @@ -214,7 +230,13 @@ class RoutingTest extends \Test\TestCase { /** @var IRouter|MockObject $router */ $router = $this->getMockBuilder(Router::class) ->onlyMethods(['create']) - ->setConstructorArgs([$this->createMock(LoggerInterface::class)]) + ->setConstructorArgs([ + $this->createMock(LoggerInterface::class), + $this->createMock(IRequest::class), + $this->createMock(IConfig::class), + $this->createMock(IEventLogger::class), + $this->createMock(ContainerInterface::class) + ]) ->getMock(); // we expect create to be called once: @@ -264,7 +286,13 @@ class RoutingTest extends \Test\TestCase { /** @var IRouter|MockObject $router */ $router = $this->getMockBuilder(Router::class) ->onlyMethods(['create']) - ->setConstructorArgs([$this->createMock(LoggerInterface::class)]) + ->setConstructorArgs([ + $this->createMock(LoggerInterface::class), + $this->createMock(IRequest::class), + $this->createMock(IConfig::class), + $this->createMock(IEventLogger::class), + $this->createMock(ContainerInterface::class) + ]) ->getMock(); // we expect create to be called once: @@ -291,7 +319,13 @@ class RoutingTest extends \Test\TestCase { /** @var IRouter|MockObject $router */ $router = $this->getMockBuilder(Router::class) ->onlyMethods(['create']) - ->setConstructorArgs([$this->createMock(LoggerInterface::class)]) + ->setConstructorArgs([ + $this->createMock(LoggerInterface::class), + $this->createMock(IRequest::class), + $this->createMock(IConfig::class), + $this->createMock(IEventLogger::class), + $this->createMock(ContainerInterface::class) + ]) ->getMock(); // route mocks @@ -338,7 +372,13 @@ class RoutingTest extends \Test\TestCase { /** @var IRouter|MockObject $router */ $router = $this->getMockBuilder(Router::class) ->onlyMethods(['create']) - ->setConstructorArgs([$this->createMock(LoggerInterface::class)]) + ->setConstructorArgs([ + $this->createMock(LoggerInterface::class), + $this->createMock(IRequest::class), + $this->createMock(IConfig::class), + $this->createMock(IEventLogger::class), + $this->createMock(ContainerInterface::class) + ]) ->getMock(); // route mocks |