From 62b6bd485009b5dbb85b50e634ea94aa177d8d42 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Wed, 19 Nov 2014 14:14:01 +0100 Subject: controller action for recommended sites --- tests/unit/controller/PageControllerTest.php | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'tests') 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 -- cgit v1.2.3