public function ParagraphsEntityTranslationWithNonTranslatableParagraphs::testParagraphsIEFTranslation

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

Tests the revision of paragraphs.

File

paragraphs/tests/src/Functional/WidgetLegacy/ParagraphsEntityTranslationWithNonTranslatableParagraphs.php, line 76

Class

ParagraphsEntityTranslationWithNonTranslatableParagraphs
Tests the translation of heavily nested / specialized setup.

Namespace

Drupal\Tests\paragraphs\Functional\WidgetLegacy

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.');
}