protected function CommentTranslationUITest::createEntity in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/comment/src/Tests/CommentTranslationUITest.php \Drupal\comment\Tests\CommentTranslationUITest::createEntity()
Creates the entity to be translated.
Parameters
array $values: An array of initial values for the entity.
string $langcode: The initial language code of the entity.
string $bundle_name: (optional) The entity bundle, if the entity uses bundles. Defaults to NULL. If left NULL, $this->bundle will be used.
Return value
string The entity id.
Overrides ContentTranslationTestBase::createEntity
1 call to CommentTranslationUITest::createEntity()
- CommentTranslationUITest::testTranslateLinkCommentAdminPage in core/
modules/ comment/ src/ Tests/ CommentTranslationUITest.php - Tests translate link on comment content admin page.
File
- core/
modules/ comment/ src/ Tests/ CommentTranslationUITest.php, line 92 - Contains \Drupal\comment\Tests\CommentTranslationUITest.
Class
- CommentTranslationUITest
- Tests the Comment Translation UI.
Namespace
Drupal\comment\TestsCode
protected function createEntity($values, $langcode, $comment_type = 'comment_article') {
if ($comment_type == 'comment_article') {
// This is the article node type, with the 'comment_article' field.
$node_type = 'article';
$field_name = 'comment_article';
}
else {
// This is the page node type with the non-translatable 'comment' field.
$node_type = 'page';
$field_name = 'comment';
}
$node = $this
->drupalCreateNode(array(
'type' => $node_type,
$field_name => array(
array(
'status' => CommentItemInterface::OPEN,
),
),
));
$values['entity_id'] = $node
->id();
$values['entity_type'] = 'node';
$values['field_name'] = $field_name;
$values['uid'] = $node
->getOwnerId();
return parent::createEntity($values, $langcode, $comment_type);
}