/**
  * @depends testCallsRequest
  */
 public function testThrowsCommunicationErrorOnServerError()
 {
     $this->setExpectedException('\\LaunchKey\\SDK\\Service\\Exception\\CommunicationError', 'error => messages');
     phake::when($this->client)->request(Phake::anyParameters())->thenReturn($this->wpError);
     $this->apiService->createWhiteLabelUser(null);
 }
 protected function setUp()
 {
     Phake::initAnnotations($this);
     Phake::when($this->wpError)->get_error_messages()->thenReturn(array('error', 'messages'));
     Phake::when($this->cryptService)->encryptRSA(Phake::anyParameters())->thenReturn($this->rsaEncrypted);
     Phake::when($this->cryptService)->sign(Phake::anyParameters())->thenReturn($this->signed);
     Phake::when($this->cache)->get(WordPressApiService::CACHE_KEY_PUBLIC_KEY)->thenReturn($this->publicKey);
     $that = $this;
     phake::when($this->client)->request(Phake::anyParameters())->thenReturnCallback(function () use($that) {
         return $that->response;
     });
     $this->apiService = new WordPressApiService($this->client, $this->cryptService, $this->cache, $this->publicKeyTTL, $this->appKey, $this->secretKey, $this->sslverify, $this->apiBaseUrl, $this->requestTimeout);
     $this->loggingApiService = new WordPressApiService($this->client, $this->cryptService, $this->cache, $this->publicKeyTTL, $this->appKey, $this->secretKey, $this->sslverify, $this->apiBaseUrl, $this->requestTimeout, $this->logger);
 }