Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / modules / path / tests / src / Functional / PathNodeFormTest.php
1 <?php
2
3 namespace Drupal\Tests\path\Functional;
4
5 /**
6  * Tests the Path Node form UI.
7  *
8  * @group path
9  */
10 class PathNodeFormTest extends PathTestBase {
11
12   /**
13    * Modules to enable.
14    *
15    * @var array
16    */
17   public static $modules = ['node', 'path'];
18
19   protected function setUp() {
20     parent::setUp();
21
22     // Create test user and log in.
23     $web_user = $this->drupalCreateUser(['create page content', 'create url aliases']);
24     $this->drupalLogin($web_user);
25   }
26
27   /**
28    * Tests the node form ui.
29    */
30   public function testNodeForm() {
31     $assert_session = $this->assertSession();
32
33     $this->drupalGet('node/add/page');
34
35     // Make sure we have a vertical tab fieldset and 'Path' fields.
36     $assert_session->elementContains('css', '.form-type-vertical-tabs #edit-path-0 summary', 'URL alias');
37     $assert_session->fieldExists('path[0][alias]');
38
39     // Disable the 'Path' field for this content type.
40     entity_get_form_display('node', 'page', 'default')
41       ->removeComponent('path')
42       ->save();
43
44     $this->drupalGet('node/add/page');
45
46     // See if the whole fieldset is gone now.
47     $assert_session->elementNotExists('css', '.form-type-vertical-tabs #edit-path-0');
48     $assert_session->fieldNotExists('path[0][alias]');
49   }
50
51 }