function FieldItemListTest::testDefaultValuesFormValidate

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Field/FieldItemListTest.php \Drupal\Tests\Core\Field\FieldItemListTest::testDefaultValuesFormValidate()
  2. 8.9.x core/tests/Drupal/Tests/Core/Field/FieldItemListTest.php \Drupal\Tests\Core\Field\FieldItemListTest::testDefaultValuesFormValidate()
  3. 10 core/tests/Drupal/Tests/Core/Field/FieldItemListTest.php \Drupal\Tests\Core\Field\FieldItemListTest::testDefaultValuesFormValidate()

@covers ::defaultValuesFormValidate

File

core/tests/Drupal/Tests/Core/Field/FieldItemListTest.php, line 319

Class

FieldItemListTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Field%21FieldItemList.php/class/FieldItemList/11.x" title="Represents an entity field; that is, a list of field item objects." class="local">\Drupal\Core\Field\FieldItemList</a> @group Field

Namespace

Drupal\Tests\Core\Field

Code

public function testDefaultValuesFormValidate() : void {
    $field_definition = $this->createMock(FieldDefinitionInterface::class);
    
    /** @var \Drupal\Core\Field\FieldItemList|\PHPUnit\Framework\MockObject\MockObject $field_list */
    $field_list = $this->getMockBuilder(FieldItemList::class)
        ->onlyMethods([
        'defaultValueWidget',
        'validate',
    ])
        ->setConstructorArgs([
        $field_definition,
    ])
        ->getMock();
    $field_list->expects($this->any())
        ->method('defaultValueWidget')
        ->willReturn(NULL);
    $field_list->expects($this->never())
        ->method('validate');
    $form = [];
    $form_state = new FormState();
    $field_list->defaultValuesFormValidate([], $form, $form_state);
}

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