You are here

public function EntityFieldManagerTest::testGetBaseFieldDefinitionsInvalidDefinition in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php \Drupal\Tests\Core\Entity\EntityFieldManagerTest::testGetBaseFieldDefinitionsInvalidDefinition()

Tests the getBaseFieldDefinitions() method with an invalid definition.

@covers ::getBaseFieldDefinitions @covers ::buildBaseFieldDefinitions

File

core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php, line 472
Contains \Drupal\Tests\Core\Entity\EntityFieldManagerTest.

Class

EntityFieldManagerTest
@coversDefaultClass \Drupal\Core\Entity\EntityFieldManager @group Entity

Namespace

Drupal\Tests\Core\Entity

Code

public function testGetBaseFieldDefinitionsInvalidDefinition() {
  $this
    ->setUpEntityWithFieldDefinition(FALSE, 'langcode', [
    'langcode' => 'langcode',
  ]);
  $this->entityType
    ->isTranslatable()
    ->willReturn(TRUE);
  $this->entityType
    ->getLabel()
    ->willReturn('the_label');
  $this
    ->expectException(\LogicException::class);
  $this->entityFieldManager
    ->getBaseFieldDefinitions('test_entity_type');
}