EntityBundleListenerTest.php in Drupal 10
File
core/tests/Drupal/KernelTests/Core/Entity/EntityBundleListenerTest.php
View source
<?php
namespace Drupal\KernelTests\Core\Entity;
class EntityBundleListenerTest extends EntityKernelTestBase {
public function testOnBundleCreate() {
$field_map = $this->container
->get('entity_field.manager')
->getFieldMap();
$expected = [
'entity_test' => 'entity_test',
];
$this
->assertEquals($expected, $field_map['entity_test']['id']['bundles']);
entity_test_create_bundle('custom');
$field_map = $this->container
->get('entity_field.manager')
->getFieldMap();
$expected = [
'entity_test' => 'entity_test',
'custom' => 'custom',
];
$this
->assertSame($expected, $field_map['entity_test']['id']['bundles']);
}
}