public function UpdateContribTest::testNonStandardVersionStrings in Drupal 9
Same name and namespace in other branches
- 8 core/modules/update/tests/src/Functional/UpdateContribTest.php \Drupal\Tests\update\Functional\UpdateContribTest::testNonStandardVersionStrings()
- 10 core/modules/update/tests/src/Functional/UpdateContribTest.php \Drupal\Tests\update\Functional\UpdateContribTest::testNonStandardVersionStrings()
Tests messages for invalid, empty and missing version strings.
File
- core/
modules/ update/ tests/ src/ Functional/ UpdateContribTest.php, line 829
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
public function testNonStandardVersionStrings() {
$version_infos = [
'invalid' => [
'version' => 'llama',
'expected' => 'Invalid version: llama',
],
'empty' => [
'version' => '',
'expected' => 'Empty version',
],
'null' => [
'expected' => 'Invalid version: Unknown',
],
];
foreach ($version_infos as $version_info) {
$system_info = [
'aaa_update_test' => [
'project' => 'aaa_update_test',
'hidden' => FALSE,
],
];
if (isset($version_info['version'])) {
$system_info['aaa_update_test']['version'] = $version_info['version'];
}
$this
->config('update_test.settings')
->set('system_info', $system_info)
->save();
$this
->refreshUpdateStatus([
'drupal' => '0.0',
$this->updateProject => '1_0-supported',
]);
$this
->standardTests();
$this
->assertSession()
->elementTextContains('css', $this->updateTableLocator, $version_info['expected']);
}
}