You are here

public function AcquiaSPITestCase::testAcquiaSpiUpdateResponse in Acquia Connector 7.3

Same name and namespace in other branches
  1. 7.2 acquia_spi/tests/acquia_spi.test \AcquiaSPITestCase::testAcquiaSPIUpdateResponse()

Needs comment.

File

acquia_spi/tests/acquia_spi.test, line 332

Class

AcquiaSPITestCase
Tests the functionality of the Acquia SPI module.

Code

public function testAcquiaSpiUpdateResponse() {
  $def_timestamp = variable_get('acquia_spi_def_timestamp', 0);
  $this
    ->assertEqual($def_timestamp, 0, 'SPI definition has not been called before');
  $def_vars = variable_get('acquia_spi_def_vars', array());
  $this
    ->assertTrue(empty($def_vars), 'SPI definition variables is empty');
  $waived_vars = variable_get('acquia_spi_def_waived_vars', array());
  $this
    ->assertTrue(empty($waived_vars), 'SPI definition waived variables is empty');
  $update_res = acquia_spi_update_definition();
  $this
    ->assertTrue($update_res, 'Update definition call returned true');
  $def_timestamp = variable_get('acquia_spi_def_timestamp', 0);
  $this
    ->assertNotEqual($def_timestamp, 0, 'SPI definition timestamp set');
  $def_vars = variable_get('acquia_spi_def_vars', array());
  $this
    ->assertTrue(!empty($def_vars), 'SPI definition variable set');
  variable_set('acquia_spi_def_waived_vars', array(
    'user_admin_role',
  ));

  // Test that new variables are in SPI data.
  $spi_data = acquia_spi_get();
  $vars = drupal_json_decode($spi_data['system_vars']);
  $this
    ->assertTrue(!empty($vars['file_temporary_path']), 'New variables included in SPI data');
  $this
    ->assertTrue(!isset($vars['user_admin_role']), 'user_admin_role not included in SPI data');
}