| @@ 63-81 (lines=19) @@ | ||
| 60 | return $client; |
|
| 61 | } |
|
| 62 | ||
| 63 | private function newClientRepository($clientId, $client) |
|
| 64 | { |
|
| 65 | $this->mockGenerator->shuntParentClassCalls(); |
|
| 66 | $this->mockGenerator->orphanize('__construct'); |
|
| 67 | ||
| 68 | $clientRepository = new ClientRepository(); |
|
| 69 | ||
| 70 | $this->calling($clientRepository)->get = |
|
| 71 | function($id) use ($clientId, $client) { |
|
| 72 | if ($id == $clientId) { |
|
| 73 | return $client; |
|
| 74 | } |
|
| 75 | ||
| 76 | return null; |
|
| 77 | } |
|
| 78 | ; |
|
| 79 | ||
| 80 | return $clientRepository; |
|
| 81 | } |
|
| 82 | ||
| 83 | private function newConfigRepository($clientId, $indexId, $config) |
|
| 84 | { |
|
| @@ 83-101 (lines=19) @@ | ||
| 80 | return $clientRepository; |
|
| 81 | } |
|
| 82 | ||
| 83 | private function newConfigRepository($clientId, $indexId, $config) |
|
| 84 | { |
|
| 85 | $this->mockGenerator->shuntParentClassCalls(); |
|
| 86 | $this->mockGenerator->orphanize('__construct'); |
|
| 87 | ||
| 88 | $configRepository = new IndexConfigurationRepository(); |
|
| 89 | ||
| 90 | $this->calling($configRepository)->get = |
|
| 91 | function($clientIdParam, $indexIdParam) use ($clientId, $indexId, $config) { |
|
| 92 | if ($clientId == $clientIdParam && $indexId == $indexIdParam) { |
|
| 93 | return $config; |
|
| 94 | } |
|
| 95 | ||
| 96 | return null; |
|
| 97 | } |
|
| 98 | ; |
|
| 99 | ||
| 100 | return $configRepository; |
|
| 101 | } |
|
| 102 | ||
| 103 | public function testHandleThrowExceptionIfNoClient() |
|
| 104 | { |
|