You are here

public function FieldConfigEntityUnitTest::testGetType in Drupal 8

Same name and namespace in other branches
  1. 9 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 292
Contains \Drupal\Tests\field\Unit\FieldConfigEntityUnitTest.

Class

FieldConfigEntityUnitTest
@coversDefaultClass \Drupal\field\Entity\FieldConfig @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());
}