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