You are here

public function DisableFieldTest::testDisableFieldOnEditFormEnableForAllRoles in Disable Field 8.2

Enable the field for all roles on the content edit form.

File

tests/src/Functional/DisableFieldTest.php, line 194

Class

DisableFieldTest
Disable field tests.

Namespace

Drupal\Tests\disable_field\Functional

Code

public function testDisableFieldOnEditFormEnableForAllRoles() : void {
  $this
    ->fieldUIAddNewField('admin/structure/types/manage/test', 'test', 'Test field', 'string');
  $node = $this
    ->drupalCreateNode([
    'type' => 'test',
  ]);
  $this
    ->drupalGet($node
    ->toUrl('edit-form'));
  $this
    ->checkIfFieldIsNotDisabledByFieldName('field_test');
  $this
    ->drupalLogin($this->user1);
  $this
    ->drupalGet($node
    ->toUrl('edit-form'));
  $this
    ->checkIfFieldIsNotDisabledByFieldName('field_test');
  $this
    ->drupalLogin($this->user2);
  $this
    ->drupalGet($node
    ->toUrl('edit-form'));
  $this
    ->checkIfFieldIsNotDisabledByFieldName('field_test');
}