diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-11-19 14:14:01 +0100 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-11-19 14:14:01 +0100 |
commit | 62b6bd485009b5dbb85b50e634ea94aa177d8d42 (patch) | |
tree | 089454ad9588ef97fa96b9199ed26aaedb19d12f /tests/unit/controller | |
parent | 322726c37f0cabad1a2021126d4d420bce914574 (diff) |
controller action for recommended sites
Diffstat (limited to 'tests/unit/controller')
-rw-r--r-- | tests/unit/controller/PageControllerTest.php | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/tests/unit/controller/PageControllerTest.php b/tests/unit/controller/PageControllerTest.php index 477be7ead..0326ef50b 100644 --- a/tests/unit/controller/PageControllerTest.php +++ b/tests/unit/controller/PageControllerTest.php @@ -26,6 +26,7 @@ class PageControllerTest extends \PHPUnit_Framework_TestCase { private $appConfig; private $configData; private $config; + private $recommended; /** * Gets run before each test @@ -67,9 +68,13 @@ class PageControllerTest extends \PHPUnit_Framework_TestCase { '\OCA\News\Config\Config') ->disableOriginalConstructor() ->getMock(); + $this->recommended = $this->getMockBuilder( + '\OCA\News\RecommendedSites\RecommendedSites') + ->disableOriginalConstructor() + ->getMock(); $this->controller = new PageController($this->appName, $this->request, $this->settings, $this->urlGenerator, $this->appConfig, - $this->config, $this->l10n, $this->user); + $this->config, $this->l10n, $this->recommended, $this->user); } @@ -224,4 +229,21 @@ class PageControllerTest extends \PHPUnit_Framework_TestCase { } + public function testRecommended(){ + $in = 'test'; + $this->l10n->expects($this->once()) + ->method('getLanguageCode') + ->will($this->returnValue('de_DE')); + + $this->recommended->expects($this->once()) + ->method('forLanguage') + ->with($this->equalTo('de_DE'), $this->equalTo('en')) + ->will($this->returnValue($in)); + + + $out = $this->controller->recommended(); + + $this->assertEquals($in, $out); + } + }
\ No newline at end of file |