diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2013-12-19 14:09:59 +0100 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2013-12-19 14:09:59 +0100 |
commit | 28d28d8c9eb5ed9f184b572cfd16994c024e4227 (patch) | |
tree | 18899de14c93e01a64d28823577836d69038256a /tests/unit/controller | |
parent | 11e170fc19b6dd64e77a7b7b2d53ab6d17018aed (diff) |
add serverside infrastructure for setting and remembering compact view
Diffstat (limited to 'tests/unit/controller')
-rw-r--r-- | tests/unit/controller/UserSettingsControllerTest.php | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/unit/controller/UserSettingsControllerTest.php b/tests/unit/controller/UserSettingsControllerTest.php index 421d45566..cdbebcf1f 100644 --- a/tests/unit/controller/UserSettingsControllerTest.php +++ b/tests/unit/controller/UserSettingsControllerTest.php @@ -63,6 +63,14 @@ class UserSettingsControllerTest extends ControllerTestUtility { $this->assertUserSettingsControllerAnnotations('getLanguage'); } + public function testIsCompactViewAnnotations(){ + $this->assertUserSettingsControllerAnnotations('isCompactView'); + } + + public function testSetCompactViewAnnotations(){ + $this->assertUserSettingsControllerAnnotations('setCompactView'); + } + public function testFoldersAnnotations(){ $this->assertUserSettingsControllerAnnotations('read'); @@ -132,4 +140,47 @@ class UserSettingsControllerTest extends ControllerTestUtility { } + public function testIsCompactView() { + $result = array( + 'compact' => true + ); + $this->api->expects($this->once()) + ->method('getUserValue') + ->with($this->equalTo('compact')) + ->will($this->returnValue('1')); + + $response = $this->controller->isCompactView(); + $this->assertEquals($result, $response->getParams()); + $this->assertTrue($response instanceof JSONResponse); + } + + + public function testUnsetCompactView(){ + $request = new Request(array('post' => array( + 'compact' => false + ))); + $this->controller = new UserSettingsController($this->api, $request); + + $this->api->expects($this->once()) + ->method('setUserValue') + ->with($this->equalTo('compact'), + $this->equalTo(false)); + $response = $this->controller->setCompactView(); + $this->assertTrue($response instanceof JSONResponse); + } + + public function testSetCompactView(){ + $request = new Request(array('post' => array( + 'compact' => true + ))); + $this->controller = new UserSettingsController($this->api, $request); + + $this->api->expects($this->once()) + ->method('setUserValue') + ->with($this->equalTo('compact'), + $this->equalTo(true)); + $response = $this->controller->setCompactView(); + $this->assertTrue($response instanceof JSONResponse); + } + }
\ No newline at end of file |