Mercurial > hg > isophonics-drupal-site
diff core/modules/field/tests/src/Functional/FieldHelpTest.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children | 129ea1e6d783 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/modules/field/tests/src/Functional/FieldHelpTest.php Wed Nov 29 16:09:58 2017 +0000 @@ -0,0 +1,59 @@ +<?php + +namespace Drupal\Tests\field\Functional; + +use Drupal\Tests\BrowserTestBase; + +/** + * Tests help display for the Field module. + * + * @group field + */ +class FieldHelpTest extends BrowserTestBase { + + /** + * Modules to enable. + * + * @var array. + */ + public static $modules = ['field', 'help']; + + // Tests field help implementation without optional core modules enabled. + protected $profile = 'minimal'; + + /** + * The admin user that will be created. + */ + protected $adminUser; + + protected function setUp() { + parent::setUp(); + + // Create the admin user. + $this->adminUser = $this->drupalCreateUser(['access administration pages', 'view the administration theme']); + } + + /** + * Test the Field module's help page. + */ + 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->resetAll(); + \Drupal::service('plugin.manager.field.widget')->clearCachedDefinitions(); + \Drupal::service('plugin.manager.field.field_type')->clearCachedDefinitions(); + + $this->drupalGet('admin/help/field'); + $this->assertLink('Options', 0, 'Options module is listed on the Field help page.'); + $this->assertText('Field API Test', 'Modules with field types that do not implement hook_help are listed.'); + $this->assertNoLink('Field API Test', 'Modules with field types that do not implement hook_help are not linked.'); + $this->assertNoLink('Link', 'Modules that have not been installed, are not listed.'); + } + +}