function CommentBundlesTest::setUp
Overrides KernelTestBase::setUp
File
- 
              core/
modules/ comment/ tests/ src/ Kernel/ CommentBundlesTest.php, line 37  
Class
- CommentBundlesTest
 - Tests that comment bundles behave as expected.
 
Namespace
Drupal\Tests\comment\KernelCode
protected function setUp() : void {
  parent::setUp();
  $this->entityFieldManager = $this->container
    ->get('entity_field.manager');
  $this->installEntitySchema('comment');
  // Create multiple comment bundles,
  // each of which has a different target entity type.
  $this->targetEntityTypes = [
    'comment' => 'Comment',
    'node' => 'Node',
    'taxonomy_term' => 'Taxonomy Term',
  ];
  foreach ($this->targetEntityTypes as $id => $label) {
    CommentType::create([
      'id' => 'comment_on_' . $id,
      'label' => 'Comment on ' . $label,
      'target_entity_type_id' => $id,
    ])->save();
  }
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.