public function FieldItemListTest::testDefaultValuesFormSubmit in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Field/FieldItemListTest.php \Drupal\Tests\Core\Field\FieldItemListTest::testDefaultValuesFormSubmit()
- 10 core/tests/Drupal/Tests/Core/Field/FieldItemListTest.php \Drupal\Tests\Core\Field\FieldItemListTest::testDefaultValuesFormSubmit()
@covers ::defaultValuesFormSubmit
File
- core/
tests/ Drupal/ Tests/ Core/ Field/ FieldItemListTest.php, line 337
Class
- FieldItemListTest
- @coversDefaultClass \Drupal\Core\Field\FieldItemList @group Field
Namespace
Drupal\Tests\Core\FieldCode
public function testDefaultValuesFormSubmit() {
$field_definition = $this
->createMock(FieldDefinitionInterface::class);
/** @var \Drupal\Core\Field\FieldItemList|\PHPUnit\Framework\MockObject\MockObject $field_list */
$field_list = $this
->getMockBuilder(FieldItemList::class)
->setMethods([
'defaultValueWidget',
'getValue',
])
->setConstructorArgs([
$field_definition,
])
->getMock();
$field_list
->expects($this
->any())
->method('defaultValueWidget')
->willReturn(NULL);
$form = [];
$form_state = new FormState();
$field_list
->expects($this
->never())
->method('getValue');
$this
->assertSame([], $field_list
->defaultValuesFormSubmit([], $form, $form_state));
}