diff options
Diffstat (limited to 'tests/Unit/Controller/PageControllerTest.php')
-rw-r--r-- | tests/Unit/Controller/PageControllerTest.php | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/Unit/Controller/PageControllerTest.php b/tests/Unit/Controller/PageControllerTest.php index 2f259b316..5f62bfe9f 100644 --- a/tests/Unit/Controller/PageControllerTest.php +++ b/tests/Unit/Controller/PageControllerTest.php @@ -16,6 +16,7 @@ namespace OCA\News\Tests\Unit\Controller; use OC\L10N\L10N; use OCA\News\Controller\PageController; use \OCA\News\Db\FeedType; +use OCA\News\Explore\Exceptions\RecommendedSiteNotFoundException; use OCA\News\Explore\RecommendedSites; use OCA\News\Service\StatusService; use OCP\IConfig; @@ -26,7 +27,6 @@ use OCP\IUser; use OCP\IUserSession; use PHPUnit\Framework\TestCase; - class PageControllerTest extends TestCase { @@ -278,4 +278,24 @@ class PageControllerTest extends TestCase } + public function testExploreError() + { + $this->settings->expects($this->exactly(2)) + ->method('setUserValue') + ->withConsecutive( + ['becka', 'news', 'lastViewedFeedId', 0], + ['becka', 'news', 'lastViewedFeedType', FeedType::EXPLORE] + ); + + $this->recommended->expects($this->once()) + ->method('forLanguage') + ->with('nl') + ->will($this->throwException(new RecommendedSiteNotFoundException('error'))); + + $out = $this->controller->explore('nl'); + + $this->assertEquals(404, $out->getStatus()); + + } + } |