function FieldConfigEntityUnitTest::testGetType

Same name and namespace in other branches
  1. 8.9.x core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php \Drupal\Tests\field\Unit\FieldConfigEntityUnitTest::testGetType()
  2. 10 core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php \Drupal\Tests\field\Unit\FieldConfigEntityUnitTest::testGetType()
  3. 11.x core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php \Drupal\Tests\field\Unit\FieldConfigEntityUnitTest::testGetType()

@covers ::getType

File

core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php, line 272

Class

FieldConfigEntityUnitTest
@coversDefaultClass \Drupal\field\Entity\FieldConfig[[api-linebreak]] @group field

Namespace

Drupal\Tests\field\Unit

Code

public function testGetType() {
  // Ensure that FieldConfig::getType() is not delegated to
  // FieldStorage.
  $this->entityFieldManager
    ->expects($this->never())
    ->method('getFieldStorageDefinitions');
  $this->fieldStorage
    ->expects($this->never())
    ->method('getType');
  $field = new FieldConfig([
    'field_name' => $this->fieldStorage
      ->getName(),
    'entity_type' => 'test_entity_type',
    'bundle' => 'test_bundle',
    'field_type' => 'test_field',
  ], $this->entityTypeId);
  $this->assertEquals('test_field', $field->getType());
}

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