|
@@ 118-131 (lines=14) @@
|
| 115 |
|
$this->assertEquals($expectedResponse, $response); |
| 116 |
|
} |
| 117 |
|
|
| 118 |
|
public function testShow() { |
| 119 |
|
$this->accountService->expects($this->once()) |
| 120 |
|
->method('find') |
| 121 |
|
->with($this->equalTo($this->userId), $this->equalTo($this->accountId)) |
| 122 |
|
->will($this->returnValue($this->account)); |
| 123 |
|
$this->account->expects($this->once()) |
| 124 |
|
->method('getConfiguration') |
| 125 |
|
->will($this->returnValue('conf')); |
| 126 |
|
|
| 127 |
|
$response = $this->controller->show($this->accountId); |
| 128 |
|
|
| 129 |
|
$expectedResponse = new JSONResponse('conf'); |
| 130 |
|
$this->assertEquals($expectedResponse, $response); |
| 131 |
|
} |
| 132 |
|
|
| 133 |
|
public function testShowDoesNotExist() { |
| 134 |
|
$this->accountService->expects($this->once()) |
|
@@ 133-147 (lines=15) @@
|
| 130 |
|
$this->assertEquals($expectedResponse, $response); |
| 131 |
|
} |
| 132 |
|
|
| 133 |
|
public function testShowDoesNotExist() { |
| 134 |
|
$this->accountService->expects($this->once()) |
| 135 |
|
->method('find') |
| 136 |
|
->with($this->equalTo($this->userId), $this->equalTo($this->accountId)) |
| 137 |
|
->will($this->returnValue($this->account)); |
| 138 |
|
$this->account->expects($this->once()) |
| 139 |
|
->method('getConfiguration') |
| 140 |
|
->will($this->throwException(new OCP\AppFramework\Db\DoesNotExistException('test123'))); |
| 141 |
|
|
| 142 |
|
$response = $this->controller->show($this->accountId); |
| 143 |
|
|
| 144 |
|
$expectedResponse = new JSONResponse([]); |
| 145 |
|
$expectedResponse->setStatus(404); |
| 146 |
|
$this->assertEquals($expectedResponse, $response); |
| 147 |
|
} |
| 148 |
|
|
| 149 |
|
public function testDestroy() { |
| 150 |
|
$this->accountService->expects($this->once()) |