aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/appframework/controller
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-02-09 11:41:48 +0100
committerLukas Reschke <lukas@owncloud.com>2015-02-09 11:53:11 +0100
commit770fa761b8bf8452ff17a2036ca8413e74935a3d (patch)
treeecce3b7443278b0ebdac588ba40840190a3aadcd /tests/lib/appframework/controller
parent0e604aa875a677f76b2bf326631646ac31fbadbd (diff)
downloadnextcloud-server-770fa761b8bf8452ff17a2036ca8413e74935a3d.tar.gz
nextcloud-server-770fa761b8bf8452ff17a2036ca8413e74935a3d.zip
Respect `mod_unique_id` and refactor `OC_Request::getRequestId`
When `mod_unique_id` is enabled the ID generated by it will be used for logging. This allows for correlation of the Apache logs and the ownCloud logs. Testplan: - [ ] When `mod_unique_id` is enabled the request ID equals the one generated by `mod_unique_id`. - [ ] When `mod_unique_id` is not available the request ID is a 20 character long random string - [ ] The generated Id is stable over the lifespan of one request Changeset looks a little bit larger since I had to adjust every unit test using the HTTP\Request class for proper DI. Fixes https://github.com/owncloud/core/issues/13366
Diffstat (limited to 'tests/lib/appframework/controller')
-rw-r--r--tests/lib/appframework/controller/ApiControllerTest.php7
-rw-r--r--tests/lib/appframework/controller/ControllerTest.php17
2 files changed, 13 insertions, 11 deletions
diff --git a/tests/lib/appframework/controller/ApiControllerTest.php b/tests/lib/appframework/controller/ApiControllerTest.php
index 3055fbe0da8..014ddb62437 100644
--- a/tests/lib/appframework/controller/ApiControllerTest.php
+++ b/tests/lib/appframework/controller/ApiControllerTest.php
@@ -25,18 +25,19 @@
namespace OCP\AppFramework;
use OC\AppFramework\Http\Request;
-use OCP\AppFramework\Http\TemplateResponse;
class ChildApiController extends ApiController {};
class ApiControllerTest extends \Test\TestCase {
-
+ /** @var ChildApiController */
+ protected $controller;
public function testCors() {
$request = new Request(
- array('server' => array('HTTP_ORIGIN' => 'test'))
+ ['server' => ['HTTP_ORIGIN' => 'test']],
+ $this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock()
);
$this->controller = new ChildApiController('app', $request, 'verbs',
'headers', 100);
diff --git a/tests/lib/appframework/controller/ControllerTest.php b/tests/lib/appframework/controller/ControllerTest.php
index 18d47d00f6b..58395d05914 100644
--- a/tests/lib/appframework/controller/ControllerTest.php
+++ b/tests/lib/appframework/controller/ControllerTest.php
@@ -66,15 +66,16 @@ class ControllerTest extends \Test\TestCase {
parent::setUp();
$request = new Request(
- array(
- 'get' => array('name' => 'John Q. Public', 'nickname' => 'Joey'),
- 'post' => array('name' => 'Jane Doe', 'nickname' => 'Janey'),
- 'urlParams' => array('name' => 'Johnny Weissmüller'),
- 'files' => array('file' => 'filevalue'),
- 'env' => array('PATH' => 'daheim'),
- 'session' => array('sezession' => 'kein'),
+ [
+ 'get' => ['name' => 'John Q. Public', 'nickname' => 'Joey'],
+ 'post' => ['name' => 'Jane Doe', 'nickname' => 'Janey'],
+ 'urlParams' => ['name' => 'Johnny Weissmüller'],
+ 'files' => ['file' => 'filevalue'],
+ 'env' => ['PATH' => 'daheim'],
+ 'session' => ['sezession' => 'kein'],
'method' => 'hi',
- )
+ ],
+ $this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock()
);
$this->app = $this->getMock('OC\AppFramework\DependencyInjection\DIContainer',