From b34bacd0718fa24c67a8ef0aa6f3b824a9b525bb Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 12 May 2016 12:07:06 +0200 Subject: [PATCH] Move Files app to PSR-4 (#24569) * Move lib/ of Files app to PSR-4 * Move tests to PSR-4 --- apps/files/lib/{activity.php => Activity.php} | 0 .../lib/{activityhelper.php => ActivityHelper.php} | 0 apps/files/lib/{app.php => App.php} | 0 .../AppInfo/Application.php} | 0 .../CleanupFileLocks.php} | 0 .../DeleteOrphanedItems.php} | 0 .../scanfiles.php => BackgroundJob/ScanFiles.php} | 0 .../lib/{capabilities.php => Capabilities.php} | 0 .../Command/DeleteOrphanedFiles.php} | 0 .../{command/scan.php => lib/Command/Scan.php} | 0 .../Command/TransferOwnership.php} | 0 .../Controller/ApiController.php} | 0 .../Controller/ViewController.php} | 0 apps/files/lib/{helper.php => Helper.php} | 0 .../tagservice.php => lib/Service/TagService.php} | 0 .../tests/{activitytest.php => ActivityTest.php} | 0 .../DeleteOrphanedItemsJobTest.php | 0 .../ScanFilesTest.php | 0 .../DeleteOrphanedFilesTest.php} | 0 .../ApiControllerTest.php} | 0 .../ViewControllerTest.php | 1 + apps/files/tests/{helper.php => HelperTest.php} | 6 +++--- .../tagservice.php => Service/TagServiceTest.php} | 14 ++++++-------- 23 files changed, 10 insertions(+), 11 deletions(-) rename apps/files/lib/{activity.php => Activity.php} (100%) rename apps/files/lib/{activityhelper.php => ActivityHelper.php} (100%) rename apps/files/lib/{app.php => App.php} (100%) rename apps/files/{appinfo/application.php => lib/AppInfo/Application.php} (100%) rename apps/files/lib/{backgroundjob/cleanupfilelocks.php => BackgroundJob/CleanupFileLocks.php} (100%) rename apps/files/lib/{backgroundjob/deleteorphaneditems.php => BackgroundJob/DeleteOrphanedItems.php} (100%) rename apps/files/lib/{backgroundjob/scanfiles.php => BackgroundJob/ScanFiles.php} (100%) rename apps/files/lib/{capabilities.php => Capabilities.php} (100%) rename apps/files/{command/deleteorphanedfiles.php => lib/Command/DeleteOrphanedFiles.php} (100%) rename apps/files/{command/scan.php => lib/Command/Scan.php} (100%) rename apps/files/{command/transferownership.php => lib/Command/TransferOwnership.php} (100%) rename apps/files/{controller/apicontroller.php => lib/Controller/ApiController.php} (100%) rename apps/files/{controller/viewcontroller.php => lib/Controller/ViewController.php} (100%) rename apps/files/lib/{helper.php => Helper.php} (100%) rename apps/files/{service/tagservice.php => lib/Service/TagService.php} (100%) rename apps/files/tests/{activitytest.php => ActivityTest.php} (100%) rename apps/files/tests/{backgroundjob => BackgroundJob}/DeleteOrphanedItemsJobTest.php (100%) rename apps/files/tests/{backgroundjob => BackgroundJob}/ScanFilesTest.php (100%) rename apps/files/tests/{command/deleteorphanedfilestest.php => Command/DeleteOrphanedFilesTest.php} (100%) rename apps/files/tests/{controller/apicontrollertest.php => Controller/ApiControllerTest.php} (100%) rename apps/files/tests/{controller => Controller}/ViewControllerTest.php (99%) rename apps/files/tests/{helper.php => HelperTest.php} (96%) rename apps/files/tests/{service/tagservice.php => Service/TagServiceTest.php} (91%) diff --git a/apps/files/lib/activity.php b/apps/files/lib/Activity.php similarity index 100% rename from apps/files/lib/activity.php rename to apps/files/lib/Activity.php diff --git a/apps/files/lib/activityhelper.php b/apps/files/lib/ActivityHelper.php similarity index 100% rename from apps/files/lib/activityhelper.php rename to apps/files/lib/ActivityHelper.php diff --git a/apps/files/lib/app.php b/apps/files/lib/App.php similarity index 100% rename from apps/files/lib/app.php rename to apps/files/lib/App.php diff --git a/apps/files/appinfo/application.php b/apps/files/lib/AppInfo/Application.php similarity index 100% rename from apps/files/appinfo/application.php rename to apps/files/lib/AppInfo/Application.php diff --git a/apps/files/lib/backgroundjob/cleanupfilelocks.php b/apps/files/lib/BackgroundJob/CleanupFileLocks.php similarity index 100% rename from apps/files/lib/backgroundjob/cleanupfilelocks.php rename to apps/files/lib/BackgroundJob/CleanupFileLocks.php diff --git a/apps/files/lib/backgroundjob/deleteorphaneditems.php b/apps/files/lib/BackgroundJob/DeleteOrphanedItems.php similarity index 100% rename from apps/files/lib/backgroundjob/deleteorphaneditems.php rename to apps/files/lib/BackgroundJob/DeleteOrphanedItems.php diff --git a/apps/files/lib/backgroundjob/scanfiles.php b/apps/files/lib/BackgroundJob/ScanFiles.php similarity index 100% rename from apps/files/lib/backgroundjob/scanfiles.php rename to apps/files/lib/BackgroundJob/ScanFiles.php diff --git a/apps/files/lib/capabilities.php b/apps/files/lib/Capabilities.php similarity index 100% rename from apps/files/lib/capabilities.php rename to apps/files/lib/Capabilities.php diff --git a/apps/files/command/deleteorphanedfiles.php b/apps/files/lib/Command/DeleteOrphanedFiles.php similarity index 100% rename from apps/files/command/deleteorphanedfiles.php rename to apps/files/lib/Command/DeleteOrphanedFiles.php diff --git a/apps/files/command/scan.php b/apps/files/lib/Command/Scan.php similarity index 100% rename from apps/files/command/scan.php rename to apps/files/lib/Command/Scan.php diff --git a/apps/files/command/transferownership.php b/apps/files/lib/Command/TransferOwnership.php similarity index 100% rename from apps/files/command/transferownership.php rename to apps/files/lib/Command/TransferOwnership.php diff --git a/apps/files/controller/apicontroller.php b/apps/files/lib/Controller/ApiController.php similarity index 100% rename from apps/files/controller/apicontroller.php rename to apps/files/lib/Controller/ApiController.php diff --git a/apps/files/controller/viewcontroller.php b/apps/files/lib/Controller/ViewController.php similarity index 100% rename from apps/files/controller/viewcontroller.php rename to apps/files/lib/Controller/ViewController.php diff --git a/apps/files/lib/helper.php b/apps/files/lib/Helper.php similarity index 100% rename from apps/files/lib/helper.php rename to apps/files/lib/Helper.php diff --git a/apps/files/service/tagservice.php b/apps/files/lib/Service/TagService.php similarity index 100% rename from apps/files/service/tagservice.php rename to apps/files/lib/Service/TagService.php diff --git a/apps/files/tests/activitytest.php b/apps/files/tests/ActivityTest.php similarity index 100% rename from apps/files/tests/activitytest.php rename to apps/files/tests/ActivityTest.php diff --git a/apps/files/tests/backgroundjob/DeleteOrphanedItemsJobTest.php b/apps/files/tests/BackgroundJob/DeleteOrphanedItemsJobTest.php similarity index 100% rename from apps/files/tests/backgroundjob/DeleteOrphanedItemsJobTest.php rename to apps/files/tests/BackgroundJob/DeleteOrphanedItemsJobTest.php diff --git a/apps/files/tests/backgroundjob/ScanFilesTest.php b/apps/files/tests/BackgroundJob/ScanFilesTest.php similarity index 100% rename from apps/files/tests/backgroundjob/ScanFilesTest.php rename to apps/files/tests/BackgroundJob/ScanFilesTest.php diff --git a/apps/files/tests/command/deleteorphanedfilestest.php b/apps/files/tests/Command/DeleteOrphanedFilesTest.php similarity index 100% rename from apps/files/tests/command/deleteorphanedfilestest.php rename to apps/files/tests/Command/DeleteOrphanedFilesTest.php diff --git a/apps/files/tests/controller/apicontrollertest.php b/apps/files/tests/Controller/ApiControllerTest.php similarity index 100% rename from apps/files/tests/controller/apicontrollertest.php rename to apps/files/tests/Controller/ApiControllerTest.php diff --git a/apps/files/tests/controller/ViewControllerTest.php b/apps/files/tests/Controller/ViewControllerTest.php similarity index 99% rename from apps/files/tests/controller/ViewControllerTest.php rename to apps/files/tests/Controller/ViewControllerTest.php index 4e4e88043e4..affcdb53a4b 100644 --- a/apps/files/tests/controller/ViewControllerTest.php +++ b/apps/files/tests/Controller/ViewControllerTest.php @@ -26,6 +26,7 @@ namespace OCA\Files\Tests\Controller; use OCA\Files\Controller\ViewController; use OCP\AppFramework\Http; +use OCP\IUser; use OCP\Template; use Test\TestCase; use OCP\IRequest; diff --git a/apps/files/tests/helper.php b/apps/files/tests/HelperTest.php similarity index 96% rename from apps/files/tests/helper.php rename to apps/files/tests/HelperTest.php index 654ec8332ed..d2d52b4f8a3 100644 --- a/apps/files/tests/helper.php +++ b/apps/files/tests/HelperTest.php @@ -23,12 +23,12 @@ * */ -use OCA\Files; +use OCA\Files\Tests; /** - * Class Test_Files_Helper + * Class Helper */ -class Test_Files_Helper extends \Test\TestCase { +class HelperTest extends \Test\TestCase { private function makeFileInfo($name, $size, $mtime, $isDir = false) { return new \OC\Files\FileInfo( diff --git a/apps/files/tests/service/tagservice.php b/apps/files/tests/Service/TagServiceTest.php similarity index 91% rename from apps/files/tests/service/tagservice.php rename to apps/files/tests/Service/TagServiceTest.php index 5fcf64b1352..3f210b500ff 100644 --- a/apps/files/tests/service/tagservice.php +++ b/apps/files/tests/Service/TagServiceTest.php @@ -20,9 +20,9 @@ * along with this program. If not, see * */ -namespace OCA\Files; +namespace OCA\Files\Tests\Service; -use \OCA\Files\Service\TagService; +use OCA\Files\Service\TagService; /** * Class TagServiceTest @@ -55,13 +55,11 @@ class TagServiceTest extends \Test\TestCase { protected function setUp() { parent::setUp(); - $this->user = $this->getUniqueId('user'); + $this->user = $this->getUniqueID('user'); \OC::$server->getUserManager()->createUser($this->user, 'test'); \OC_User::setUserId($this->user); \OC_Util::setupFS($this->user); - /** - * @var \OCP\IUser - */ + /** @var \OCP\IUser */ $user = new \OC\User\User($this->user, null); /** * @var \OCP\IUserSession @@ -105,12 +103,12 @@ class TagServiceTest extends \Test\TestCase { $this->assertEquals(array($fileId), $this->tagger->getIdsForTag($tag2)); // remove tag - $result = $this->tagService->updateFileTags('subdir/test.txt', array($tag2)); + $this->tagService->updateFileTags('subdir/test.txt', array($tag2)); $this->assertEquals(array(), $this->tagger->getIdsForTag($tag1)); $this->assertEquals(array($fileId), $this->tagger->getIdsForTag($tag2)); // clear tags - $result = $this->tagService->updateFileTags('subdir/test.txt', array()); + $this->tagService->updateFileTags('subdir/test.txt', array()); $this->assertEquals(array(), $this->tagger->getIdsForTag($tag1)); $this->assertEquals(array(), $this->tagger->getIdsForTag($tag2));