You are here

public function TestSubContext::moduleHasDependencyAtKey in Panopoly 7

Same name and namespace in other branches
  1. 8.2 modules/panopoly/panopoly_test/behat/steps/panopoly_test.behat.inc \TestSubContext::moduleHasDependencyAtKey()

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

File

modules/panopoly/panopoly_test/behat/steps/panopoly_test.behat.inc, line 1082
Provide Behat step-definitions for generic Panopoly 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");
  }
}