diff options
Diffstat (limited to 'tests/unit/controller/UserSettingsControllerTest.php')
-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 |