You are here

private function TranslationOperationTargetLanguageTest::translateNode in Translation Views 8

Translate node all specified languages.

1 call to TranslationOperationTargetLanguageTest::translateNode()
TranslationOperationTargetLanguageTest::testTranslationOperationsTargetLanguage in tests/src/Functional/TranslationOperationTargetLanguageTest.php
Test translation operations target language.

File

tests/src/Functional/TranslationOperationTargetLanguageTest.php, line 121

Class

TranslationOperationTargetLanguageTest
Class TranslationOperationTargetLanguageTest.

Namespace

Drupal\Tests\translation_views\Functional

Code

private function translateNode() {
  $node = Node::load(1);
  foreach (self::$langcodes as $langcode) {
    if (!$node
      ->hasTranslation($langcode)) {
      $this
        ->assertFalse($node
        ->hasTranslation($langcode));
      $node
        ->addTranslation($langcode, [
        'title' => $this
          ->randomMachineName(),
      ])
        ->save();
      $this
        ->assertTrue($node
        ->hasTranslation($langcode));
    }
  }
}