From 434ac7993e36e95c6c9f29fccc4a4f3b1a08ff70 Mon Sep 17 00:00:00 2001 From: Piotr Mrowczynski Date: Wed, 28 Nov 2018 21:38:44 +0100 Subject: [PATCH] Refactor paths and fix travis --- .travis.yml | 5 +++- appinfo/app.php | 5 +--- .../Application.php} | 0 lib/{appconfig.php => Appconfig.php} | 0 .../DocumentController.php} | 18 +++----------- .../SettingsController.php} | 0 lib/{db.php => DB.php} | 0 lib/{db/storage.php => Db/Storage.php} | 0 lib/{db/wopi.php => Db/Wopi.php} | 0 lib/{filter.php => Filter.php} | 0 lib/{helper.php => Helper.php} | 0 lib/{hookhandler.php => HookHandler.php} | 0 .../DownloadResponse.php} | 2 +- lib/Http/ResponseException.php | 24 +++++++++++++++++++ lib/{storage.php => Storage.php} | 0 phpunit.xml | 2 +- .../ApplicationTest.php} | 4 ++-- .../DocumentControllerTest.php} | 8 +++---- 18 files changed, 40 insertions(+), 28 deletions(-) rename lib/{appinfo/application.php => AppInfo/Application.php} (100%) rename lib/{appconfig.php => Appconfig.php} (100%) rename lib/{controller/documentcontroller.php => Controller/DocumentController.php} (99%) rename lib/{controller/settingscontroller.php => Controller/SettingsController.php} (100%) rename lib/{db.php => DB.php} (100%) rename lib/{db/storage.php => Db/Storage.php} (100%) rename lib/{db/wopi.php => Db/Wopi.php} (100%) rename lib/{filter.php => Filter.php} (100%) rename lib/{helper.php => Helper.php} (100%) rename lib/{hookhandler.php => HookHandler.php} (100%) rename lib/{downloadresponse.php => Http/DownloadResponse.php} (99%) create mode 100644 lib/Http/ResponseException.php rename lib/{storage.php => Storage.php} (100%) rename tests/unit/{appinfo/applicationtest.php => AppInfo/ApplicationTest.php} (98%) rename tests/unit/{controller/documentcontrollertest.php => Controller/DocumentControllerTest.php} (89%) diff --git a/.travis.yml b/.travis.yml index 9bb70437f..226ff7ca9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ php: env: global: - CORE_BRANCH=master + - APP_NAME=richdocuments matrix: - DB=sqlite @@ -17,7 +18,9 @@ branches: sudo: true before_install: - wget https://raw.githubusercontent.com/owncloud/administration/master/travis-ci/before_install.sh - - bash ./before_install.sh richdocuments $CORE_BRANCH $DB + - bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB + - cd ../core + - php occ app:enable $APP_NAME script: # Test lint diff --git a/appinfo/app.php b/appinfo/app.php index faf43eaee..27b22cdf6 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -1,5 +1,4 @@ registerScripts(); \OCP\App::registerAdmin('richdocuments', 'admin'); - - diff --git a/lib/appinfo/application.php b/lib/AppInfo/Application.php similarity index 100% rename from lib/appinfo/application.php rename to lib/AppInfo/Application.php diff --git a/lib/appconfig.php b/lib/Appconfig.php similarity index 100% rename from lib/appconfig.php rename to lib/Appconfig.php diff --git a/lib/controller/documentcontroller.php b/lib/Controller/DocumentController.php similarity index 99% rename from lib/controller/documentcontroller.php rename to lib/Controller/DocumentController.php index ed0db266b..2c5afc7d6 100644 --- a/lib/controller/documentcontroller.php +++ b/lib/Controller/DocumentController.php @@ -13,7 +13,7 @@ use \OC\Files\View; use \OCP\AppFramework\Controller; -use OCP\Constants; +use \OCP\Constants; use \OCP\IRequest; use \OCP\IConfig; use \OCP\IL10N; @@ -28,20 +28,8 @@ use \OCA\Richdocuments\Db; use \OCA\Richdocuments\Helper; use \OCA\Richdocuments\Storage; -use \OCA\Richdocuments\DownloadResponse; - -class ResponseException extends \Exception { - private $hint; - - public function __construct($description, $hint = '') { - parent::__construct($description); - $this->hint = $hint; - } - - public function getHint() { - return $this->hint; - } -} +use \OCA\Richdocuments\Http\DownloadResponse; +use \OCA\Richdocuments\Http\ResponseException; class DocumentController extends Controller { diff --git a/lib/controller/settingscontroller.php b/lib/Controller/SettingsController.php similarity index 100% rename from lib/controller/settingscontroller.php rename to lib/Controller/SettingsController.php diff --git a/lib/db.php b/lib/DB.php similarity index 100% rename from lib/db.php rename to lib/DB.php diff --git a/lib/db/storage.php b/lib/Db/Storage.php similarity index 100% rename from lib/db/storage.php rename to lib/Db/Storage.php diff --git a/lib/db/wopi.php b/lib/Db/Wopi.php similarity index 100% rename from lib/db/wopi.php rename to lib/Db/Wopi.php diff --git a/lib/filter.php b/lib/Filter.php similarity index 100% rename from lib/filter.php rename to lib/Filter.php diff --git a/lib/helper.php b/lib/Helper.php similarity index 100% rename from lib/helper.php rename to lib/Helper.php diff --git a/lib/hookhandler.php b/lib/HookHandler.php similarity index 100% rename from lib/hookhandler.php rename to lib/HookHandler.php diff --git a/lib/downloadresponse.php b/lib/Http/DownloadResponse.php similarity index 99% rename from lib/downloadresponse.php rename to lib/Http/DownloadResponse.php index 01115b306..bcb5468dc 100644 --- a/lib/downloadresponse.php +++ b/lib/Http/DownloadResponse.php @@ -9,7 +9,7 @@ * later. */ -namespace OCA\Richdocuments; +namespace OCA\Richdocuments\Http; use \OCP\AppFramework\Http; use \OCP\IRequest; diff --git a/lib/Http/ResponseException.php b/lib/Http/ResponseException.php new file mode 100644 index 000000000..93b14396a --- /dev/null +++ b/lib/Http/ResponseException.php @@ -0,0 +1,24 @@ + + * @copyright 2018 Piotr Mrowczynski + * + * This file is licensed under the Affero General Public License version 3 or + * later. + */ +namespace OCA\Richdocuments\Http; + +class ResponseException extends \Exception { + private $hint; + + public function __construct($description, $hint = '') { + parent::__construct($description); + $this->hint = $hint; + } + + public function getHint() { + return $this->hint; + } +} \ No newline at end of file diff --git a/lib/storage.php b/lib/Storage.php similarity index 100% rename from lib/storage.php rename to lib/Storage.php diff --git a/phpunit.xml b/phpunit.xml index 341361550..d7138a805 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -7,7 +7,7 @@ timeoutForLargeTests="900" > - ./tests/unit + ./tests/unit diff --git a/tests/unit/appinfo/applicationtest.php b/tests/unit/AppInfo/ApplicationTest.php similarity index 98% rename from tests/unit/appinfo/applicationtest.php rename to tests/unit/AppInfo/ApplicationTest.php index 14449cdd0..73498710c 100644 --- a/tests/unit/appinfo/applicationtest.php +++ b/tests/unit/AppInfo/ApplicationTest.php @@ -8,7 +8,7 @@ * This file is licensed under the Affero General Public License version 3 or * later. */ -namespace OCA\Richdocuments\Tests\unit; +namespace OCA\Richdocuments\Tests\AppInfo; use \OC_Hook; use OCA\Richdocuments\AppInfo\Application; @@ -18,7 +18,7 @@ * * @group DB * - * @package OCA\Richdocuments\Tests\Unit + * @package OCA\Richdocuments\Tests\AppInfo */ class ApplicationTest extends \Test\TestCase { diff --git a/tests/unit/controller/documentcontrollertest.php b/tests/unit/Controller/DocumentControllerTest.php similarity index 89% rename from tests/unit/controller/documentcontrollertest.php rename to tests/unit/Controller/DocumentControllerTest.php index 9d48e7d55..d201b31d4 100644 --- a/tests/unit/controller/documentcontrollertest.php +++ b/tests/unit/Controller/DocumentControllerTest.php @@ -8,7 +8,7 @@ * This file is licensed under the Affero General Public License version 3 or * later. */ -namespace OCA\Richdocuments\Tests\unit; +namespace OCA\Richdocuments\Tests\Controller; use \OCA\Richdocuments\Controller\DocumentController; use \OCP\IRequest; @@ -22,9 +22,9 @@ /** * Class DocumentControllerTest * - * @package OCA\Richdocuments\Tests\Unit + * @package OCA\Richdocuments\Tests\Controller */ -class DocumentControllerTest extends \PHPUnit_Framework_TestCase { +class DocumentControllerTest extends \Test\TestCase { /** * @var IRequest @@ -50,13 +50,13 @@ class DocumentControllerTest extends \PHPUnit_Framework_TestCase { * @var ILogger */ private $logger; - /** * @var Storage */ private $storage; public function setUp(){ + parent::setUp(); $this->request = $this->createMock(IRequest::class); $this->settings = $this->createMock(IConfig::class); $this->appConfig = $this->createMock(AppConfig::class);