function EntityTypeBundleInfoTest::testGetBundleInfo
Same name in other branches
- 8.9.x core/tests/Drupal/Tests/Core/Entity/EntityTypeBundleInfoTest.php \Drupal\Tests\Core\Entity\EntityTypeBundleInfoTest::testGetBundleInfo()
- 10 core/tests/Drupal/Tests/Core/Entity/EntityTypeBundleInfoTest.php \Drupal\Tests\Core\Entity\EntityTypeBundleInfoTest::testGetBundleInfo()
- 11.x core/tests/Drupal/Tests/Core/Entity/EntityTypeBundleInfoTest.php \Drupal\Tests\Core\Entity\EntityTypeBundleInfoTest::testGetBundleInfo()
Tests the getBundleInfo() method.
@covers ::getBundleInfo
@dataProvider providerTestGetBundleInfo
File
-
core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityTypeBundleInfoTest.php, line 163
Class
- EntityTypeBundleInfoTest
- @coversDefaultClass \Drupal\Core\Entity\EntityTypeBundleInfo @group Entity
Namespace
Drupal\Tests\Core\EntityCode
public function testGetBundleInfo($entity_type_id, $expected) {
$this->moduleHandler
->invokeAll('entity_bundle_info')
->willReturn([]);
$this->moduleHandler
->alter('entity_bundle_info', Argument::type('array'))
->willReturn(NULL);
$apple = $this->prophesize(EntityTypeInterface::class);
$apple->getLabel()
->willReturn('Apple');
$apple->getBundleEntityType()
->willReturn(NULL);
$banana = $this->prophesize(EntityTypeInterface::class);
$banana->getLabel()
->willReturn('Banana');
$banana->getBundleEntityType()
->willReturn(NULL);
$this->setUpEntityTypeDefinitions([
'apple' => $apple,
'banana' => $banana,
]);
$bundle_info = $this->entityTypeBundleInfo
->getBundleInfo($entity_type_id);
$this->assertSame($expected, $bundle_info);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.