PathNodeFormTest.php in Drupal 9
File
core/modules/path/tests/src/Functional/PathNodeFormTest.php
View source
<?php
namespace Drupal\Tests\path\Functional;
class PathNodeFormTest extends PathTestBase {
protected static $modules = [
'node',
'path',
];
protected $defaultTheme = 'classy';
protected function setUp() : void {
parent::setUp();
$web_user = $this
->drupalCreateUser([
'create page content',
'create url aliases',
]);
$this
->drupalLogin($web_user);
}
public function testNodeForm() {
$assert_session = $this
->assertSession();
$this
->drupalGet('node/add/page');
$assert_session
->elementContains('css', '.form-type-vertical-tabs #edit-path-0 summary', 'URL alias');
$assert_session
->fieldExists('path[0][alias]');
\Drupal::service('entity_display.repository')
->getFormDisplay('node', 'page', 'default')
->removeComponent('path')
->save();
$this
->drupalGet('node/add/page');
$assert_session
->elementNotExists('css', '.form-type-vertical-tabs #edit-path-0');
$assert_session
->fieldNotExists('path[0][alias]');
}
}