mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Adjust and add unit tests
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
1c138d3ae2
commit
cc6653e45c
4 changed files with 173 additions and 167 deletions
|
|
@ -30,7 +30,7 @@ use OC\AppFramework\Http\Request;
|
|||
use OC\AppFramework\Middleware\Security\SecurityMiddleware;
|
||||
use OCP\AppFramework\QueryException;
|
||||
use OCP\IConfig;
|
||||
use OCP\Security\ISecureRandom;
|
||||
use OCP\IRequestId;
|
||||
|
||||
/**
|
||||
* @group DB
|
||||
|
|
@ -69,7 +69,7 @@ class DIContainerTest extends \Test\TestCase {
|
|||
public function testMiddlewareDispatcherIncludesSecurityMiddleware() {
|
||||
$this->container['Request'] = new Request(
|
||||
['method' => 'GET'],
|
||||
$this->createMock(ISecureRandom::class),
|
||||
$this->createMock(IRequestId::class),
|
||||
$this->createMock(IConfig::class)
|
||||
);
|
||||
$dispatcher = $this->container['MiddlewareDispatcher'];
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
76
tests/lib/AppFramework/Http/RequestIdTest.php
Normal file
76
tests/lib/AppFramework/Http/RequestIdTest.php
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2022 Joas Schilling <coding@schilljs.com>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Test\AppFramework\Http;
|
||||
|
||||
use OC\AppFramework\Http\RequestId;
|
||||
use OCP\Security\ISecureRandom;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
|
||||
/**
|
||||
* Class RequestIdTest
|
||||
*
|
||||
* @package OC\AppFramework\Http
|
||||
*/
|
||||
class RequestIdTest extends \Test\TestCase {
|
||||
/** @var ISecureRandom|MockObject */
|
||||
protected $secureRandom;
|
||||
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
|
||||
$this->secureRandom = $this->createMock(ISecureRandom::class);
|
||||
}
|
||||
|
||||
public function testGetIdWithModUnique(): void {
|
||||
$requestId = new RequestId(
|
||||
'GeneratedUniqueIdByModUnique',
|
||||
$this->secureRandom
|
||||
);
|
||||
|
||||
$this->secureRandom->expects($this->never())
|
||||
->method('generate');
|
||||
|
||||
$this->assertSame('GeneratedUniqueIdByModUnique', $requestId->getId());
|
||||
$this->assertSame('GeneratedUniqueIdByModUnique', $requestId->getId());
|
||||
}
|
||||
|
||||
public function testGetIdWithoutModUnique(): void {
|
||||
$requestId = new RequestId(
|
||||
'',
|
||||
$this->secureRandom
|
||||
);
|
||||
|
||||
$this->secureRandom->expects($this->once())
|
||||
->method('generate')
|
||||
->with('20')
|
||||
->willReturnOnConsecutiveCalls(
|
||||
'GeneratedByNextcloudItself1',
|
||||
'GeneratedByNextcloudItself2',
|
||||
'GeneratedByNextcloudItself3'
|
||||
);
|
||||
|
||||
$this->assertSame('GeneratedByNextcloudItself1', $requestId->getId());
|
||||
$this->assertSame('GeneratedByNextcloudItself1', $requestId->getId());
|
||||
}
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@ use OC\AppFramework\Http\Request;
|
|||
use OC\Security\CSRF\CsrfToken;
|
||||
use OC\Security\CSRF\CsrfTokenManager;
|
||||
use OCP\IConfig;
|
||||
use OCP\Security\ISecureRandom;
|
||||
use OCP\IRequestId;
|
||||
|
||||
/**
|
||||
* Class RequestTest
|
||||
|
|
@ -24,8 +24,8 @@ use OCP\Security\ISecureRandom;
|
|||
class RequestTest extends \Test\TestCase {
|
||||
/** @var string */
|
||||
protected $stream = 'fakeinput://data';
|
||||
/** @var ISecureRandom */
|
||||
protected $secureRandom;
|
||||
/** @var IRequestId */
|
||||
protected $requestId;
|
||||
/** @var IConfig */
|
||||
protected $config;
|
||||
/** @var CsrfTokenManager */
|
||||
|
|
@ -39,10 +39,11 @@ class RequestTest extends \Test\TestCase {
|
|||
}
|
||||
stream_wrapper_register('fakeinput', 'Test\AppFramework\Http\RequestStream');
|
||||
|
||||
$this->secureRandom = $this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock();
|
||||
$this->config = $this->getMockBuilder(IConfig::class)->getMock();
|
||||
$this->csrfTokenManager = $this->getMockBuilder('\OC\Security\CSRF\CsrfTokenManager')
|
||||
->disableOriginalConstructor()->getMock();
|
||||
$this->requestId = $this->createMock(IRequestId::class);
|
||||
$this->config = $this->createMock(IConfig::class);
|
||||
$this->csrfTokenManager = $this->getMockBuilder(CsrfTokenManager::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
}
|
||||
|
||||
protected function tearDown(): void {
|
||||
|
|
@ -58,7 +59,7 @@ class RequestTest extends \Test\TestCase {
|
|||
|
||||
$request = new Request(
|
||||
$vars,
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -90,7 +91,7 @@ class RequestTest extends \Test\TestCase {
|
|||
|
||||
$request = new Request(
|
||||
$vars,
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -113,7 +114,7 @@ class RequestTest extends \Test\TestCase {
|
|||
|
||||
$request = new Request(
|
||||
$vars,
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -133,7 +134,7 @@ class RequestTest extends \Test\TestCase {
|
|||
|
||||
$request = new Request(
|
||||
$vars,
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -153,7 +154,7 @@ class RequestTest extends \Test\TestCase {
|
|||
|
||||
$request = new Request(
|
||||
$vars,
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -170,7 +171,7 @@ class RequestTest extends \Test\TestCase {
|
|||
|
||||
$request = new Request(
|
||||
$vars,
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -192,7 +193,7 @@ class RequestTest extends \Test\TestCase {
|
|||
|
||||
$request = new Request(
|
||||
$vars,
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -216,7 +217,7 @@ class RequestTest extends \Test\TestCase {
|
|||
|
||||
$request = new Request(
|
||||
$vars,
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -238,7 +239,7 @@ class RequestTest extends \Test\TestCase {
|
|||
|
||||
$request = new Request(
|
||||
$vars,
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -263,7 +264,7 @@ class RequestTest extends \Test\TestCase {
|
|||
|
||||
$request = new Request(
|
||||
$vars,
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -284,7 +285,7 @@ class RequestTest extends \Test\TestCase {
|
|||
|
||||
$request = new Request(
|
||||
$vars,
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -312,7 +313,7 @@ class RequestTest extends \Test\TestCase {
|
|||
|
||||
$request = new Request(
|
||||
$vars,
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -341,7 +342,7 @@ class RequestTest extends \Test\TestCase {
|
|||
|
||||
$request = new Request(
|
||||
$vars,
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -354,54 +355,6 @@ class RequestTest extends \Test\TestCase {
|
|||
$this->assertEquals('3', $request->getParams()['id']);
|
||||
}
|
||||
|
||||
public function testGetIdWithModUnique() {
|
||||
$vars = [
|
||||
'server' => [
|
||||
'UNIQUE_ID' => 'GeneratedUniqueIdByModUnique'
|
||||
],
|
||||
];
|
||||
|
||||
$request = new Request(
|
||||
$vars,
|
||||
$this->secureRandom,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
);
|
||||
|
||||
$this->assertSame('GeneratedUniqueIdByModUnique', $request->getId());
|
||||
}
|
||||
|
||||
public function testGetIdWithoutModUnique() {
|
||||
$this->secureRandom->expects($this->once())
|
||||
->method('generate')
|
||||
->with('20')
|
||||
->willReturn('GeneratedByOwnCloudItself');
|
||||
|
||||
$request = new Request(
|
||||
[],
|
||||
$this->secureRandom,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
);
|
||||
|
||||
$this->assertSame('GeneratedByOwnCloudItself', $request->getId());
|
||||
}
|
||||
|
||||
public function testGetIdWithoutModUniqueStable() {
|
||||
$request = new Request(
|
||||
[],
|
||||
\OC::$server->getSecureRandom(),
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
);
|
||||
$firstId = $request->getId();
|
||||
$secondId = $request->getId();
|
||||
$this->assertSame($firstId, $secondId);
|
||||
}
|
||||
|
||||
public function testGetRemoteAddressWithoutTrustedRemote() {
|
||||
$this->config
|
||||
->expects($this->once())
|
||||
|
|
@ -417,7 +370,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'HTTP_X_FORWARDED_FOR' => '192.168.0.233'
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -446,7 +399,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'HTTP_X_FORWARDED_FOR' => '192.168.0.233'
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -475,7 +428,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'HTTP_X_FORWARDED_FOR' => '192.168.0.233'
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -504,7 +457,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'HTTP_X_FORWARDED_FOR' => '192.168.0.233'
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -537,7 +490,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'HTTP_X_FORWARDED_FOR' => '192.168.0.233'
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -570,7 +523,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'HTTP_X_FORWARDED_FOR' => '192.168.0.233'
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -599,7 +552,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'HTTP_X_FORWARDED_FOR' => '192.168.0.233'
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -623,7 +576,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'HTTP_X_FORWARDED_FOR' => '192.168.0.233'
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -651,7 +604,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'HTTP_X_FORWARDED_FOR' => '[2001:db8:85a3:8d3:1319:8a2e:370:7348]',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -702,7 +655,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'SERVER_PROTOCOL' => $input,
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -730,7 +683,7 @@ class RequestTest extends \Test\TestCase {
|
|||
|
||||
$request = new Request(
|
||||
[],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -757,7 +710,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'REMOTE_ADDR' => '1.2.3.4',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -769,7 +722,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'REMOTE_ADDR' => '1.2.3.4',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -793,7 +746,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'HTTPS' => 'on'
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -814,7 +767,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'HTTPS' => 'off'
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -835,7 +788,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'HTTPS' => ''
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -852,7 +805,7 @@ class RequestTest extends \Test\TestCase {
|
|||
|
||||
$request = new Request(
|
||||
[],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -878,7 +831,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'REMOTE_ADDR' => '1.2.3.4',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -900,7 +853,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'HTTP_USER_AGENT' => $testAgent,
|
||||
]
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -918,7 +871,7 @@ class RequestTest extends \Test\TestCase {
|
|||
public function testUndefinedUserAgent($testAgent, $userAgent, $matches) {
|
||||
$request = new Request(
|
||||
[],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1056,7 +1009,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'SERVER_NAME' => 'from.server.name:8080',
|
||||
]
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1073,7 +1026,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'HTTP_HOST' => 'from.host.header:8080',
|
||||
]
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1102,7 +1055,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'REMOTE_ADDR' => '1.2.3.4',
|
||||
]
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1131,7 +1084,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'REMOTE_ADDR' => '1.2.3.4',
|
||||
]
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1155,7 +1108,7 @@ class RequestTest extends \Test\TestCase {
|
|||
|
||||
$request = new Request(
|
||||
[],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1184,7 +1137,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'REMOTE_ADDR' => '1.2.3.4',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1213,7 +1166,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'REMOTE_ADDR' => '1.2.3.4',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1239,7 +1192,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'REMOTE_ADDR' => '1.2.3.4',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1285,7 +1238,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'REMOTE_ADDR' => '1.2.3.4',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1302,7 +1255,7 @@ class RequestTest extends \Test\TestCase {
|
|||
->willReturn('');
|
||||
$request = new Request(
|
||||
[],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1330,7 +1283,7 @@ class RequestTest extends \Test\TestCase {
|
|||
|
||||
$request = new Request(
|
||||
[],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1351,7 +1304,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'SCRIPT_NAME' => '/var/www/index.php',
|
||||
]
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1372,7 +1325,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'SCRIPT_NAME' => '/var/www/index.php',
|
||||
]
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1395,7 +1348,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'SCRIPT_NAME' => $scriptName,
|
||||
]
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1418,7 +1371,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'SCRIPT_NAME' => $scriptName,
|
||||
]
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1441,7 +1394,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'SCRIPT_NAME' => $scriptName,
|
||||
]
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1464,7 +1417,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'SCRIPT_NAME' => $scriptName,
|
||||
]
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1519,7 +1472,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'REQUEST_URI' => '/test.php'
|
||||
]
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1559,7 +1512,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'SCRIPT_NAME' => '/test.php',
|
||||
]
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1587,7 +1540,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'nc_sameSiteCookielax' => 'true',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1617,7 +1570,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'nc_sameSiteCookielax' => 'true',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1647,7 +1600,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'nc_sameSiteCookielax' => 'true',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1673,7 +1626,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'requesttoken' => 'AAAHGxsTCTc3BgMQESAcNR0OAR0=:MyTotalSecretShareds',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1697,7 +1650,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'requesttoken' => 'AAAHGxsTCTc3BgMQESAcNR0OAR0=:MyTotalSecretShareds',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1721,7 +1674,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'HTTP_REQUESTTOKEN' => 'AAAHGxsTCTc3BgMQESAcNR0OAR0=:MyTotalSecretShareds',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1749,7 +1702,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'nc_sameSiteCookiestrict' => 'true',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1777,7 +1730,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'__Host-nc_sameSiteCookielax' => 'true',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1809,7 +1762,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'nc_sameSiteCookielax' => 'true',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1832,7 +1785,7 @@ class RequestTest extends \Test\TestCase {
|
|||
->setMethods(['getScriptName'])
|
||||
->setConstructorArgs([
|
||||
[],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1857,7 +1810,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'nc_sameSiteCookielax' => 'true',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1880,7 +1833,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'RandomCookie' => 'asdf',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1903,7 +1856,7 @@ class RequestTest extends \Test\TestCase {
|
|||
session_name() => 'asdf',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1926,7 +1879,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'nc_token' => 'asdf',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1950,7 +1903,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'foo' => 'bar',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -1977,7 +1930,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'nc_sameSiteCookielax' => 'true',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -2001,7 +1954,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'nc_sameSiteCookiestrict' => 'true',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -2025,7 +1978,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'nc_sameSiteCookielax' => 'true',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -2049,7 +2002,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'nc_sameSiteCookiestrict' => 'true',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -2074,7 +2027,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'nc_sameSiteCookiestrict' => 'false',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -2109,7 +2062,7 @@ class RequestTest extends \Test\TestCase {
|
|||
'HTTP_REQUESTTOKEN' => $invalidToken,
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
@ -2132,7 +2085,7 @@ class RequestTest extends \Test\TestCase {
|
|||
->setMethods(['getScriptName'])
|
||||
->setConstructorArgs([
|
||||
[],
|
||||
$this->secureRandom,
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
|
|
|
|||
Loading…
Reference in a new issue