function UpdateContribTest::assertCoreCompatibilityMessage
Same name in other branches
- 8.9.x core/modules/update/tests/src/Functional/UpdateContribTest.php \Drupal\Tests\update\Functional\UpdateContribTest::assertCoreCompatibilityMessage()
- 10 core/modules/update/tests/src/Functional/UpdateContribTest.php \Drupal\Tests\update\Functional\UpdateContribTest::assertCoreCompatibilityMessage()
- 11.x core/modules/update/tests/src/Functional/UpdateContribTest.php \Drupal\Tests\update\Functional\UpdateContribTest::assertCoreCompatibilityMessage()
Asserts that a core compatibility message is correct for an update.
@internal
Parameters
string $version: The version of the update.
string $expected_range: The expected core compatibility range.
string $expected_release_title: The expected release title.
bool $is_compatible: If the update is compatible with the installed version of Drupal.
1 call to UpdateContribTest::assertCoreCompatibilityMessage()
- UpdateContribTest::testCoreCompatibilityMessage in core/
modules/ update/ tests/ src/ Functional/ UpdateContribTest.php - Tests that core compatibility messages are displayed.
File
-
core/
modules/ update/ tests/ src/ Functional/ UpdateContribTest.php, line 874
Class
- UpdateContribTest
- Tests how the Update Manager handles contributed modules and themes.
Namespace
Drupal\Tests\update\FunctionalCode
protected function assertCoreCompatibilityMessage(string $version, string $expected_range, string $expected_release_title, bool $is_compatible = TRUE) : void {
$update_element = $this->findUpdateElementByLabel($expected_release_title);
$this->assertTrue($update_element->hasLink($version));
$compatibility_details = $update_element->find('css', '.project-update__compatibility-details details');
$this->assertStringContainsString("Requires Drupal core: {$expected_range}", $compatibility_details->getText());
$details_summary_element = $compatibility_details->find('css', 'summary');
if ($is_compatible) {
// If an update is compatible with the installed version of Drupal core,
// the details element should be closed by default.
$this->assertFalse($compatibility_details->hasAttribute('open'));
$this->assertSame('Compatible', $details_summary_element->getText());
}
else {
// If an update is not compatible with the installed version of Drupal
// core, the details element should be open by default.
$this->assertTrue($compatibility_details->hasAttribute('open'));
$this->assertSame('Not compatible', $details_summary_element->getText());
}
$this->assertFalse($update_element->hasLink('Download'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.