@@ 99-112 (lines=14) @@ | ||
96 | $this->assertEquals($expectedResponse, $response); |
|
97 | } |
|
98 | ||
99 | public function testShow() { |
|
100 | $this->accountService->expects($this->once()) |
|
101 | ->method('find') |
|
102 | ->with($this->equalTo($this->userId), $this->equalTo($this->accountId)) |
|
103 | ->will($this->returnValue($this->account)); |
|
104 | $this->account->expects($this->once()) |
|
105 | ->method('getConfiguration') |
|
106 | ->will($this->returnValue('conf')); |
|
107 | ||
108 | $response = $this->controller->show($this->accountId); |
|
109 | ||
110 | $expectedResponse = new JSONResponse('conf'); |
|
111 | $this->assertEquals($expectedResponse, $response); |
|
112 | } |
|
113 | ||
114 | public function testShowDoesNotExist() { |
|
115 | $this->accountService->expects($this->once()) |
|
@@ 114-128 (lines=15) @@ | ||
111 | $this->assertEquals($expectedResponse, $response); |
|
112 | } |
|
113 | ||
114 | public function testShowDoesNotExist() { |
|
115 | $this->accountService->expects($this->once()) |
|
116 | ->method('find') |
|
117 | ->with($this->equalTo($this->userId), $this->equalTo($this->accountId)) |
|
118 | ->will($this->returnValue($this->account)); |
|
119 | $this->account->expects($this->once()) |
|
120 | ->method('getConfiguration') |
|
121 | ->will($this->throwException(new OCP\AppFramework\Db\DoesNotExistException('test123'))); |
|
122 | ||
123 | $response = $this->controller->show($this->accountId); |
|
124 | ||
125 | $expectedResponse = new JSONResponse([]); |
|
126 | $expectedResponse->setStatus(404); |
|
127 | $this->assertEquals($expectedResponse, $response); |
|
128 | } |
|
129 | ||
130 | public function testDestroy() { |
|
131 | $this->accountService->expects($this->once()) |