diff options
Diffstat (limited to 'apps/files/tests/Controller/ViewControllerTest.php')
-rw-r--r-- | apps/files/tests/Controller/ViewControllerTest.php | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/apps/files/tests/Controller/ViewControllerTest.php b/apps/files/tests/Controller/ViewControllerTest.php index 007335b948d..3d8c8164abb 100644 --- a/apps/files/tests/Controller/ViewControllerTest.php +++ b/apps/files/tests/Controller/ViewControllerTest.php @@ -27,6 +27,8 @@ namespace OCA\Files\Tests\Controller; use OCA\Files\Controller\ViewController; use OCP\AppFramework\Http; +use OCP\Files\File; +use OCP\Files\Folder; use OCP\Files\IRootFolder; use OCP\IUser; use OCP\Template; @@ -68,14 +70,14 @@ class ViewControllerTest extends TestCase { public function setUp() { parent::setUp(); - $this->request = $this->getMockBuilder('\OCP\IRequest')->getMock(); - $this->urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator')->getMock(); - $this->l10n = $this->getMockBuilder('\OCP\IL10N')->getMock(); - $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock(); + $this->request = $this->getMockBuilder(IRequest::class)->getMock(); + $this->urlGenerator = $this->getMockBuilder(IURLGenerator::class)->getMock(); + $this->l10n = $this->getMockBuilder(IL10N::class)->getMock(); + $this->config = $this->getMockBuilder(IConfig::class)->getMock(); $this->eventDispatcher = $this->getMockBuilder('\Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock(); - $this->userSession = $this->getMockBuilder('\OCP\IUserSession')->getMock(); + $this->userSession = $this->getMockBuilder(IUserSession::class)->getMock(); $this->appManager = $this->getMockBuilder('\OCP\App\IAppManager')->getMock(); - $this->user = $this->getMockBuilder('\OCP\IUser')->getMock(); + $this->user = $this->getMockBuilder(IUser::class)->getMock(); $this->user->expects($this->any()) ->method('getUID') ->will($this->returnValue('testuser1')); @@ -281,12 +283,12 @@ class ViewControllerTest extends TestCase { } public function testShowFileRouteWithFolder() { - $node = $this->getMockBuilder('\OCP\Files\Folder')->getMock(); + $node = $this->getMockBuilder(Folder::class)->getMock(); $node->expects($this->once()) ->method('getPath') ->will($this->returnValue('/testuser1/files/test/sub')); - $baseFolder = $this->getMockBuilder('\OCP\Files\Folder')->getMock(); + $baseFolder = $this->getMockBuilder(Folder::class)->getMock(); $this->rootFolder->expects($this->once()) ->method('getUserFolder') @@ -313,19 +315,19 @@ class ViewControllerTest extends TestCase { } public function testShowFileRouteWithFile() { - $parentNode = $this->getMockBuilder('\OCP\Files\Folder')->getMock(); + $parentNode = $this->getMockBuilder(Folder::class)->getMock(); $parentNode->expects($this->once()) ->method('getPath') ->will($this->returnValue('testuser1/files/test')); - $baseFolder = $this->getMockBuilder('\OCP\Files\Folder')->getMock(); + $baseFolder = $this->getMockBuilder(Folder::class)->getMock(); $this->rootFolder->expects($this->once()) ->method('getUserFolder') ->with('testuser1') ->will($this->returnValue($baseFolder)); - $node = $this->getMockBuilder('\OCP\Files\File')->getMock(); + $node = $this->getMockBuilder(File::class)->getMock(); $node->expects($this->once()) ->method('getParent') ->will($this->returnValue($parentNode)); @@ -353,7 +355,7 @@ class ViewControllerTest extends TestCase { } public function testShowFileRouteWithInvalidFileId() { - $baseFolder = $this->getMockBuilder('\OCP\Files\Folder')->getMock(); + $baseFolder = $this->getMockBuilder(Folder::class)->getMock(); $this->rootFolder->expects($this->once()) ->method('getUserFolder') ->with('testuser1') @@ -380,13 +382,13 @@ class ViewControllerTest extends TestCase { ->with('files_trashbin') ->will($this->returnValue(true)); - $parentNode = $this->getMockBuilder('\OCP\Files\Folder')->getMock(); + $parentNode = $this->getMockBuilder(Folder::class)->getMock(); $parentNode->expects($this->once()) ->method('getPath') ->will($this->returnValue('testuser1/files_trashbin/files/test.d1462861890/sub')); - $baseFolderFiles = $this->getMockBuilder('\OCP\Files\Folder')->getMock(); - $baseFolderTrash = $this->getMockBuilder('\OCP\Files\Folder')->getMock(); + $baseFolderFiles = $this->getMockBuilder(Folder::class)->getMock(); + $baseFolderTrash = $this->getMockBuilder(Folder::class)->getMock(); $this->rootFolder->expects($this->at(0)) ->method('getUserFolder') @@ -402,7 +404,7 @@ class ViewControllerTest extends TestCase { ->with(123) ->will($this->returnValue([])); - $node = $this->getMockBuilder('\OCP\Files\File')->getMock(); + $node = $this->getMockBuilder(File::class)->getMock(); $node->expects($this->once()) ->method('getParent') ->will($this->returnValue($parentNode)); |