diff --git a/core/modules/views/src/Tests/FieldApiDataTest.php b/core/modules/views/src/Tests/FieldApiDataTest.php index 163fc11..bb77661 100644 --- a/core/modules/views/src/Tests/FieldApiDataTest.php +++ b/core/modules/views/src/Tests/FieldApiDataTest.php @@ -11,6 +11,7 @@ use Drupal\field\Entity\FieldConfig; use Drupal\field\Tests\Views\FieldTestBase; use Drupal\language\Entity\ConfigurableLanguage; +use Drupal\language\Entity\ContentLanguageSettings; use Drupal\node\Entity\Node; use Drupal\node\Entity\NodeType; use Drupal\views\Views; @@ -132,7 +133,17 @@ protected function setUp() { 'id' => 'fr', ])->save(); + $config = ContentLanguageSettings::loadByEntityTypeBundle('node', $bundles[0]->id()); + $config->setDefaultLangcode('es') + ->setLanguageAlterable(TRUE) + ->save(); + $config = ContentLanguageSettings::loadByEntityTypeBundle('node', $bundles[1]->id()); + $config->setDefaultLangcode('es') + ->setLanguageAlterable(TRUE) + ->save(); + $node = Node::create([ + 'title' => 'Test title ' . $bundles[0]->id(), 'type' => $bundles[0]->id(), 'langcode' => 'es', $field_names[1] => 'field name 1: es', @@ -141,12 +152,14 @@ protected function setUp() { ]); $node->save(); $this->translationNodes[] = $node; - $translation = $node->getTranslation('fr'); + $translation = $node->addTranslation('fr'); $translation->{$field_names[1]}->value = 'field name 1: fr'; $translation->{$field_names[3]}->value = 'field name 3: fr'; + $translation->title->value = $node->title->value; $translation->save(); $node = Node::create([ + 'title' => 'Test title ' . $bundles[1]->id(), 'type' => $bundles[1]->id(), 'langcode' => 'es', $field_names[1] => 'field name 1: es', @@ -155,8 +168,9 @@ protected function setUp() { ]); $node->save(); $this->translationNodes[] = $node; - $translation = $node->getTranslation('fr'); + $translation = $node->addTranslation('fr'); $translation->{$field_names[1]}->value = 'field name 1: fr'; + $translation->title->value = $node->title->value; $translation->save(); }