function ModulesListFormWebTest::testModulesListFormWithInvalidInfoFile

Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php \Drupal\Tests\system\Functional\Form\ModulesListFormWebTest::testModulesListFormWithInvalidInfoFile()
  2. 10 core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php \Drupal\Tests\system\Functional\Form\ModulesListFormWebTest::testModulesListFormWithInvalidInfoFile()
  3. 11.x core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php \Drupal\Tests\system\Functional\Form\ModulesListFormWebTest::testModulesListFormWithInvalidInfoFile()

File

core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php, line 57

Class

ModulesListFormWebTest
Tests <a href="/api/drupal/core%21modules%21system%21src%21Form%21ModulesListForm.php/class/ModulesListForm/8.9.x" title="Provides module installation interface." class="local">\Drupal\system\Form\ModulesListForm</a>.

Namespace

Drupal\Tests\system\Functional\Form

Code

public function testModulesListFormWithInvalidInfoFile() {
    $broken_info_yml = <<<BROKEN
name: Module With Broken Info file
type: module
BROKEN;
    $path = \Drupal::service('site.path') . "/modules/broken";
    mkdir($path, 0777, TRUE);
    file_put_contents("{$path}/broken.info.yml", $broken_info_yml);
    $this->drupalGet('admin/modules');
    // Confirm that the error message is shown.
    $this->assertSession()
        ->pageTextContains("The 'core' or the 'core_version_requirement' key must be present in " . $path . '/broken.info.yml');
    // Check that the module filter text box is available.
    $this->assertSession()
        ->elementExists('xpath', '//input[@name="text"]');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.