function ManageFieldsTest::testFieldTypeCardinalityAlter
Tests hook_form_field_storage_config_form_edit_alter().
Attributes
#[IgnoreDeprecations]
File
-
core/
modules/ field_ui/ tests/ src/ Functional/ ManageFieldsTest.php, line 319
Class
- ManageFieldsTest
- Tests the Manage Display page of a fieldable entity type.
Namespace
Drupal\Tests\field_ui\FunctionalCode
public function testFieldTypeCardinalityAlter() : void {
$node_type = $this->drupalCreateContentType();
$bundle = $node_type->id();
/** @var \Drupal\field\FieldStorageConfigInterface $storage */
$storage = $this->container
->get('entity_type.manager')
->getStorage('field_storage_config')
->create([
'type' => 'test_field',
'field_name' => 'field_test_field',
'entity_type' => 'node',
]);
$storage->save();
$this->container
->get('entity_type.manager')
->getStorage('field_config')
->create([
'field_storage' => $storage,
'bundle' => $bundle,
'entity_type' => 'node',
])
->save();
$this->drupalGet("/admin/structure/types/manage/{$bundle}/fields/node.{$bundle}.field_test_field");
$this->assertSession()
->elementTextContains('css', '#edit-field-storage', 'Greetings from Drupal\\field_test\\Plugin\\Field\\FieldType\\TestItem::storageSettingsForm');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.