You are here

public function FieldItemListTest::testDefaultValuesFormValidate in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 184
Contains \Drupal\Tests\Core\Field\FieldItemListTest.

Class

FieldItemListTest
@coversDefaultClass \Drupal\Core\Field\FieldItemList @group Field

Namespace

Drupal\Tests\Core\Field

Code

public function testDefaultValuesFormValidate() {
  $field_definition = $this
    ->getMock(FieldDefinitionInterface::class);

  /** @var \Drupal\Core\Field\FieldItemList|\PHPUnit_Framework_MockObject_MockObject $field_list */
  $field_list = $this
    ->getMock(FieldItemList::class, [
    'defaultValueWidget',
    'validate',
  ], [
    $field_definition,
  ]);
  $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);
}