You are here

public function DrupalBootHookTest::providerModuleEnable in X Autoload 7.5

Return value

array[]

Overrides AbstractDrupalBootTest::providerModuleEnable

File

tests/src/DrupalBootTest/DrupalBootHookTest.php, line 30

Class

DrupalBootHookTest
Tests modules that use hook_xautoload() and hook_libraries_info()

Namespace

Drupal\xautoload\Tests\DrupalBootTest

Code

public function providerModuleEnable() {
  $hookXautoloadEarly = FALSE;
  $hookXautoloadLate = TRUE;
  $initialModuleVariations = array(
    array(
      'system' => TRUE,
    ),
  );
  foreach (array(
    'xautoload' => array(
      FALSE,
      TRUE,
    ),
    'libraries' => array(
      FALSE,
      TRUE,
    ),
    'testmod' => array(
      FALSE,
      NULL,
    ),
  ) as $module => $states) {
    $initialModuleVariations = $this
      ->providerArrayKeyVariations($initialModuleVariations, $module, $states);
  }
  $variations = array();
  foreach ($initialModuleVariations as $initialModuleVariation) {
    $expectedCalls = array();
    if ($hookXautoloadEarly) {
      $expectedCalls[] = array(
        'function' => 'testmod_xautoload',
        'args' => array(
          '(xautoload_InjectedAPI_hookXautoload)',
          dirname(dirname(__DIR__)) . '/fixtures/.modules/testmod',
        ),
      );
    }
    if (NULL === $initialModuleVariation['testmod']) {
      $expectedCalls[] = array(
        'function' => 'testmod_schema',
        'args' => array(),
      );
      $expectedCalls[] = array(
        'function' => 'testmod_install',
        'args' => array(),
      );
      $expectedCalls[] = array(
        'function' => 'testmod_watchdog',
        'args' => array(),
      );
    }
    $expectedCalls[] = array(
      'function' => 'testmod_enable',
      'args' => array(),
    );
    $expectedCalls[] = array(
      'function' => 'testmod_watchdog',
      'args' => array(),
    );
    if ($hookXautoloadLate) {
      $expectedCalls[] = array(
        'function' => 'testmod_xautoload',
        'args' => array(
          '(xautoload_InjectedAPI_hookXautoload)',
          dirname(dirname(__DIR__)) . '/fixtures/.modules/testmod',
        ),
      );
    }
    $expectedCalls[] = array(
      'function' => 'testmod_modules_enabled',
      'args' => array(
        '(array)',
      ),
    );
    $expectedCalls[] = array(
      'function' => 'testmod_libraries_info',
      'args' => array(),
    );
    $expectedCalls[] = array(
      'function' => '_testmod_libraries_testlib_xautoload',
      'args' => array(
        '(xautoload_InjectedAPI_hookXautoload)',
        dirname(dirname(__DIR__)) . '/fixtures/.libraries/testlib',
      ),
    );
    $variations[] = array(
      $initialModuleVariation,
      $expectedCalls,
    );
  }
  return $variations;
}