public function FieldEntityTranslationTest::testTranslationRows in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Tests/Entity/FieldEntityTranslationTest.php \Drupal\views\Tests\Entity\FieldEntityTranslationTest::testTranslationRows()
Tests that different translation mechanisms can be used for base fields.
File
- core/
modules/ views/ src/ Tests/ Entity/ FieldEntityTranslationTest.php, line 65 - Contains \Drupal\views\Tests\Entity\FieldEntityTranslationTest.
Class
- FieldEntityTranslationTest
- Tests the rendering of fields (base fields) and their translations.
Namespace
Drupal\views\Tests\EntityCode
public function testTranslationRows() {
$node = Node::create([
'type' => 'article',
'title' => 'example EN',
'sticky' => false,
]);
$node
->save();
$translation = $node
->addTranslation('es');
$translation->title->value = 'example ES';
$translation->sticky->value = true;
$translation
->save();
$this
->drupalGet('test_entity_field_renderers/entity_translation');
$this
->assertRows([
[
'title' => 'example EN',
'sticky' => 'Off',
],
[
'title' => 'example ES',
'sticky' => 'On',
],
]);
$this
->drupalGet('test_entity_field_renderers/entity_default');
$this
->assertRows([
[
'title' => 'example EN',
'sticky' => 'Off',
],
[
'title' => 'example EN',
'sticky' => 'Off',
],
]);
$this
->drupalGet('test_entity_field_renderers/site_default');
$this
->assertRows([
[
'title' => 'example EN',
'sticky' => 'Off',
],
[
'title' => 'example EN',
'sticky' => 'Off',
],
]);
$this
->drupalGet('test_entity_field_renderers/language_interface');
$this
->assertRows([
[
'title' => 'example EN',
'sticky' => 'Off',
],
[
'title' => 'example EN',
'sticky' => 'Off',
],
]);
$this
->drupalGet('test_entity_field_renderers/language_interface', [
'language' => new Language([
'id' => 'es',
]),
]);
$this
->assertRows([
[
'title' => 'example ES',
'sticky' => 'On',
],
[
'title' => 'example ES',
'sticky' => 'On',
],
]);
$this
->drupalGet('test_entity_field_renderers/en');
$this
->assertRows([
[
'title' => 'example EN',
'sticky' => 'Off',
],
[
'title' => 'example EN',
'sticky' => 'Off',
],
]);
$this
->drupalGet('test_entity_field_renderers/es');
$this
->assertRows([
[
'title' => 'example ES',
'sticky' => 'On',
],
[
'title' => 'example ES',
'sticky' => 'On',
],
]);
}