diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-05-19 10:30:07 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2016-05-19 10:30:07 +0200 |
commit | e36a27d21c4746da2858eb98de8656ec74a449b1 (patch) | |
tree | d05b6635e197660b5864646f93766d0f8600621e /tests/lib | |
parent | ae7e14b2232039f25eb8b17a0e46c246f3c7c6eb (diff) | |
parent | f57407e73e2c3aa4daa3c1ac6c9778602187daad (diff) | |
download | nextcloud-server-e36a27d21c4746da2858eb98de8656ec74a449b1.tar.gz nextcloud-server-e36a27d21c4746da2858eb98de8656ec74a449b1.zip |
Merge pull request #24712 from owncloud/fix-test-namespaces
Fix test namespaces [a-e]
Diffstat (limited to 'tests/lib')
39 files changed, 107 insertions, 74 deletions
diff --git a/tests/lib/appframework/AppTest.php b/tests/lib/appframework/AppTest.php index 3d41d6590aa..7288e686d52 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 137e5950f67..783eecf93e5 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 1493c0c3175..521799a46ce 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 92b092cf0e9..f69740d4496 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 161e11d8030..e1a3d7533be 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 fc15b5a44ee..5aa000fa25a 100644 --- a/tests/lib/appframework/dependencyinjection/DIContainerTest.php +++ b/tests/lib/appframework/dependencyinjection/DIContainerTest.php @@ -24,10 +24,10 @@ */ -namespace OC\AppFramework\DependencyInjection; +namespace Test\AppFramework\DependencyInjection; -use \OC\AppFramework\Http\Request; +use \OC\AppFramework\Http\Request; class DIContainerTest extends \Test\TestCase { diff --git a/tests/lib/appframework/http/ContentSecurityPolicyTest.php b/tests/lib/appframework/http/ContentSecurityPolicyTest.php index adf03185e9f..82f2b3873b7 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 e3d5689d54c..cde553cdf5f 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 02c86df8e72..6df6f7fa7fe 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 5e5db2c55ec..07c932b2725 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 0d0f92de819..248c3d808d2 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 4bcc8305db4..66256d1a86f 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 a98f5fc894a..23a55e7eee8 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 1ca3e330bad..adac66a231c 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 723f6600c55..5ef82a1221d 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 3f1d09c2a93..5b960908991 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 f845f02d984..0c582f8f6ea 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 4c47ecfbd6c..1f761d6b89c 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 2ec57f8979a..87fb6864f78 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 a8731525798..f81aca106d6 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 33f04e1383d..013403a9a4a 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 cf5f97a046f..8e53c9202cf 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 f70308dc731..8cdba76d835 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 11c1600f515..17fcc1904c1 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 3ceab1aac48..326c156af98 100644 --- a/tests/lib/appframework/routing/RoutingTest.php +++ b/tests/lib/appframework/routing/RoutingTest.php @@ -1,8 +1,10 @@ <?php -namespace OC\AppFramework\Routing; +namespace Test\AppFramework\Routing; use OC\AppFramework\DependencyInjection\DIContainer; +use OC\AppFramework\Routing\RouteActionHandler; +use OC\AppFramework\Routing\RouteConfig; class RoutingTest extends \Test\TestCase { diff --git a/tests/lib/appframework/utility/ControllerMethodReflectorTest.php b/tests/lib/appframework/utility/ControllerMethodReflectorTest.php index c643c362a9c..92d767e9987 100644 --- a/tests/lib/appframework/utility/ControllerMethodReflectorTest.php +++ b/tests/lib/appframework/utility/ControllerMethodReflectorTest.php @@ -22,9 +22,11 @@ */ -namespace OC\AppFramework\Utility; +namespace Test\AppFramework\Utility; +use OC\AppFramework\Utility\ControllerMethodReflector; + class BaseController { /** @@ -66,7 +68,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { public function testReadAnnotation(){ $reader = new ControllerMethodReflector(); $reader->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')); } diff --git a/tests/lib/archive/tar.php b/tests/lib/archive/tartest.php index 2d20bb4c3b1..998ce201e72 100644 --- a/tests/lib/archive/tar.php +++ b/tests/lib/archive/tartest.php @@ -6,23 +6,26 @@ * See the COPYING-README file. */ +namespace Test\Archive; + + use OC\Archive\TAR; -class Test_Archive_TAR extends Test_Archive { +class TARTest extends TestBase { protected function setUp() { parent::setUp(); - if (OC_Util::runningOnWindows()) { + if (\OC_Util::runningOnWindows()) { $this->markTestSkipped('[Windows] tar archives are not supported on Windows'); } } protected function getExisting() { - $dir = OC::$SERVERROOT . '/tests/data'; + $dir = \OC::$SERVERROOT . '/tests/data'; return new TAR($dir . '/data.tar.gz'); } protected function getNew() { - return new TAR(OCP\Files::tmpFile('.tar.gz')); + return new TAR(\OCP\Files::tmpFile('.tar.gz')); } } diff --git a/tests/lib/archive.php b/tests/lib/archive/testbase.php index 690b4378b88..5bf4d9d43ea 100644 --- a/tests/lib/archive.php +++ b/tests/lib/archive/testbase.php @@ -6,20 +6,23 @@ * See the COPYING-README file. */ -abstract class Test_Archive extends \Test\TestCase { +namespace Test\Archive; + + +abstract class TestBase extends \Test\TestCase { /** - * @var OC_Archive + * @var \OC\Archive\Archive */ protected $instance; /** * get the existing test archive - * @return OC_Archive + * @return \OC\Archive\Archive */ abstract protected function getExisting(); /** * get a new archive for write testing - * @return OC_Archive + * @return \OC\Archive\Archive */ abstract protected function getNew(); @@ -51,17 +54,17 @@ abstract class Test_Archive extends \Test\TestCase { public function testContent() { $this->instance=$this->getExisting(); - $dir=OC::$SERVERROOT.'/tests/data'; + $dir=\OC::$SERVERROOT.'/tests/data'; $textFile=$dir.'/lorem.txt'; $this->assertEquals(file_get_contents($textFile), $this->instance->getFile('lorem.txt')); - $tmpFile=OCP\Files::tmpFile('.txt'); + $tmpFile=\OCP\Files::tmpFile('.txt'); $this->instance->extractFile('lorem.txt', $tmpFile); $this->assertEquals(file_get_contents($textFile), file_get_contents($tmpFile)); } public function testWrite() { - $dir=OC::$SERVERROOT.'/tests/data'; + $dir=\OC::$SERVERROOT.'/tests/data'; $textFile=$dir.'/lorem.txt'; $this->instance=$this->getNew(); $this->assertEquals(0, count($this->instance->getFiles())); @@ -76,7 +79,7 @@ abstract class Test_Archive extends \Test\TestCase { } public function testReadStream() { - $dir=OC::$SERVERROOT.'/tests/data'; + $dir=\OC::$SERVERROOT.'/tests/data'; $this->instance=$this->getExisting(); $fh=$this->instance->getStream('lorem.txt', 'r'); $this->assertTrue((bool)$fh); @@ -85,11 +88,11 @@ abstract class Test_Archive extends \Test\TestCase { $this->assertEquals(file_get_contents($dir.'/lorem.txt'), $content); } public function testWriteStream() { - $dir=OC::$SERVERROOT.'/tests/data'; + $dir=\OC::$SERVERROOT.'/tests/data'; $this->instance=$this->getNew(); $fh=$this->instance->getStream('lorem.txt', 'w'); $source=fopen($dir.'/lorem.txt', 'r'); - OCP\Files::streamCopy($source, $fh); + \OCP\Files::streamCopy($source, $fh); fclose($source); fclose($fh); $this->assertTrue($this->instance->fileExists('lorem.txt')); @@ -107,18 +110,18 @@ abstract class Test_Archive extends \Test\TestCase { $this->assertFalse($this->instance->fileExists('/test/')); } public function testExtract() { - $dir=OC::$SERVERROOT.'/tests/data'; + $dir=\OC::$SERVERROOT.'/tests/data'; $this->instance=$this->getExisting(); - $tmpDir=OCP\Files::tmpFolder(); + $tmpDir=\OCP\Files::tmpFolder(); $this->instance->extract($tmpDir); $this->assertEquals(true, file_exists($tmpDir.'lorem.txt')); $this->assertEquals(true, file_exists($tmpDir.'dir/lorem.txt')); $this->assertEquals(true, file_exists($tmpDir.'logo-wide.png')); $this->assertEquals(file_get_contents($dir.'/lorem.txt'), file_get_contents($tmpDir.'lorem.txt')); - OCP\Files::rmdirr($tmpDir); + \OCP\Files::rmdirr($tmpDir); } public function testMoveRemove() { - $dir=OC::$SERVERROOT.'/tests/data'; + $dir=\OC::$SERVERROOT.'/tests/data'; $textFile=$dir.'/lorem.txt'; $this->instance=$this->getNew(); $this->instance->addFile('lorem.txt', $textFile); @@ -131,7 +134,7 @@ abstract class Test_Archive extends \Test\TestCase { $this->assertFalse($this->instance->fileExists('target.txt')); } public function testRecursive() { - $dir=OC::$SERVERROOT.'/tests/data'; + $dir=\OC::$SERVERROOT.'/tests/data'; $this->instance=$this->getNew(); $this->instance->addRecursive('/dir', $dir); $this->assertTrue($this->instance->fileExists('/dir/lorem.txt')); diff --git a/tests/lib/archive/zip.php b/tests/lib/archive/ziptest.php index 2f4c9cace1d..8d639e0d686 100644 --- a/tests/lib/archive/zip.php +++ b/tests/lib/archive/ziptest.php @@ -6,23 +6,26 @@ * See the COPYING-README file. */ +namespace Test\Archive; + + use OC\Archive\ZIP; -class Test_Archive_ZIP extends Test_Archive { +class ZIPTest extends TestBase { protected function setUp() { parent::setUp(); - if (OC_Util::runningOnWindows()) { + if (\OC_Util::runningOnWindows()) { $this->markTestSkipped('[Windows] '); } } protected function getExisting() { - $dir = OC::$SERVERROOT . '/tests/data'; + $dir = \OC::$SERVERROOT . '/tests/data'; return new ZIP($dir . '/data.zip'); } protected function getNew() { - return new ZIP(OCP\Files::tmpFile('.zip')); + return new ZIP(\OCP\Files::tmpFile('.zip')); } } diff --git a/tests/lib/cache/cappedmemorycache.php b/tests/lib/cache/cappedmemorycache.php index a8fb273b80a..c9c74de72db 100644 --- a/tests/lib/cache/cappedmemorycache.php +++ b/tests/lib/cache/cappedmemorycache.php @@ -29,7 +29,7 @@ namespace Test\Cache; * * @package Test\Cache */ -class CappedMemoryCache extends \Test_Cache { +class CappedMemoryCache extends TestCache { public function setUp() { parent::setUp(); $this->instance = new \OC\Cache\CappedMemoryCache(); diff --git a/tests/lib/cache/file.php b/tests/lib/cache/filecache.php index 92b784bf8ea..a85b12671f3 100644 --- a/tests/lib/cache/file.php +++ b/tests/lib/cache/filecache.php @@ -29,7 +29,7 @@ namespace Test\Cache; * * @package Test\Cache */ -class FileCache extends \Test_Cache { +class FileCache extends TestCache { /** * @var string * */ diff --git a/tests/lib/cache.php b/tests/lib/cache/testcache.php index a91f37467d2..75ff65207ee 100644 --- a/tests/lib/cache.php +++ b/tests/lib/cache/testcache.php @@ -6,7 +6,9 @@ * See the COPYING-README file. */ -abstract class Test_Cache extends \Test\TestCase { +namespace Test\Cache; + +abstract class TestCache extends \Test\TestCase { /** * @var \OCP\ICache cache; */ diff --git a/tests/lib/command/background.php b/tests/lib/command/backgroundjobs.php index 7e992480530..7e992480530 100644 --- a/tests/lib/command/background.php +++ b/tests/lib/command/backgroundjobs.php diff --git a/tests/lib/comments/comment.php b/tests/lib/comments/commenttest.php index 9b3f2ab166e..b55c345f71f 100644 --- a/tests/lib/comments/comment.php +++ b/tests/lib/comments/commenttest.php @@ -5,8 +5,7 @@ namespace Test\Comments; use OCP\Comments\IComment; use Test\TestCase; -class Test_Comments_Comment extends TestCase -{ +class CommentTest extends TestCase { public function testSettersValidInput() { $comment = new \OC\Comments\Comment(); diff --git a/tests/lib/comments/manager.php b/tests/lib/comments/managertest.php index c55f4728883..90a8399eb2b 100644 --- a/tests/lib/comments/manager.php +++ b/tests/lib/comments/managertest.php @@ -6,12 +6,11 @@ use OCP\Comments\ICommentsManager; use Test\TestCase; /** - * Class Test_Comments_Manager + * Class ManagerTest * * @group DB */ -class Test_Comments_Manager extends TestCase -{ +class ManagerTest extends TestCase { public function setUp() { parent::setUp(); diff --git a/tests/lib/db/mysqlmigration.php b/tests/lib/db/mysqlmigration.php index 51e8801dc3b..42ed6ba7251 100644 --- a/tests/lib/db/mysqlmigration.php +++ b/tests/lib/db/mysqlmigration.php @@ -6,12 +6,14 @@ * See the COPYING-README file. */ +namespace Test\DB; + /** - * Class TestMySqlMigration + * Class MySqlMigration * * @group DB */ -class TestMySqlMigration extends \Test\TestCase { +class MySqlMigration extends \Test\TestCase { /** @var \Doctrine\DBAL\Connection */ private $connection; diff --git a/tests/lib/db/sqlitemigration.php b/tests/lib/db/sqlitemigration.php index f23f4d4ee86..176b947e310 100644 --- a/tests/lib/db/sqlitemigration.php +++ b/tests/lib/db/sqlitemigration.php @@ -6,12 +6,14 @@ * See the COPYING-README file. */ +namespace Test\DB; + /** - * Class TestSqliteMigration + * Class SqliteMigration * * @group DB */ -class TestSqliteMigration extends \Test\TestCase { +class SqliteMigration extends \Test\TestCase { /** @var \Doctrine\DBAL\Connection */ private $connection; diff --git a/tests/lib/encryption/keys/storage.php b/tests/lib/encryption/keys/storagetest.php index b5b91f886a3..b5b91f886a3 100644 --- a/tests/lib/encryption/keys/storage.php +++ b/tests/lib/encryption/keys/storagetest.php diff --git a/tests/lib/memcache/cache.php b/tests/lib/memcache/cache.php index 725b0fbbf57..8d6a231dd8d 100644 --- a/tests/lib/memcache/cache.php +++ b/tests/lib/memcache/cache.php @@ -9,7 +9,7 @@ namespace Test\Memcache; -abstract class Cache extends \Test_Cache { +abstract class Cache extends \Test\Cache\TestCache { /** * @var \OCP\IMemcache cache; */ |