diff options
author | Julius Haertl <jus@bitgrid.net> | 2017-02-09 17:12:00 +0100 |
---|---|---|
committer | Julius Haertl <jus@bitgrid.net> | 2017-02-16 15:13:39 +0100 |
commit | b2cbe3530daa04451195865afc177bc6bde6c359 (patch) | |
tree | 35a9cd6e708f035c1b34bb6e79e691f5d070f5d3 /apps | |
parent | 88a0ef7d4a49403c0b803cd8716ae95688490b59 (diff) | |
download | nextcloud-server-b2cbe3530daa04451195865afc177bc6bde6c359.tar.gz nextcloud-server-b2cbe3530daa04451195865afc177bc6bde6c359.zip |
Use ::class in tests and correct import
Signed-off-by: Julius Haertl <jus@bitgrid.net>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/theming/lib/Controller/ThemingController.php | 4 | ||||
-rw-r--r-- | apps/theming/tests/Controller/ThemingControllerTest.php | 38 | ||||
-rw-r--r-- | apps/theming/tests/Migration/ThemingImages.php | 20 |
3 files changed, 34 insertions, 28 deletions
diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php index 19999d1362d..2aa79df2464 100644 --- a/apps/theming/lib/Controller/ThemingController.php +++ b/apps/theming/lib/Controller/ThemingController.php @@ -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 { diff --git a/apps/theming/tests/Controller/ThemingControllerTest.php b/apps/theming/tests/Controller/ThemingControllerTest.php index 97770e7ce62..0c47ac972b7 100644 --- a/apps/theming/tests/Controller/ThemingControllerTest.php +++ b/apps/theming/tests/Controller/ThemingControllerTest.php @@ -24,14 +24,18 @@ */ 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 diff --git a/apps/theming/tests/Migration/ThemingImages.php b/apps/theming/tests/Migration/ThemingImages.php index 60cb6117755..e5e3b1df5d3 100644 --- a/apps/theming/tests/Migration/ThemingImages.php +++ b/apps/theming/tests/Migration/ThemingImages.php @@ -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); |