You are here

public function AcquiaLiftTest::testGetCallsForMonthToDate in Acquia Lift Connector 7

Test the testGetCallsForPreviousMonth() method.

File

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

Class

AcquiaLiftTest
@file Unit tests for Acquia Lift module.

Code

public function testGetCallsForMonthToDate() {
  $lift_api = $this
    ->getAcquiaLiftAPI();
  $timestamps = array(
    // Timestamp representing March 12th 2014
    1394652611 => array(
      'start' => '2014-03-01',
      'end' => '2014-03-12',
    ),
    // Timestamp representing January 2nd 2014
    1388695528 => array(
      'start' => '2014-01-01',
      'end' => '2014-01-02',
    ),
    // Timestamp representing December 31st 2013
    1388522626 => array(
      'start' => '2013-12-01',
      'end' => '2013-12-31',
    ),
  );
  foreach ($timestamps as $timestamp => $expected_dates) {
    $count = $lift_api
      ->getCallsForMonthToDate($timestamp);

    // Define the requests we expect to have been made to our dummy http
    // client for this operation.
    $requests = array(
      array(
        'type' => 'get',
        'uri' => "http://api.lift.acquia.com/{$this->liftOwnerCode}/-/report/system-usage/{$expected_dates['start']}/{$expected_dates['end']}?apikey={$this->liftAdminKey}",
        'headers' => array(
          'Accept' => 'application/json',
        ),
        'options' => array(),
        'body' => NULL,
      ),
    );

    // Confirm the expected requests were made.
    $this
      ->assertAPIRequests($requests);
  }
}