]> source.dussan.org Git - nextcloud-server.git/commitdiff
Use ::class in tests and correct import
authorJulius Haertl <jus@bitgrid.net>
Thu, 9 Feb 2017 16:12:00 +0000 (17:12 +0100)
committerJulius Haertl <jus@bitgrid.net>
Thu, 16 Feb 2017 14:13:39 +0000 (15:13 +0100)
Signed-off-by: Julius Haertl <jus@bitgrid.net>
apps/theming/lib/Controller/ThemingController.php
apps/theming/tests/Controller/ThemingControllerTest.php
apps/theming/tests/Migration/ThemingImages.php

index 19999d1362d1605f8995ac99a5c19e9919d7844a..2aa79df2464c1763b681cd01907cd5854cb48abd 100644 (file)
@@ -31,9 +31,9 @@ use OCA\Theming\ThemingDefaults;
 use OCP\AppFramework\Controller;
 use OCP\AppFramework\Http;
 use OCP\AppFramework\Http\DataDownloadResponse;
+use OCP\AppFramework\Http\FileDisplayResponse;
 use OCP\AppFramework\Http\DataResponse;
 use OCP\AppFramework\Http\NotFoundResponse;
-use OCP\AppFramework\Http\FileDisplayResponse;
 use OCP\AppFramework\Utility\ITimeFactory;
 use OCP\Files\File;
 use OCP\Files\IAppData;
@@ -266,7 +266,7 @@ class ThemingController extends Controller {
         * @PublicPage
         * @NoCSRFRequired
         *
-        * @return Http\FileDisplayResponse|NotFoundResponse
+        * @return FileDisplayResponse|NotFoundResponse
         */
        public function getLogo() {
                try {
index 97770e7ce620261d133c426e16542118c6d8619e..0c47ac972b7812eb6c959efb4c8b0d4a485d2a58 100644 (file)
  */
 namespace OCA\Theming\Tests\Controller;
 
+use OC\L10N\L10N;
 use OCA\Theming\Controller\ThemingController;
 use OCA\Theming\Util;
 use OCP\App\IAppManager;
 use OCP\AppFramework\Http;
 use OCP\AppFramework\Http\DataResponse;
+use OCP\AppFramework\Utility\ITimeFactory;
 use OCP\Files\IAppData;
 use OCP\Files\IRootFolder;
 use OCP\Files\NotFoundException;
+use OCP\Files\SimpleFS\ISimpleFile;
+use OCP\Files\SimpleFS\ISimpleFolder;
 use OCP\IConfig;
 use OCP\IL10N;
 use OCP\IRequest;
@@ -64,22 +68,22 @@ class ThemingControllerTest extends TestCase {
        private $appData;
 
        public function setUp() {
-               $this->request = $this->getMockBuilder('OCP\IRequest')->getMock();
-               $this->config = $this->getMockBuilder('OCP\IConfig')->getMock();
-               $this->template = $this->getMockBuilder('OCA\Theming\ThemingDefaults')
+               $this->request = $this->getMockBuilder(IRequest::class)->getMock();
+               $this->config = $this->getMockBuilder(IConfig::class)->getMock();
+               $this->template = $this->getMockBuilder(ThemingDefaults::class)
                        ->disableOriginalConstructor()->getMock();
-               $this->timeFactory = $this->getMockBuilder('OCP\AppFramework\Utility\ITimeFactory')
+               $this->timeFactory = $this->getMockBuilder(ITimeFactory::class)
                        ->disableOriginalConstructor()
                        ->getMock();
-               $this->l10n = $this->getMockBuilder('OCP\IL10N')->getMock();
-               $this->rootFolder = $this->getMockBuilder('OCP\Files\IRootFolder')->getMock();
-               $this->appManager = $this->getMockBuilder('OCP\App\IAppManager')->getMock();
+               $this->l10n = $this->getMockBuilder(L10N::class)->getMock();
+               $this->rootFolder = $this->getMockBuilder(IRootFolder::class)->getMock();
+               $this->appManager = $this->getMockBuilder(IAppManager::class)->getMock();
                $this->util = new Util($this->config, $this->rootFolder, $this->appManager);
                $this->timeFactory->expects($this->any())
                        ->method('getTime')
                        ->willReturn(123);
                $this->tempManager = \OC::$server->getTempManager();
-               $this->appData = $this->getMockBuilder('OCP\Files\IAppData')->getMock();
+               $this->appData = $this->getMockBuilder(IAppData::class)->getMock();
 
                $this->themingController = new ThemingController(
                        'theming',
@@ -196,10 +200,10 @@ class ThemingControllerTest extends TestCase {
                        ->willReturn('Saved');
 
 
-               $file = $this->getMockBuilder('OCP\Files\SimpleFS\ISimpleFile')
+               $file = $this->getMockBuilder(ISimpleFile::class)
                        ->disableOriginalConstructor()
                        ->getMock();
-               $folder = $this->getMockBuilder('OCP\Files\SimpleFS\ISimpleFolder')
+               $folder = $this->getMockBuilder(ISimpleFolder::class)
                        ->disableOriginalConstructor()
                        ->getMock();
                $this->appData
@@ -251,10 +255,10 @@ class ThemingControllerTest extends TestCase {
                        ->with('Saved')
                        ->willReturn('Saved');
 
-               $file = $this->getMockBuilder('OCP\Files\SimpleFS\ISimpleFile')
+               $file = $this->getMockBuilder(ISimpleFile::class)
                        ->disableOriginalConstructor()
                        ->getMock();
-               $folder = $this->getMockBuilder('OCP\Files\SimpleFS\ISimpleFolder')
+               $folder = $this->getMockBuilder(ISimpleFolder::class)
                        ->disableOriginalConstructor()
                        ->getMock();
                $this->appData
@@ -305,7 +309,7 @@ class ThemingControllerTest extends TestCase {
                        ->with('Unsupported image type')
                        ->willReturn('Unsupported image type');
 
-               $folder = $this->getMockBuilder('OCP\Files\SimpleFS\ISimpleFolder')
+               $folder = $this->getMockBuilder(ISimpleFolder::class)
                        ->disableOriginalConstructor()
                        ->getMock();
                $this->appData
@@ -362,10 +366,10 @@ class ThemingControllerTest extends TestCase {
        }
 
        public function testGetLogo() {
-               $file = $this->getMockBuilder('OCP\Files\SimpleFS\ISimpleFile')
+               $file = $this->getMockBuilder(ISimpleFile::class)
                        ->disableOriginalConstructor()
                        ->getMock();
-               $folder = $this->getMockBuilder('OCP\Files\SimpleFS\ISimpleFolder')
+               $folder = $this->getMockBuilder(ISimpleFolder::class)
                        ->disableOriginalConstructor()
                        ->getMock();
                $this->appData
@@ -405,10 +409,10 @@ class ThemingControllerTest extends TestCase {
        }
 
        public function testGetLoginBackground() {
-               $file = $this->getMockBuilder('OCP\Files\SimpleFS\ISimpleFile')
+               $file = $this->getMockBuilder(ISimpleFile::class)
                        ->disableOriginalConstructor()
                        ->getMock();
-               $folder = $this->getMockBuilder('OCP\Files\SimpleFS\ISimpleFolder')
+               $folder = $this->getMockBuilder(ISimpleFolder::class)
                        ->disableOriginalConstructor()
                        ->getMock();
                $this->appData
index 60cb6117755456491c217986d33aa217100613cb..e5e3b1df5d3e83f9e2449ab781ad6d788baa4dd7 100644 (file)
@@ -23,7 +23,9 @@
 
 namespace OCA\Theming\Tests\Migration;
 
+use OCP\Files\File;
 use OCP\Files\NotFoundException;
+use OCP\Files\SimpleFS\ISimpleFile;
 use OCP\Files\SimpleFS\ISimpleFolder;
 use OCP\Migration\IOutput;
 use Test\TestCase;
@@ -45,11 +47,11 @@ class ThemingImagesTest extends TestCase {
 
        public function setUp() {
                parent::setUp();
-               $this->appData = $this->getMockBuilder('OCP\Files\IAppData')->getMock();
-               $this->rootFolder = $this->getMockBuilder('OCP\Files\IRootFolder')->getMock();
+               $this->appData = $this->getMockBuilder(IAppData::class)->getMock();
+               $this->rootFolder = $this->getMockBuilder(IRootFolder::class)->getMock();
                $this->repairStep = new ThemingImages($this->appData, $this->rootFolder);
-               $this->imageFolder = $this->getMockBuilder('OCP\Files\SimpleFS\ISimpleFolder')->getMock();
-               $this->output = $this->getMockBuilder('OCP\Migration\IOutput')->getMock();
+               $this->imageFolder = $this->getMockBuilder(ISimpleFolder::class)->getMock();
+               $this->output = $this->getMockBuilder(IOutput::class)->getMock();
        }
 
        public function testGetName() {
@@ -74,8 +76,8 @@ class ThemingImagesTest extends TestCase {
        }
 
        public function testRunLogo() {
-               $oldFile = $this->getMockBuilder('OCP\Files\File')->getMock();
-               $newFile = $this->getMockBuilder('OCP\Files\SimpleFS\ISimpleFile')->getMock();
+               $oldFile = $this->getMockBuilder(File::class)->getMock();
+               $newFile = $this->getMockBuilder(ISimpleFile::class)->getMock();
 
                $this->appData->expects($this->once())
                        ->method('newFolder')
@@ -105,9 +107,9 @@ class ThemingImagesTest extends TestCase {
        }
 
        public function testRunBackground() {
-               $oldFile = $this->getMockBuilder('OCP\Files\File')->getMock();
-               $newFile = $this->getMockBuilder('OCP\Files\SimpleFS\ISimpleFile')->getMock();
-
+               $oldFile = $this->getMockBuilder(File::class)->getMock();
+               $newFile = $this->getMockBuilder(ISimpleFile::class)->getMock();
+               
                $this->appData->expects($this->once())
                        ->method('newFolder')
                        ->willReturn($this->imageFolder);