You are here

public function AcquiaSPITestCase::testFlushCaches in Acquia Connector 7.3

Test Cache clear detected.

File

acquia_spi/tests/acquia_spi.test, line 486

Class

AcquiaSPITestCase
Tests the functionality of the Acquia SPI module.

Code

public function testFlushCaches() {
  $server = array(
    'AH_SITE_NAME' => 'site_name',
    'AH_SITE_ENVIRONMENT' => 'dev',
  );
  variable_set('acquia_agent_server_superglobal', $server);
  drupal_flush_all_caches();
  $result = db_query('SELECT w.wid FROM {watchdog} w WHERE w.message = :string', array(
    ':string' => 'Flushed cache data on %site',
  ))
    ->fetchAllAssoc('wid');
  $this
    ->assertFalse(count($result), "Cache clear detection is not triggered for dev environment");
  $server['AH_SITE_ENVIRONMENT'] = 'prod';
  variable_set('acquia_agent_server_superglobal', $server);
  drupal_flush_all_caches();
  $result = db_query('SELECT w.wid FROM {watchdog} w WHERE w.message = :string', array(
    ':string' => 'Flushed cache data on %site',
  ))
    ->fetchAllAssoc('wid');
  $this
    ->assertTrue(count($result), "Cache clear detected for prod environment");
  variable_del('acquia_agent_server_superglobal');
}