Skip to content
Snippets Groups Projects
Unverified Commit f86f182a authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3096570 by recrit, raman.b, ameymudras, ranjith_kumar_k_u, Oscaner,...

Issue #3096570 by recrit, raman.b, ameymudras, ranjith_kumar_k_u, Oscaner, smustgrave, peterwcm, pameeela: Redirect correct language page after node save

(cherry picked from commit 6c01bb31)
parent 045cc0e4
No related branches found
No related tags found
13 merge requests!12227Issue #3181946 by jonmcl, mglaman,!12079Issue #3523476 by matthiasm11: Add empty check on operator,!12024Fix: DocBlock comment for return value of Drupal\Core\Database\Connection::transactionManager(),!11974Draft: Issue #3495165 by catch, joeyroth, berdir, texas-bronius: Better warning...,!11934Issue #3520997: DefaultLazyPluginCollection unnecessarily instantiates plugins when sorting collection,!11887Issue #3520065: The migrate Row class API is incomplete,!11636Draft: Issue #3515643 by macsim: fieldNameExists method is inconsistent,!11515Issue #3480419 by mondrake, smustgrave, catch: Method...,!11380Issue #3490698 by catch, spokje: Bump MINIMUM_STABILITY back to 'stable' when...,!11281Use Drupal Core Leadership terminology in MAINTAINERS.txt,!11239Issue #3507548: Allow workspace changes listing to show all items, without a pager,!11238Fix issue #3051797,!11213Issue #3506743 by tomislav.matokovic: Increasing the color contrast for the navigation block title against the background of the navigation sidebar to at least 4.5:1
Pipeline #421106 passed
Pipeline: drupal

#421108

    ......@@ -119,12 +119,12 @@ public function testSyncedImages(): void {
    $this->submitForm($edit, 'Save (this translation)');
    // This inspects the HTML after the post of the translation, the image
    // should be displayed on the original node.
    $this->assertSession()->responseContains('alt="Lost in translation image"');
    $this->assertSession()->responseContains('title="Lost in translation image title"');
    $second_fid = $this->getLastFileId();
    // View the translated node.
    $this->drupalGet('fr/node/' . $default_language_node->id());
    $this->assertSession()->responseContains('alt="Scarlett Johansson image"');
    $this->assertSession()->responseContains('title="Scarlett Johansson image title"');
    $second_fid = $this->getLastFileId();
    // View the untranslated node.
    $this->drupalGet('node/' . $default_language_node->id());
    $this->assertSession()->responseContains('alt="Lost in translation image"');
    \Drupal::entityTypeManager()->getStorage('file')->resetCache();
    ......@@ -159,12 +159,12 @@ public function testSyncedImages(): void {
    $this->assertTrue($file->isPermanent(), 'First file still exists and is permanent.');
    // This inspects the HTML after the post of the translation, the image
    // should be displayed on the original node.
    $this->assertSession()->responseContains('alt="Lost in translation image"');
    $this->assertSession()->responseContains('title="Lost in translation image title"');
    // View the translated node.
    $this->drupalGet('nl/node/' . $default_language_node->id());
    $this->assertSession()->responseContains('alt="Ada Lovelace image"');
    $this->assertSession()->responseContains('title="Ada Lovelace image title"');
    // View untranslated node.
    $this->drupalGet('node/' . $default_language_node->id());
    $this->assertSession()->responseContains('alt="Lost in translation image"');
    $this->assertSession()->responseContains('title="Lost in translation image title"');
    // Ensure the file status of the second file is permanent.
    $file = File::load($second_fid);
    ......
    ......@@ -298,7 +298,8 @@ public function save(array $form, FormStateInterface $form_state) {
    if ($node->access('view')) {
    $form_state->setRedirect(
    'entity.node.canonical',
    ['node' => $node->id()]
    ['node' => $node->id()],
    ['language' => $node->language()]
    );
    }
    else {
    ......
    ......@@ -675,4 +675,31 @@ public function testSearchIndexRebuildOnTranslationDeletion(): void {
    $this->assertSession()->pageTextNotContains('First rev fr title');
    }
    /**
    * Tests redirection after saving translation.
    */
    public function testRedirect(): void {
    $this->drupalLogin($this->administrator);
    $article = $this->drupalCreateNode(['type' => 'article', 'langcode' => $this->langcodes[0]]);
    $edit = [
    'title[0][value]' => 'English node title',
    ];
    $this->drupalGet('node/' . $article->id() . '/edit');
    $this->submitForm($edit, 'Save');
    $this->assertSession()->pageTextContains('English node title');
    $this->assertEquals($this->baseUrl . '/node/' . $article->id(), $this->getSession()->getCurrentUrl());
    $this->drupalGet('node/' . $article->id() . '/translations/add/' . $this->langcodes[0] . '/' . $this->langcodes[1]);
    $edit = [
    'title[0][value]' => 'Italian node title',
    ];
    $this->submitForm($edit, 'Save (this translation)');
    $this->assertSession()->pageTextContains('Italian node title');
    $this->assertEquals($this->baseUrl . '/' . $this->langcodes[1] . '/node/' . $article->id(), $this->getSession()->getCurrentUrl());
    }
    }
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment