function EntityFormTest::testEntityFormDisplayAlter

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Entity/EntityFormTest.php \Drupal\Tests\system\Functional\Entity\EntityFormTest::testEntityFormDisplayAlter()
  2. 8.9.x core/modules/system/tests/src/Functional/Entity/EntityFormTest.php \Drupal\Tests\system\Functional\Entity\EntityFormTest::testEntityFormDisplayAlter()
  3. 10 core/modules/system/tests/src/Functional/Entity/EntityFormTest.php \Drupal\Tests\system\Functional\Entity\EntityFormTest::testEntityFormDisplayAlter()

Tests hook_entity_form_display_alter().

Verify that the altered field has the correct size value.

See also

entity_test_entity_form_display_alter()

File

core/modules/system/tests/src/Functional/Entity/EntityFormTest.php, line 124

Class

EntityFormTest
Tests the entity form.

Namespace

Drupal\Tests\system\Functional\Entity

Code

public function testEntityFormDisplayAlter() : void {
    $this->drupalGet('entity_test/add');
    $altered_field = $this->assertSession()
        ->fieldExists('field_test_text[0][value]');
    $this->assertEquals(42, $altered_field->getAttribute('size'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.