function CommentLegacyTest::setUp
Overrides EntityKernelTestBase::setUp
File
-
core/
modules/ comment/ tests/ src/ Kernel/ CommentLegacyTest.php, line 38
Class
- CommentLegacyTest
- Tests legacy comment functionality.
Namespace
Drupal\Tests\comment\KernelCode
protected function setUp() {
parent::setUp();
$this->installEntitySchema('comment');
$this->installSchema('comment', [
'comment_entity_statistics',
]);
CommentType::create([
'id' => 'comment',
'label' => $this->randomString(),
'target_entity_type_id' => 'entity_test',
])
->save();
FieldStorageConfig::create([
'entity_type' => 'entity_test',
'type' => 'comment',
'field_name' => 'comments',
'settings' => [
'comment_type' => 'comment',
],
])->save();
FieldConfig::create([
'entity_type' => 'entity_test',
'bundle' => 'entity_test',
'field_name' => 'comments',
])->save();
$this->entity = EntityTest::create([
'name' => $this->randomString(),
]);
$this->entity
->save();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.