function ModulesListFormWebTest::testModulesListFormWithInvalidInfoFile
Same name in other branches
- 9 core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php \Drupal\Tests\system\Functional\Form\ModulesListFormWebTest::testModulesListFormWithInvalidInfoFile()
- 8.9.x core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php \Drupal\Tests\system\Functional\Form\ModulesListFormWebTest::testModulesListFormWithInvalidInfoFile()
- 10 core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php \Drupal\Tests\system\Functional\Form\ModulesListFormWebTest::testModulesListFormWithInvalidInfoFile()
Tests the module form with a module with an invalid info.yml file.
File
-
core/
modules/ system/ tests/ src/ Functional/ Form/ ModulesListFormWebTest.php, line 97
Class
Namespace
Drupal\Tests\system\Functional\FormCode
public function testModulesListFormWithInvalidInfoFile() : void {
$path = $this->root . '/' . \Drupal::getContainer()->getParameter('site.path') . "/modules/broken";
mkdir($path, 0777, TRUE);
$file_path = "{$path}/broken.info.yml";
$yml = <<<BROKEN
name: Module with no core_version_requirement
type: module
BROKEN;
file_put_contents($file_path, $yml);
$this->drupalGet('admin/modules');
$this->assertSession()
->statusCodeEquals(200);
$this->assertSession()
->pageTextContains("Modules could not be listed due to an error: The 'core_version_requirement' key must be present in {$file_path}");
// Check that the module filter text box is available.
$this->assertSession()
->elementExists('xpath', '//input[@name="text"]');
unlink($file_path);
$this->drupalGet('admin/modules');
$this->assertSession()
->statusCodeEquals(200);
// Check that the module filter text box is available.
$this->assertSession()
->elementExists('xpath', '//input[@name="text"]');
$this->assertSession()
->pageTextNotContains('Modules could not be listed due to an error');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.