protected function PatchInfoTest::assertModuleListed in PatchInfo 8.2
Assert that a module is listed in update report.
Parameters
string $module_label: Module label as listed in update report.
string $module_version: Module version as listed in update report.
int $index: Link position counting from zero.
string $message: (optional) A message to display with the assertion. Do not translate messages: use strtr() to embed variables in the message text, not t(). If left blank, a default message will be displayed.
Return value
bool TRUE if the assertion succeeded, FALSE otherwise.
1 call to PatchInfoTest::assertModuleListed()
- PatchInfoTest::testModuleExclusion in tests/
src/ Functional/ PatchInfoTest.php - Tests exclusion of modules from update check.
File
- tests/
src/ Functional/ PatchInfoTest.php, line 575
Class
- PatchInfoTest
- Tests functionality of PatchInfo module.
Namespace
Drupal\Tests\patchinfo\FunctionalCode
protected function assertModuleListed($module_label, $module_version, $index = 0, $message = '') {
// Get any div elements with class 'project-update-title'.
$xpath = '//div[@class="project-update__title"]';
// That have an anchor tag containing the module label.
$xpath_link = $xpath . '/a[normalize-space(text())=:module_label]';
// Or that contain the module label and module version separated by a space.
$xpath .= '[normalize-space(text())=:update_title]|' . $xpath_link;
$listed_module = $this
->xpath($xpath, [
':module_label' => $module_label,
':update_title' => $module_label . ' ' . $module_version,
]);
return $this
->assertTrue(isset($listed_module[$index]), $message);
}