You are here

protected function ListWidgetTest::getNewSubjectUnderTest in Select (or other) 4.x

Same name and namespace in other branches
  1. 8 tests/src/Unit/ListWidgetTest.php \Drupal\Tests\select_or_other\Unit\ListWidgetTest::getNewSubjectUnderTest()
5 calls to ListWidgetTest::getNewSubjectUnderTest()
ListWidgetTest::massageFormValuesAddsNewValuesToAllowedValues in tests/src/Unit/ListWidgetTest.php
@test @covers Drupal\select_or_other\Plugin\Field\FieldWidget\ListWidget::extractNewValues @covers Drupal\select_or_other\Plugin\Field\FieldWidget\ListWidget::AddNewValuesToAllowedValues
ListWidgetTest::massageFormValuesDoNotAddOtherValuesToAllowedValues in tests/src/Unit/ListWidgetTest.php
@test @covers Drupal\select_or_other\Plugin\Field\FieldWidget\ListWidget::extractNewValues @covers Drupal\select_or_other\Plugin\Field\FieldWidget\ListWidget::AddNewValuesToAllowedValues
ListWidgetTest::massageFormValuesRemovesOtherValueIfPresent in tests/src/Unit/ListWidgetTest.php
@test
ListWidgetTest::massageFormValuesRemovesSelectValueIfPresent in tests/src/Unit/ListWidgetTest.php
@test
ListWidgetTest::massageFormValuesReturnsValuesPassedToIt in tests/src/Unit/ListWidgetTest.php
@test

File

tests/src/Unit/ListWidgetTest.php, line 191

Class

ListWidgetTest
Tests the form element implementation.

Namespace

Drupal\Tests\select_or_other\Unit

Code

protected function getNewSubjectUnderTest(FieldDefinitionInterface $fieldDefinition = NULL) {
  $widget_id = 'widget_id';
  $plugin_definition = 'plugin_definition';
  if (empty($fieldDefinition)) {
    $fieldDefinition = $this
      ->getMockForAbstractClass('\\Drupal\\Core\\Field\\FieldDefinitionInterface');
  }
  $settings = [];
  $third_party_settings = [];
  return new ListWidget($widget_id, $plugin_definition, $fieldDefinition, $settings, $third_party_settings);
}