You are here

protected function XAutoloadWebTestCase::xautoloadTestWithCacheTypes in X Autoload 7.4

Same name and namespace in other branches
  1. 7.5 lib/Drupal/xautoload/Tests/XAutoloadWebTestCase.php \Drupal\xautoload\Tests\XAutoloadWebTestCase::xautoloadTestWithCacheTypes()

Parameters

array $cache_types: The autoloader modes that are enabled, e.g. array('apc' => 'apc', 'xcache' => 'xcache')

bool $cache_lazy: Whether the "lazy" mode is enabled.

2 calls to XAutoloadWebTestCase::xautoloadTestWithCacheTypes()
XAutoloadWebTestCase::testApcCache in lib/Drupal/xautoload/Tests/XAutoloadWebTestCase.php
XAutoloadWebTestCase::testNoCache in lib/Drupal/xautoload/Tests/XAutoloadWebTestCase.php

File

lib/Drupal/xautoload/Tests/XAutoloadWebTestCase.php, line 51

Class

XAutoloadWebTestCase

Namespace

Drupal\xautoload\Tests

Code

protected function xautoloadTestWithCacheTypes($cache_types, $cache_lazy) {
  variable_set('xautoload_cache_types', $cache_types);
  $this
    ->pass("Set cache types: " . var_export($cache_types, TRUE));
  variable_set('xautoload_cache_lazy', $cache_lazy);
  $this
    ->pass("Set cache lazy mode: " . var_export($cache_lazy, TRUE));

  // Enable xautoload.
  module_enable(array(
    'xautoload',
  ), FALSE);

  // At this time the xautoload_cache_mode setting is not in effect yet,
  // so we have to clear old cached values from APC cache.
  xautoload()->cacheManager
    ->renewCachePrefix();
  module_enable(array(
    'xautoload_test_1',
    'xautoload_test_2',
    'xautoload_test_3',
  ), FALSE);
  menu_rebuild();
  foreach (array(
    'xautoload_test_1' => array(
      'Drupal\\xautoload_test_1\\ExampleClass',
    ),
    'xautoload_test_2' => array(
      'xautoload_test_2_ExampleClass',
    ),
    'xautoload_test_3' => array(
      'Drupal\\xautoload_test_3\\ExampleClass',
    ),
  ) as $module => $classes) {
    $classes_on_include = in_array($module, array(
      'xautoload_test_2',
      'xautoload_test_3',
    ));
    $this
      ->xautoloadModuleEnabled($module, $classes, $classes_on_include);
    $this
      ->xautoloadModuleCheckJson($module, $cache_types, $cache_lazy, $classes);
  }
}