Security update for Core, with self-updated composer
[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     $this->drupalGet('node/add/page');
32
33     // Make sure we have a Path fieldset and Path fields.
34     $this->assertRaw(' id="edit-path-settings"', 'Path settings details exists');
35     $this->assertFieldByName('path[0][alias]', NULL, 'Path alias field exists');
36
37     // Disable the Path field for this content type.
38     entity_get_form_display('node', 'page', 'default')
39       ->removeComponent('path')
40       ->save();
41
42     $this->drupalGet('node/add/page');
43
44     // See if the whole fieldset is gone now.
45     $this->assertNoRaw(' id="edit-path-settings"', 'Path settings details does not exist');
46     $this->assertNoFieldByName('path[0][alias]', NULL, 'Path alias field does not exist');
47   }
48
49 }