You are here

public function ParagraphsEntityTranslationWithNonTranslatableParagraphs::testParagraphsIEFTranslation in Paragraphs 8

Same name in this branch
  1. 8 tests/src/Functional/WidgetLegacy/ParagraphsEntityTranslationWithNonTranslatableParagraphs.php \Drupal\Tests\paragraphs\Functional\WidgetLegacy\ParagraphsEntityTranslationWithNonTranslatableParagraphs::testParagraphsIEFTranslation()
  2. 8 tests/src/Functional/WidgetStable/ParagraphsEntityTranslationWithNonTranslatableParagraphs.php \Drupal\Tests\paragraphs\Functional\WidgetStable\ParagraphsEntityTranslationWithNonTranslatableParagraphs::testParagraphsIEFTranslation()

Tests the revision of paragraphs.

File

tests/src/Functional/WidgetStable/ParagraphsEntityTranslationWithNonTranslatableParagraphs.php, line 76

Class

ParagraphsEntityTranslationWithNonTranslatableParagraphs
Tests the translation of heavily nested / specialized setup.

Namespace

Drupal\Tests\paragraphs\Functional\WidgetStable

Code

public function testParagraphsIEFTranslation() {
  $this
    ->drupalLogin($this->admin_user);

  // Create node with one paragraph.
  $this
    ->drupalGet('node/add/article');

  // Set the values and save.
  $edit = [
    'title[0][value]' => 'Title English',
  ];
  $this
    ->submitForm($edit, 'Save');

  // Add french translation.
  $this
    ->clickLink('Translate');
  $this
    ->clickLink('Add', 1);

  // Make sure that the original paragraph text is displayed.
  $this
    ->assertSession()
    ->pageTextContains('Title English');
  $edit = array(
    'title[0][value]' => 'Title French',
  );
  $this
    ->submitForm($edit, 'Save (this translation)');
  $this
    ->assertSession()
    ->pageTextContains('article Title French has been updated.');

  // Add german translation.
  $this
    ->clickLink('Translate');
  $this
    ->clickLink('Add');

  // Make sure that the original paragraph text is displayed.
  $this
    ->assertSession()
    ->pageTextContains('Title English');
  $edit = array(
    'title[0][value]' => 'Title German',
  );
  $this
    ->submitForm($edit, 'Save (this translation)');
  $this
    ->assertSession()
    ->pageTextContains('article Title German has been updated.');
}