protected function UpdateContribTest::assertCoreCompatibilityMessage in Drupal 8
Same name and namespace in other branches
- 9 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.
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 859
Class
- UpdateContribTest
- Tests how the Update Manager module handles contributed modules and themes in a series of functional tests using mock XML data.
Namespace
Drupal\Tests\update\FunctionalCode
protected function assertCoreCompatibilityMessage($version, $expected_range, $expected_release_title, $is_compatible = TRUE) {
$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) {
$download_version = str_replace('.', '-', $version);
// If an update is compatible with the installed version of Drupal core,
// it should have a download link and the details element should be closed
// by default.
$this
->assertFalse($compatibility_details
->hasAttribute('open'));
$this
->assertSame('Compatible', $details_summary_element
->getText());
$this
->assertEquals($update_element
->findLink('Download')
->getAttribute('href'), "http://example.com/{$this->updateProject}-{$download_version}.tar.gz");
}
else {
// If an update is not compatible with the installed version of Drupal
// core, it should not have a download link and 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'));
}
}