You are here

public function FieldHelpTest::testFieldHelp in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/field/tests/src/Functional/FieldHelpTest.php \Drupal\Tests\field\Functional\FieldHelpTest::testFieldHelp()
  2. 9 core/modules/field/tests/src/Functional/FieldHelpTest.php \Drupal\Tests\field\Functional\FieldHelpTest::testFieldHelp()

Tests the Field module's help page.

File

core/modules/field/tests/src/Functional/FieldHelpTest.php, line 44

Class

FieldHelpTest
Tests help display for the Field module.

Namespace

Drupal\Tests\field\Functional

Code

public function testFieldHelp() {

  // Log in the admin user.
  $this
    ->drupalLogin($this->adminUser);

  // Visit the Help page and make sure no warnings or notices are thrown.
  $this
    ->drupalGet('admin/help/field');

  // Enable the Options, Email and Field API Test modules.
  \Drupal::service('module_installer')
    ->install([
    'options',
    'field_test',
  ]);
  $this
    ->drupalGet('admin/help/field');
  $this
    ->assertSession()
    ->linkExists('Options', 0, 'Options module is listed on the Field help page.');

  // Verify that modules with field types that do not implement hook_help are
  // listed.
  $this
    ->assertSession()
    ->pageTextContains('Field API Test');
  $this
    ->assertSession()
    ->linkNotExists('Field API Test', 'Modules with field types that do not implement hook_help are not linked.');
  $this
    ->assertSession()
    ->linkNotExists('Link', 'Modules that have not been installed, are not listed.');
}