function EntityTypeTest::testGetKey

Tests the getKey() method.

@dataProvider providerTestGetKeys

File

core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php, line 76

Class

EntityTypeTest
@coversDefaultClass \Drupal\Core\Entity\EntityType[[api-linebreak]] @group Entity

Namespace

Drupal\Tests\Core\Entity

Code

public function testGetKey($entity_keys, $expected) {
  $entity_type = $this->setUpEntityType([
    'entity_keys' => $entity_keys,
  ]);
  $this->assertSame($expected['bundle'], $entity_type->getKey('bundle'));
  $this->assertSame(FALSE, $entity_type->getKey('bananas'));
}

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