function FieldConfigEntityUnitTest::testGetType

Same name and namespace in other branches
  1. 9 core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php \Drupal\Tests\field\Unit\FieldConfigEntityUnitTest::testGetType()
  2. 8.9.x core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php \Drupal\Tests\field\Unit\FieldConfigEntityUnitTest::testGetType()
  3. 10 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 271

Class

FieldConfigEntityUnitTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21field%21src%21Entity%21FieldConfig.php/class/FieldConfig/11.x" title="Defines the Field entity." class="local">\Drupal\field\Entity\FieldConfig</a> @group field

Namespace

Drupal\Tests\field\Unit

Code

public function testGetType() : void {
    // 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.