You are here

public function AcquiaLiftTest::testPingTest in Acquia Lift Connector 7.2

Same name and namespace in other branches
  1. 7 tests/AcquiaLiftAPI.test \AcquiaLiftTest::testPingTest()

Test AcquiaLiftAPI->pingTest()

File

tests/AcquiaLiftAPI.test, line 130
Unit tests for Acquia Lift module.

Class

AcquiaLiftTest
@file Unit tests for Acquia Lift module.

Code

public function testPingTest() {
  $lift_api = $this
    ->getAcquiaLiftAPI();
  $ping_test = $lift_api
    ->ping();
  $this
    ->assertTrue($ping_test);
  $logged_requests = DummyAcquiaLiftHttpClient::getLoggedRequests();
  $this
    ->assertAPIRequestURI("{$lift_api->getApiUrl()}/ping?client_id={$lift_api->getPublicKey()}", $logged_requests[0]['uri']);
  DummyAcquiaLiftHttpClient::clearLoggedRequests();

  // Now test with a broken connection.
  $lift_api = $this
    ->getAcquiaLiftAPI(TRUE);
  $ping_test = $lift_api
    ->ping();
  $this
    ->assertFALSE($ping_test);
  $logged_requests = DummyAcquiaLiftHttpClient::getLoggedRequests();
  $this
    ->assertAPIRequestURI("{$lift_api->getApiUrl()}/ping?client_id={$lift_api->getPublicKey()}", $logged_requests[0]['uri']);
  DummyAcquiaLiftHttpClient::clearLoggedRequests();
}