You are here

public function TestSubContext::moduleHasDependencyAtKey in Drupal Commons 7.3

@Given :module has the :dependency dependency at position :key

File

tests/steps/commons_test.behat.inc, line 675
Provide Behat step-definitions for generic Commons tests.

Class

TestSubContext

Code

public function moduleHasDependencyAtKey($module, $dependency, $key) {
  if (!module_exists($module)) {
    throw new \Exception("{$module} is not enabled.");
  }
  if (!module_exists($dependency)) {
    throw new \Exception("{$dependency} is not enabled.");
  }
  $info = drupal_parse_info_file(drupal_get_path('module', $module) . '/' . $module . '.info');
  if ($info['dependencies'][$key] != $dependency) {
    throw new \Exception("{$module} did not have {$dependency} dependency at {$key} position");
  }
}