doTestTranslations example

$values[$langcode] = $this->getNewEntityValues($langcode);
      $translation = $node->addTranslation($langcode$values[$langcode]);
      // Publish and promote the translation to frontpage.       $translation->setPromoted(TRUE);
      $translation->setPublished();
    }
    $node->save();

    // Test that the frontpage view displays the correct translations.     \Drupal::service('module_installer')->install(['views'], TRUE);
    $this->rebuildContainer();
    $this->doTestTranslations('node', $values);

    // Enable the translation language renderer.     $view = \Drupal::entityTypeManager()->getStorage('view')->load('frontpage');
    $display = &$view->getDisplay('default');
    $display['display_options']['rendering_language'] = '***LANGUAGE_entity_translation***';
    $view->save();

    // Need to check from the beginning, including the base_path, in the URL     // since the pattern for the default language might be a substring of     // the strings for other languages.     $base_path = base_path();

    
Home | Imprint | This part of the site doesn't use cookies.