diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2016-06-07 13:51:16 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2016-06-07 13:53:16 +0200 |
commit | 77db6d3dbd621453e368637d2146ed5ac96066cf (patch) | |
tree | 71cf2b34e14e1e691c6197da0633fd78312e32de /apps/files/tests | |
parent | bf917d7063ed9328a8d367343ac2a6574917ddfb (diff) | |
download | nextcloud-server-77db6d3dbd621453e368637d2146ed5ac96066cf.tar.gz nextcloud-server-77db6d3dbd621453e368637d2146ed5ac96066cf.zip |
Improve the UX for "not found" perma links
Diffstat (limited to 'apps/files/tests')
-rw-r--r-- | apps/files/tests/Controller/ViewControllerTest.php | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/apps/files/tests/Controller/ViewControllerTest.php b/apps/files/tests/Controller/ViewControllerTest.php index 049f44fc0af..45495ac9d0c 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\Files\NotFoundException; use OCP\IUser; use OCP\Template; use Test\TestCase; @@ -259,7 +260,8 @@ class ViewControllerTest extends TestCase { 'isPublic' => false, 'defaultFileSorting' => 'name', 'defaultFileSortingDirection' => 'asc', - 'showHiddenFiles' => false, + 'showHiddenFiles' => 0, + 'fileNotFound' => 0, 'mailNotificationEnabled' => 'no', 'mailPublicNotificationEnabled' => 'no', 'allowShareWithLink' => 'yes', @@ -410,11 +412,14 @@ class ViewControllerTest extends TestCase { ->with(123) ->will($this->returnValue([])); - $expected = new Http\NotFoundResponse(); if ($useShowFile) { - $this->assertEquals($expected, $this->viewController->showFile(123)); + $this->expectException('OCP\Files\NotFoundException'); + $this->viewController->showFile(123); } else { - $this->assertEquals($expected, $this->viewController->index('/whatever', '', '123')); + $response = $this->viewController->index('MyDir', 'MyView', '123'); + $this->assertInstanceOf('OCP\AppFramework\Http\TemplateResponse', $response); + $params = $response->getParams(); + $this->assertEquals(1, $params['fileNotFound']); } } |