function ModulesListFormWebTest::testModulesListFormWithEmptyDescriptionInfoFile

Same name and namespace in other branches
  1. 10 core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php \Drupal\Tests\system\Functional\Form\ModulesListFormWebTest::testModulesListFormWithEmptyDescriptionInfoFile()

Tests the module form with a module with an empty description in info.yml.

File

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

Class

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

Namespace

Drupal\Tests\system\Functional\Form

Code

public function testModulesListFormWithEmptyDescriptionInfoFile() : void {
    $path = \Drupal::getContainer()->getParameter('site.path') . "/modules/missing_description";
    mkdir($path, 0777, TRUE);
    $file_path = "{$path}/missing_description.info.yml";
    $yml = <<<BROKEN
name: Module with empty description
type: module
core_version_requirement: '*'
description:
BROKEN;
    file_put_contents($file_path, $yml);
    $this->drupalGet('admin/modules');
    $this->assertSession()
        ->statusCodeEquals(200);
    $this->assertSession()
        ->pageTextContains("Module with empty description");
    // 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.