protected function InlineEntityFormTestBase::checkFormDisplayFields in Inline Entity Form 8
Checks for check correct fields on form displays.
This checks based on exported config in the inline_entity_form_test module.
Parameters
string $form_display: The form display to check.
string $prefix: The config prefix.
1 call to InlineEntityFormTestBase::checkFormDisplayFields()
- ElementWebTest::testCustomForm in tests/
src/ FunctionalJavascript/ ElementWebTest.php - Tests IEF on a custom form.
File
- tests/
src/ FunctionalJavascript/ InlineEntityFormTestBase.php, line 158
Class
- InlineEntityFormTestBase
- Base Class for Inline Entity Form Tests.
Namespace
Drupal\Tests\inline_entity_form\FunctionalJavascriptCode
protected function checkFormDisplayFields(string $form_display, string $prefix) {
$assert_session = $this
->assertSession();
$form_display_fields = [
'node.ief_test_custom.default' => [
'expected' => [
'[title][0][value]',
'[uid][0][target_id]',
'[created][0][value][date]',
'[created][0][value][time]',
'[promote][value]',
'[sticky][value]',
'[positive_int][0][value]',
],
'unexpected' => [],
],
'node.ief_test_custom.inline' => [
'expected' => [
'[title][0][value]',
'[positive_int][0][value]',
],
'unexpected' => [
'[uid][0][target_id]',
'[created][0][value][date]',
'[created][0][value][time]',
'[promote][value]',
'[sticky][value]',
],
],
];
if (empty($form_display_fields[$form_display])) {
throw new \Exception('Form display not found: ' . $form_display);
}
$fields = $form_display_fields[$form_display];
foreach ($fields['expected'] as $expected_field) {
$assert_session
->fieldExists($prefix . $expected_field);
}
foreach ($fields['unexpected'] as $unexpected_field) {
$assert_session
->fieldNotExists($prefix . $unexpected_field);
}
}