function ModulesListFormWebTest::testModulesListFormWithInvalidInfoFile

Same name and namespace in other branches
  1. 11.x 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. 9 core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php \Drupal\Tests\system\Functional\Form\ModulesListFormWebTest::testModulesListFormWithInvalidInfoFile()
  4. main 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 \Drupal\system\Form\ModulesListForm.

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.