From 9eade36ae5ac8d0fd9e002c78494f3ad19f919ab Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 18 May 2016 18:40:34 +0200 Subject: [PATCH] Fix namespaces in AppFramework tests --- tests/lib/appframework/AppTest.php | 3 ++- .../controller/ApiControllerTest.php | 3 ++- .../controller/ControllerTest.php | 3 ++- .../controller/OCSControllerTest.php | 3 ++- tests/lib/appframework/db/EntityTest.php | 5 +++- .../dependencyinjection/DIContainerTest.php | 4 +-- .../http/ContentSecurityPolicyTest.php | 2 +- .../appframework/http/DataResponseTest.php | 2 +- .../lib/appframework/http/DispatcherTest.php | 4 ++- .../http/DownloadResponseTest.php | 4 ++- .../http/EmptyContentSecurityPolicyTest.php | 2 +- tests/lib/appframework/http/HttpTest.php | 2 +- .../appframework/http/JSONResponseTest.php | 2 +- .../lib/appframework/http/OCSResponseTest.php | 2 +- .../http/RedirectResponseTest.php | 3 ++- tests/lib/appframework/http/RequestTest.php | 3 ++- tests/lib/appframework/http/ResponseTest.php | 2 +- .../appframework/http/StreamResponseTest.php | 3 ++- .../http/TemplateResponseTest.php | 2 +- .../middleware/MiddlewareDispatcherTest.php | 2 +- .../middleware/MiddlewareTest.php | 2 +- .../security/CORSMiddlewareTest.php | 3 ++- .../security/SecurityMiddlewareTest.php | 3 ++- .../middleware/sessionmiddlewaretest.php | 2 +- .../lib/appframework/routing/RoutingTest.php | 4 ++- .../utility/ControllerMethodReflectorTest.php | 26 ++++++++++--------- 26 files changed, 58 insertions(+), 38 deletions(-) diff --git a/tests/lib/appframework/AppTest.php b/tests/lib/appframework/AppTest.php index 3d41d6590a..7288e686d5 100644 --- a/tests/lib/appframework/AppTest.php +++ b/tests/lib/appframework/AppTest.php @@ -22,8 +22,9 @@ */ -namespace OC\AppFramework; +namespace Test\AppFramework; +use OC\AppFramework\App; use OCP\AppFramework\Http\Response; diff --git a/tests/lib/appframework/controller/ApiControllerTest.php b/tests/lib/appframework/controller/ApiControllerTest.php index 137e5950f6..783eecf93e 100644 --- a/tests/lib/appframework/controller/ApiControllerTest.php +++ b/tests/lib/appframework/controller/ApiControllerTest.php @@ -22,9 +22,10 @@ */ -namespace OCP\AppFramework; +namespace Test\AppFramework\Controller; use OC\AppFramework\Http\Request; +use OCP\AppFramework\ApiController; class ChildApiController extends ApiController {}; diff --git a/tests/lib/appframework/controller/ControllerTest.php b/tests/lib/appframework/controller/ControllerTest.php index 1493c0c317..521799a46c 100644 --- a/tests/lib/appframework/controller/ControllerTest.php +++ b/tests/lib/appframework/controller/ControllerTest.php @@ -22,9 +22,10 @@ */ -namespace OCP\AppFramework; +namespace Test\AppFramework\Controller; use OC\AppFramework\Http\Request; +use OCP\AppFramework\Controller; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http\DataResponse; diff --git a/tests/lib/appframework/controller/OCSControllerTest.php b/tests/lib/appframework/controller/OCSControllerTest.php index 92b092cf0e..f69740d449 100644 --- a/tests/lib/appframework/controller/OCSControllerTest.php +++ b/tests/lib/appframework/controller/OCSControllerTest.php @@ -22,10 +22,11 @@ */ -namespace OCP\AppFramework; +namespace Test\AppFramework\Controller; use OC\AppFramework\Http\Request; use OCP\AppFramework\Http\DataResponse; +use OCP\AppFramework\OCSController; class ChildOCSController extends OCSController {} diff --git a/tests/lib/appframework/db/EntityTest.php b/tests/lib/appframework/db/EntityTest.php index 161e11d803..e1a3d7533b 100644 --- a/tests/lib/appframework/db/EntityTest.php +++ b/tests/lib/appframework/db/EntityTest.php @@ -21,7 +21,10 @@ * */ -namespace OCP\AppFramework\Db; +namespace Test\AppFramework\Db; + + +use OCP\AppFramework\Db\Entity; /** diff --git a/tests/lib/appframework/dependencyinjection/DIContainerTest.php b/tests/lib/appframework/dependencyinjection/DIContainerTest.php index fc15b5a44e..5aa000fa25 100644 --- a/tests/lib/appframework/dependencyinjection/DIContainerTest.php +++ b/tests/lib/appframework/dependencyinjection/DIContainerTest.php @@ -24,11 +24,11 @@ */ -namespace OC\AppFramework\DependencyInjection; +namespace Test\AppFramework\DependencyInjection; + use \OC\AppFramework\Http\Request; - class DIContainerTest extends \Test\TestCase { private $container; diff --git a/tests/lib/appframework/http/ContentSecurityPolicyTest.php b/tests/lib/appframework/http/ContentSecurityPolicyTest.php index adf03185e9..82f2b3873b 100644 --- a/tests/lib/appframework/http/ContentSecurityPolicyTest.php +++ b/tests/lib/appframework/http/ContentSecurityPolicyTest.php @@ -7,7 +7,7 @@ */ -namespace OC\AppFramework\Http; +namespace Test\AppFramework\Http; use OCP\AppFramework\Http; use OCP\AppFramework\Http\ContentSecurityPolicy; diff --git a/tests/lib/appframework/http/DataResponseTest.php b/tests/lib/appframework/http/DataResponseTest.php index e3d5689d54..cde553cdf5 100644 --- a/tests/lib/appframework/http/DataResponseTest.php +++ b/tests/lib/appframework/http/DataResponseTest.php @@ -22,7 +22,7 @@ */ -namespace OC\AppFramework\Http; +namespace Test\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; diff --git a/tests/lib/appframework/http/DispatcherTest.php b/tests/lib/appframework/http/DispatcherTest.php index 02c86df8e7..6df6f7fa7f 100644 --- a/tests/lib/appframework/http/DispatcherTest.php +++ b/tests/lib/appframework/http/DispatcherTest.php @@ -22,8 +22,10 @@ */ -namespace OC\AppFramework\Http; +namespace Test\AppFramework\Http; +use OC\AppFramework\Http\Dispatcher; +use OC\AppFramework\Http\Request; use OC\AppFramework\Utility\ControllerMethodReflector; use OCP\AppFramework\Http; use OCP\AppFramework\Http\JSONResponse; diff --git a/tests/lib/appframework/http/DownloadResponseTest.php b/tests/lib/appframework/http/DownloadResponseTest.php index 5e5db2c55e..07c932b272 100644 --- a/tests/lib/appframework/http/DownloadResponseTest.php +++ b/tests/lib/appframework/http/DownloadResponseTest.php @@ -22,9 +22,11 @@ */ -namespace OCP\AppFramework\Http; +namespace Test\AppFramework\Http; +use OCP\AppFramework\Http\DownloadResponse; + class ChildDownloadResponse extends DownloadResponse { }; diff --git a/tests/lib/appframework/http/EmptyContentSecurityPolicyTest.php b/tests/lib/appframework/http/EmptyContentSecurityPolicyTest.php index 0d0f92de81..248c3d808d 100644 --- a/tests/lib/appframework/http/EmptyContentSecurityPolicyTest.php +++ b/tests/lib/appframework/http/EmptyContentSecurityPolicyTest.php @@ -7,7 +7,7 @@ */ -namespace OC\AppFramework\Http; +namespace Test\AppFramework\Http; use OCP\AppFramework\Http; use OCP\AppFramework\Http\EmptyContentSecurityPolicy; diff --git a/tests/lib/appframework/http/HttpTest.php b/tests/lib/appframework/http/HttpTest.php index 4bcc8305db..66256d1a86 100644 --- a/tests/lib/appframework/http/HttpTest.php +++ b/tests/lib/appframework/http/HttpTest.php @@ -22,7 +22,7 @@ */ -namespace OC\AppFramework\Http; +namespace Test\AppFramework\Http; use OC\AppFramework\Http; diff --git a/tests/lib/appframework/http/JSONResponseTest.php b/tests/lib/appframework/http/JSONResponseTest.php index a98f5fc894..23a55e7eee 100644 --- a/tests/lib/appframework/http/JSONResponseTest.php +++ b/tests/lib/appframework/http/JSONResponseTest.php @@ -24,7 +24,7 @@ */ -namespace OC\AppFramework\Http; +namespace Test\AppFramework\Http; use OCP\AppFramework\Http\JSONResponse; diff --git a/tests/lib/appframework/http/OCSResponseTest.php b/tests/lib/appframework/http/OCSResponseTest.php index 1ca3e330ba..adac66a231 100644 --- a/tests/lib/appframework/http/OCSResponseTest.php +++ b/tests/lib/appframework/http/OCSResponseTest.php @@ -22,7 +22,7 @@ */ -namespace OC\AppFramework\Http; +namespace Test\AppFramework\Http; use OCP\AppFramework\Http\OCSResponse; diff --git a/tests/lib/appframework/http/RedirectResponseTest.php b/tests/lib/appframework/http/RedirectResponseTest.php index 723f6600c5..5ef82a1221 100644 --- a/tests/lib/appframework/http/RedirectResponseTest.php +++ b/tests/lib/appframework/http/RedirectResponseTest.php @@ -22,9 +22,10 @@ */ -namespace OCP\AppFramework\Http; +namespace Test\AppFramework\Http; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\RedirectResponse; class RedirectResponseTest extends \Test\TestCase { diff --git a/tests/lib/appframework/http/RequestTest.php b/tests/lib/appframework/http/RequestTest.php index 3f1d09c2a9..5b96090899 100644 --- a/tests/lib/appframework/http/RequestTest.php +++ b/tests/lib/appframework/http/RequestTest.php @@ -8,8 +8,9 @@ * See the COPYING-README file. */ -namespace OC\AppFramework\Http; +namespace Test\AppFramework\Http; +use OC\AppFramework\Http\Request; use OC\Security\CSRF\CsrfToken; use OC\Security\CSRF\CsrfTokenManager; use OCP\Security\ISecureRandom; diff --git a/tests/lib/appframework/http/ResponseTest.php b/tests/lib/appframework/http/ResponseTest.php index f845f02d98..0c582f8f6e 100644 --- a/tests/lib/appframework/http/ResponseTest.php +++ b/tests/lib/appframework/http/ResponseTest.php @@ -22,7 +22,7 @@ */ -namespace OC\AppFramework\Http; +namespace Test\AppFramework\Http; use OCP\AppFramework\Http\Response; diff --git a/tests/lib/appframework/http/StreamResponseTest.php b/tests/lib/appframework/http/StreamResponseTest.php index 4c47ecfbd6..1f761d6b89 100644 --- a/tests/lib/appframework/http/StreamResponseTest.php +++ b/tests/lib/appframework/http/StreamResponseTest.php @@ -22,10 +22,11 @@ */ -namespace OC\AppFramework\Http; +namespace Test\AppFramework\Http; use OCP\AppFramework\Http\StreamResponse; +use OCP\AppFramework\Http\IOutput; use OCP\AppFramework\Http; diff --git a/tests/lib/appframework/http/TemplateResponseTest.php b/tests/lib/appframework/http/TemplateResponseTest.php index 2ec57f8979..87fb6864f7 100644 --- a/tests/lib/appframework/http/TemplateResponseTest.php +++ b/tests/lib/appframework/http/TemplateResponseTest.php @@ -22,7 +22,7 @@ */ -namespace OC\AppFramework\Http; +namespace Test\AppFramework\Http; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http; diff --git a/tests/lib/appframework/middleware/MiddlewareDispatcherTest.php b/tests/lib/appframework/middleware/MiddlewareDispatcherTest.php index a873152579..f81aca106d 100644 --- a/tests/lib/appframework/middleware/MiddlewareDispatcherTest.php +++ b/tests/lib/appframework/middleware/MiddlewareDispatcherTest.php @@ -22,7 +22,7 @@ */ -namespace OC\AppFramework; +namespace Test\AppFramework\Middleware; use OC\AppFramework\Http\Request; use OC\AppFramework\Middleware\MiddlewareDispatcher; diff --git a/tests/lib/appframework/middleware/MiddlewareTest.php b/tests/lib/appframework/middleware/MiddlewareTest.php index 33f04e1383..013403a9a4 100644 --- a/tests/lib/appframework/middleware/MiddlewareTest.php +++ b/tests/lib/appframework/middleware/MiddlewareTest.php @@ -22,7 +22,7 @@ */ -namespace OC\AppFramework; +namespace Test\AppFramework\Middleware; use OC\AppFramework\Http\Request; use OCP\AppFramework\Middleware; diff --git a/tests/lib/appframework/middleware/security/CORSMiddlewareTest.php b/tests/lib/appframework/middleware/security/CORSMiddlewareTest.php index cf5f97a046..8e53c9202c 100644 --- a/tests/lib/appframework/middleware/security/CORSMiddlewareTest.php +++ b/tests/lib/appframework/middleware/security/CORSMiddlewareTest.php @@ -10,9 +10,10 @@ */ -namespace OC\AppFramework\Middleware\Security; +namespace Test\AppFramework\Middleware\Security; use OC\AppFramework\Http\Request; +use OC\AppFramework\Middleware\Security\CORSMiddleware; use OC\AppFramework\Utility\ControllerMethodReflector; use OC\AppFramework\Middleware\Security\Exceptions\SecurityException; use OCP\AppFramework\Http; diff --git a/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php b/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php index f70308dc73..8cdba76d83 100644 --- a/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php +++ b/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php @@ -22,7 +22,7 @@ -namespace OC\AppFramework\Middleware\Security; +namespace Test\AppFramework\Middleware\Security; use OC\AppFramework\Http; use OC\AppFramework\Http\Request; @@ -31,6 +31,7 @@ use OC\AppFramework\Middleware\Security\Exceptions\CrossSiteRequestForgeryExcept use OC\AppFramework\Middleware\Security\Exceptions\NotAdminException; use OC\AppFramework\Middleware\Security\Exceptions\NotLoggedInException; use OC\AppFramework\Middleware\Security\Exceptions\SecurityException; +use OC\AppFramework\Middleware\Security\SecurityMiddleware; use OC\AppFramework\Utility\ControllerMethodReflector; use OC\Security\CSP\ContentSecurityPolicy; use OCP\AppFramework\Http\RedirectResponse; diff --git a/tests/lib/appframework/middleware/sessionmiddlewaretest.php b/tests/lib/appframework/middleware/sessionmiddlewaretest.php index 11c1600f51..17fcc1904c 100644 --- a/tests/lib/appframework/middleware/sessionmiddlewaretest.php +++ b/tests/lib/appframework/middleware/sessionmiddlewaretest.php @@ -10,7 +10,7 @@ */ -namespace OC\AppFramework\Middleware\Security; +namespace Test\AppFramework\Middleware; use OC\AppFramework\Http\Request; use OC\AppFramework\Middleware\SessionMiddleware; diff --git a/tests/lib/appframework/routing/RoutingTest.php b/tests/lib/appframework/routing/RoutingTest.php index 3ceab1aac4..326c156af9 100644 --- a/tests/lib/appframework/routing/RoutingTest.php +++ b/tests/lib/appframework/routing/RoutingTest.php @@ -1,8 +1,10 @@ reflect( - '\OC\AppFramework\Utility\ControllerMethodReflectorTest', + '\Test\AppFramework\Utility\ControllerMethodReflectorTest', 'testReadAnnotation' ); @@ -81,7 +83,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { public function testReadAnnotationNoLowercase(){ $reader = new ControllerMethodReflector(); $reader->reflect( - '\OC\AppFramework\Utility\ControllerMethodReflectorTest', + '\Test\AppFramework\Utility\ControllerMethodReflectorTest', 'testReadAnnotationNoLowercase' ); @@ -97,7 +99,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { public function testReadTypeIntAnnotations(){ $reader = new ControllerMethodReflector(); $reader->reflect( - '\OC\AppFramework\Utility\ControllerMethodReflectorTest', + '\Test\AppFramework\Utility\ControllerMethodReflectorTest', 'testReadTypeIntAnnotations' ); @@ -117,7 +119,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { public function testReadTypeIntAnnotationsScalarTypes(){ $reader = new ControllerMethodReflector(); $reader->reflect( - '\OC\AppFramework\Utility\ControllerMethodReflectorTest', + '\Test\AppFramework\Utility\ControllerMethodReflectorTest', 'arguments3' ); @@ -135,7 +137,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { public function testReadTypeDoubleAnnotations(){ $reader = new ControllerMethodReflector(); $reader->reflect( - '\OC\AppFramework\Utility\ControllerMethodReflectorTest', + '\Test\AppFramework\Utility\ControllerMethodReflectorTest', 'testReadTypeDoubleAnnotations' ); @@ -149,7 +151,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { public function testReadTypeWhitespaceAnnotations(){ $reader = new ControllerMethodReflector(); $reader->reflect( - '\OC\AppFramework\Utility\ControllerMethodReflectorTest', + '\Test\AppFramework\Utility\ControllerMethodReflectorTest', 'testReadTypeWhitespaceAnnotations' ); @@ -161,7 +163,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { public function testReflectParameters() { $reader = new ControllerMethodReflector(); $reader->reflect( - '\OC\AppFramework\Utility\ControllerMethodReflectorTest', + '\Test\AppFramework\Utility\ControllerMethodReflectorTest', 'arguments' ); @@ -173,7 +175,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { public function testReflectParameters2() { $reader = new ControllerMethodReflector(); $reader->reflect( - '\OC\AppFramework\Utility\ControllerMethodReflectorTest', + '\Test\AppFramework\Utility\ControllerMethodReflectorTest', 'arguments2' ); @@ -183,7 +185,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { public function testInheritance() { $reader = new ControllerMethodReflector(); - $reader->reflect('OC\AppFramework\Utility\EndController', 'test'); + $reader->reflect('Test\AppFramework\Utility\EndController', 'test'); $this->assertTrue($reader->hasAnnotation('Annotation')); } @@ -191,7 +193,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { public function testInheritanceOverride() { $reader = new ControllerMethodReflector(); - $reader->reflect('OC\AppFramework\Utility\EndController', 'test2'); + $reader->reflect('Test\AppFramework\Utility\EndController', 'test2'); $this->assertTrue($reader->hasAnnotation('NoAnnotation')); $this->assertFalse($reader->hasAnnotation('Annotation')); @@ -200,7 +202,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { public function testInheritanceOverrideNoDocblock() { $reader = new ControllerMethodReflector(); - $reader->reflect('OC\AppFramework\Utility\EndController', 'test3'); + $reader->reflect('Test\AppFramework\Utility\EndController', 'test3'); $this->assertFalse($reader->hasAnnotation('Annotation')); }