diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-22 23:04:44 +0100 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-22 23:04:44 +0100 |
commit | 46cbbb1a1e89f5302e1a33f81b8526e039894c60 (patch) | |
tree | 48401178b23912438e39ca64e3973078676d192e /tests | |
parent | 80644c69e096e272184b729071d8a41a3d31b79c (diff) |
finished usersettingscontroller
Diffstat (limited to 'tests')
-rw-r--r-- | tests/controller/UserSettingsControllerTest.php | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/controller/UserSettingsControllerTest.php b/tests/controller/UserSettingsControllerTest.php index b434c5ffa..4b561a3e4 100644 --- a/tests/controller/UserSettingsControllerTest.php +++ b/tests/controller/UserSettingsControllerTest.php @@ -49,6 +49,7 @@ class UserSettingsControllerTest extends ControllerTestUtility { $this->api = $this->getAPIMock(); $this->request = new Request(); $this->controller = new UserSettingsController($this->api, $this->request); + $this->user = 'becka'; } @@ -73,6 +74,51 @@ class UserSettingsControllerTest extends ControllerTestUtility { } + public function testShow(){ + $this->api->expects($this->once()) + ->method('getUserId') + ->will($this->returnValue($this->user)); + $this->api->expects($this->once()) + ->method('setUserValue') + ->with($this->equalTo($this->user), + $this->equalTo('showAll'), + $this->equalTo(true)); + $result = $this->controller->show(); + } + + + public function testHide(){ + $this->api->expects($this->once()) + ->method('getUserId') + ->will($this->returnValue($this->user)); + $this->api->expects($this->once()) + ->method('setUserValue') + ->with($this->equalTo($this->user), + $this->equalTo('showAll'), + $this->equalTo(false)); + $result = $this->controller->hide(); + } + + + public function testRead(){ + $result = array( + 'showAll' => true + ); + $this->api->expects($this->once()) + ->method('getUserId') + ->will($this->returnValue($this->user)); + $this->api->expects($this->once()) + ->method('getUserValue') + ->with($this->equalTo($this->user), + $this->equalTo('showAll')) + ->will($this->returnValue('true')); + + $response = $this->controller->read(); + $this->assertEquals($result, $response->getParams()); + $this->assertTrue($response instanceof JSONResponse); + } + + }
\ No newline at end of file |