aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/AppFramework/Http/DispatcherTest.php
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-02-18 10:21:00 +0100
committerJoas Schilling <coding@schilljs.com>2022-02-23 11:01:58 +0100
commitcc6653e45c86e8019846274b04154c96e34632cf (patch)
tree509213f7947344a95053676945721b3439d894d3 /tests/lib/AppFramework/Http/DispatcherTest.php
parent1c138d3ae28287a5a5854ef5142ee66ae88f801c (diff)
downloadnextcloud-server-cc6653e45c86e8019846274b04154c96e34632cf.tar.gz
nextcloud-server-cc6653e45c86e8019846274b04154c96e34632cf.zip
Adjust and add unit tests
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/lib/AppFramework/Http/DispatcherTest.php')
-rw-r--r--tests/lib/AppFramework/Http/DispatcherTest.php49
1 files changed, 13 insertions, 36 deletions
diff --git a/tests/lib/AppFramework/Http/DispatcherTest.php b/tests/lib/AppFramework/Http/DispatcherTest.php
index 92b772dbe31..56559623e53 100644
--- a/tests/lib/AppFramework/Http/DispatcherTest.php
+++ b/tests/lib/AppFramework/Http/DispatcherTest.php
@@ -36,6 +36,7 @@ use OCP\IConfig;
use OCP\IRequest;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
+use OCP\IRequestId;
class TestController extends Controller {
/**
@@ -309,12 +310,8 @@ class DispatcherTest extends \Test\TestCase {
],
'method' => 'POST'
],
- $this->getMockBuilder('\OCP\Security\ISecureRandom')
- ->disableOriginalConstructor()
- ->getMock(),
- $this->getMockBuilder(IConfig::class)
- ->disableOriginalConstructor()
- ->getMock()
+ $this->createMock(IRequestId::class),
+ $this->createMock(IConfig::class)
);
$this->dispatcher = new Dispatcher(
$this->http, $this->middlewareDispatcher, $this->reflector,
@@ -343,12 +340,8 @@ class DispatcherTest extends \Test\TestCase {
],
'method' => 'POST',
],
- $this->getMockBuilder('\OCP\Security\ISecureRandom')
- ->disableOriginalConstructor()
- ->getMock(),
- $this->getMockBuilder(IConfig::class)
- ->disableOriginalConstructor()
- ->getMock()
+ $this->createMock(IRequestId::class),
+ $this->createMock(IConfig::class)
);
$this->dispatcher = new Dispatcher(
$this->http, $this->middlewareDispatcher, $this->reflector,
@@ -380,12 +373,8 @@ class DispatcherTest extends \Test\TestCase {
],
'method' => 'GET'
],
- $this->getMockBuilder('\OCP\Security\ISecureRandom')
- ->disableOriginalConstructor()
- ->getMock(),
- $this->getMockBuilder(IConfig::class)
- ->disableOriginalConstructor()
- ->getMock()
+ $this->createMock(IRequestId::class),
+ $this->createMock(IConfig::class)
);
$this->dispatcher = new Dispatcher(
$this->http, $this->middlewareDispatcher, $this->reflector,
@@ -416,12 +405,8 @@ class DispatcherTest extends \Test\TestCase {
],
'method' => 'GET'
],
- $this->getMockBuilder('\OCP\Security\ISecureRandom')
- ->disableOriginalConstructor()
- ->getMock(),
- $this->getMockBuilder(IConfig::class)
- ->disableOriginalConstructor()
- ->getMock()
+ $this->createMock(IRequestId::class),
+ $this->createMock(IConfig::class)
);
$this->dispatcher = new Dispatcher(
$this->http, $this->middlewareDispatcher, $this->reflector,
@@ -453,12 +438,8 @@ class DispatcherTest extends \Test\TestCase {
],
'method' => 'PUT'
],
- $this->getMockBuilder('\OCP\Security\ISecureRandom')
- ->disableOriginalConstructor()
- ->getMock(),
- $this->getMockBuilder(IConfig::class)
- ->disableOriginalConstructor()
- ->getMock()
+ $this->createMock(IRequestId::class),
+ $this->createMock(IConfig::class)
);
$this->dispatcher = new Dispatcher(
$this->http, $this->middlewareDispatcher, $this->reflector,
@@ -492,12 +473,8 @@ class DispatcherTest extends \Test\TestCase {
],
'method' => 'POST'
],
- $this->getMockBuilder('\OCP\Security\ISecureRandom')
- ->disableOriginalConstructor()
- ->getMock(),
- $this->getMockBuilder(IConfig::class)
- ->disableOriginalConstructor()
- ->getMock()
+ $this->createMock(IRequestId::class),
+ $this->createMock(IConfig::class)
);
$this->dispatcher = new Dispatcher(
$this->http, $this->middlewareDispatcher, $this->reflector,