FieldHelpTest.php in Drupal 9
File
core/modules/field/tests/src/Functional/FieldHelpTest.php
View source
<?php
namespace Drupal\Tests\field\Functional;
use Drupal\Tests\BrowserTestBase;
class FieldHelpTest extends BrowserTestBase {
protected static $modules = [
'field',
'help',
];
protected $defaultTheme = 'stark';
protected $adminUser;
protected function setUp() : void {
parent::setUp();
$this->adminUser = $this
->drupalCreateUser([
'access administration pages',
'view the administration theme',
]);
}
public function testFieldHelp() {
$this
->drupalLogin($this->adminUser);
$this
->drupalGet('admin/help/field');
\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.');
$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.');
}
}