Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\Tests\field\Functional;
|
Chris@0
|
4
|
Chris@0
|
5 use Drupal\Tests\BrowserTestBase;
|
Chris@0
|
6
|
Chris@0
|
7 /**
|
Chris@0
|
8 * Tests help display for the Field module.
|
Chris@0
|
9 *
|
Chris@0
|
10 * @group field
|
Chris@0
|
11 */
|
Chris@0
|
12 class FieldHelpTest extends BrowserTestBase {
|
Chris@0
|
13
|
Chris@0
|
14 /**
|
Chris@0
|
15 * Modules to enable.
|
Chris@0
|
16 *
|
Chris@17
|
17 * @var array
|
Chris@0
|
18 */
|
Chris@0
|
19 public static $modules = ['field', 'help'];
|
Chris@0
|
20
|
Chris@0
|
21 // Tests field help implementation without optional core modules enabled.
|
Chris@0
|
22 protected $profile = 'minimal';
|
Chris@0
|
23
|
Chris@0
|
24 /**
|
Chris@0
|
25 * The admin user that will be created.
|
Chris@0
|
26 */
|
Chris@0
|
27 protected $adminUser;
|
Chris@0
|
28
|
Chris@0
|
29 protected function setUp() {
|
Chris@0
|
30 parent::setUp();
|
Chris@0
|
31
|
Chris@0
|
32 // Create the admin user.
|
Chris@0
|
33 $this->adminUser = $this->drupalCreateUser(['access administration pages', 'view the administration theme']);
|
Chris@0
|
34 }
|
Chris@0
|
35
|
Chris@0
|
36 /**
|
Chris@0
|
37 * Test the Field module's help page.
|
Chris@0
|
38 */
|
Chris@0
|
39 public function testFieldHelp() {
|
Chris@0
|
40 // Log in the admin user.
|
Chris@0
|
41 $this->drupalLogin($this->adminUser);
|
Chris@0
|
42
|
Chris@0
|
43 // Visit the Help page and make sure no warnings or notices are thrown.
|
Chris@0
|
44 $this->drupalGet('admin/help/field');
|
Chris@0
|
45
|
Chris@0
|
46 // Enable the Options, Email and Field API Test modules.
|
Chris@0
|
47 \Drupal::service('module_installer')->install(['options', 'field_test']);
|
Chris@0
|
48 $this->resetAll();
|
Chris@0
|
49 \Drupal::service('plugin.manager.field.widget')->clearCachedDefinitions();
|
Chris@0
|
50 \Drupal::service('plugin.manager.field.field_type')->clearCachedDefinitions();
|
Chris@0
|
51
|
Chris@0
|
52 $this->drupalGet('admin/help/field');
|
Chris@0
|
53 $this->assertLink('Options', 0, 'Options module is listed on the Field help page.');
|
Chris@0
|
54 $this->assertText('Field API Test', 'Modules with field types that do not implement hook_help are listed.');
|
Chris@0
|
55 $this->assertNoLink('Field API Test', 'Modules with field types that do not implement hook_help are not linked.');
|
Chris@0
|
56 $this->assertNoLink('Link', 'Modules that have not been installed, are not listed.');
|
Chris@0
|
57 }
|
Chris@0
|
58
|
Chris@0
|
59 }
|