public function ModerationLocaleTest::testNewTranslationSourceValues in Drupal 8
Same name and namespace in other branches
- 9 core/modules/content_moderation/tests/src/Functional/ModerationLocaleTest.php \Drupal\Tests\content_moderation\Functional\ModerationLocaleTest::testNewTranslationSourceValues()
Checks that new translation values are populated properly.
File
- core/
modules/ content_moderation/ tests/ src/ Functional/ ModerationLocaleTest.php, line 410
Class
- ModerationLocaleTest
- Test content_moderation functionality with localization and translation.
Namespace
Drupal\Tests\content_moderation\FunctionalCode
public function testNewTranslationSourceValues() {
// Create a published article in Italian (revision 1).
$this
->drupalGet('node/add/article');
$node = $this
->submitNodeForm('Test 1.1 IT', 'published', TRUE, 'it');
$this
->assertNotLatestVersionPage($node);
// Create a new draft (revision 2).
$this
->drupalGet($node
->toUrl('edit-form'));
$this
->submitNodeForm('Test 1.2 IT', 'draft', TRUE);
$this
->assertLatestVersionPage($node);
// Create an English draft (revision 3) and verify that the Italian draft
// values are used as source values.
$url = $node
->toUrl('drupal:content-translation-add');
$url
->setRouteParameter('source', 'it');
$url
->setRouteParameter('target', 'en');
$this
->drupalGet($url);
$this
->assertSession()
->pageTextContains('Test 1.2 IT');
$this
->submitNodeForm('Test 1.3 EN', 'draft');
$this
->assertLatestVersionPage($node);
// Create a French draft (without saving) and verify that the Italian draft
// values are used as source values.
$url
->setRouteParameter('target', 'fr');
$this
->drupalGet($url);
$this
->assertSession()
->pageTextContains('Test 1.2 IT');
// Now switch source language and verify that the English draft values are
// used as source values.
$url
->setRouteParameter('source', 'en');
$this
->drupalGet($url);
$this
->assertSession()
->pageTextContains('Test 1.3 EN');
}