summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-05-11 17:55:59 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-05-11 17:55:59 +0200
commit63f2f16b852e126cbbf478f2d25232195c5a37e4 (patch)
tree3aa091f59938d8e70de2223c1708d3247ebaabe9 /tests
parent474b8f071d4451a61c2ef83bd09e4d9933998331 (diff)
downloadnextcloud-server-63f2f16b852e126cbbf478f2d25232195c5a37e4.tar.gz
nextcloud-server-63f2f16b852e126cbbf478f2d25232195c5a37e4.zip
use new controllermethodreflector for corsmiddleware
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/appframework/middleware/security/CORSMiddlewareTest.php20
1 files changed, 15 insertions, 5 deletions
diff --git a/tests/lib/appframework/middleware/security/CORSMiddlewareTest.php b/tests/lib/appframework/middleware/security/CORSMiddlewareTest.php
index 8224e9b4aa6..79cd3b278af 100644
--- a/tests/lib/appframework/middleware/security/CORSMiddlewareTest.php
+++ b/tests/lib/appframework/middleware/security/CORSMiddlewareTest.php
@@ -13,11 +13,19 @@
namespace OC\AppFramework\Middleware\Security;
use OC\AppFramework\Http\Request;
+use OC\AppFramework\Utility\ControllerMethodReflector;
+
use OCP\AppFramework\Http\Response;
class CORSMiddlewareTest extends \PHPUnit_Framework_TestCase {
+ private $reflector;
+
+ protected function setUp() {
+ $this->reflector = new ControllerMethodReflector();
+ }
+
/**
* @CORS
*/
@@ -25,11 +33,11 @@ class CORSMiddlewareTest extends \PHPUnit_Framework_TestCase {
$request = new Request(
array('server' => array('HTTP_ORIGIN' => 'test'))
);
+ $this->reflector->reflect($this, __FUNCTION__);
+ $middleware = new CORSMiddleware($request, $this->reflector);
- $middleware = new CORSMiddleware($request);
$response = $middleware->afterController($this, __FUNCTION__, new Response());
$headers = $response->getHeaders();
-
$this->assertEquals('test', $headers['Access-Control-Allow-Origin']);
}
@@ -38,7 +46,7 @@ class CORSMiddlewareTest extends \PHPUnit_Framework_TestCase {
$request = new Request(
array('server' => array('HTTP_ORIGIN' => 'test'))
);
- $middleware = new CORSMiddleware($request);
+ $middleware = new CORSMiddleware($request, $this->reflector);
$response = $middleware->afterController($this, __FUNCTION__, new Response());
$headers = $response->getHeaders();
@@ -51,8 +59,9 @@ class CORSMiddlewareTest extends \PHPUnit_Framework_TestCase {
*/
public function testNoOriginHeaderNoCORSHEADER() {
$request = new Request();
+ $this->reflector->reflect($this, __FUNCTION__);
+ $middleware = new CORSMiddleware($request, $this->reflector);
- $middleware = new CORSMiddleware($request);
$response = $middleware->afterController($this, __FUNCTION__, new Response());
$headers = $response->getHeaders();
$this->assertFalse(array_key_exists('Access-Control-Allow-Origin', $headers));
@@ -67,7 +76,8 @@ class CORSMiddlewareTest extends \PHPUnit_Framework_TestCase {
$request = new Request(
array('server' => array('HTTP_ORIGIN' => 'test'))
);
- $middleware = new CORSMiddleware($request);
+ $this->reflector->reflect($this, __FUNCTION__);
+ $middleware = new CORSMiddleware($request, $this->reflector);
$response = new Response();
$response->addHeader('AcCess-control-Allow-Credentials ', 'TRUE');