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