aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/AppFramework/Http/DispatcherTest.php
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2022-03-22 12:08:45 +0100
committerGitHub <noreply@github.com>2022-03-22 12:08:45 +0100
commit0acd4b5f8202be8b3f3b4e6d7481e3d23e496b86 (patch)
tree06897c455b69be134fcd61b0f0130609ce7a75a1 /tests/lib/AppFramework/Http/DispatcherTest.php
parentb6209d61251f7abacefb8cf3c164d39bcba29100 (diff)
parent67452b94ca0b59a063c4364f5930bb5186db2d55 (diff)
downloadnextcloud-server-0acd4b5f8202be8b3f3b4e6d7481e3d23e496b86.tar.gz
nextcloud-server-0acd4b5f8202be8b3f3b4e6d7481e3d23e496b86.zip
Merge pull request #31235 from nextcloud/techdebt/noid/extract-request-id
Extract request id handling to dedicated class so it can be injected without DB dependency
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 a76b78385e7..e1d78082a2d 100644
--- a/tests/lib/AppFramework/Http/DispatcherTest.php
+++ b/tests/lib/AppFramework/Http/DispatcherTest.php
@@ -37,6 +37,7 @@ use OCP\IConfig;
use OCP\IRequest;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
+use OCP\IRequestId;
class TestController extends Controller {
/**
@@ -316,12 +317,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,
@@ -351,12 +348,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,
@@ -389,12 +382,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,
@@ -426,12 +415,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,
@@ -464,12 +449,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,
@@ -504,12 +485,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,