public function ParagraphsConfigTest::testFieldTranslationDisabled in Paragraphs 8
Same name in this branch
- 8 tests/src/Functional/WidgetLegacy/ParagraphsConfigTest.php \Drupal\Tests\paragraphs\Functional\WidgetLegacy\ParagraphsConfigTest::testFieldTranslationDisabled()
- 8 tests/src/Functional/WidgetStable/ParagraphsConfigTest.php \Drupal\Tests\paragraphs\Functional\WidgetStable\ParagraphsConfigTest::testFieldTranslationDisabled()
Tests adding paragraphs with no translation enabled.
File
- tests/
src/ Functional/ WidgetStable/ ParagraphsConfigTest.php, line 27
Class
- ParagraphsConfigTest
- Tests paragraphs configuration.
Namespace
Drupal\Tests\paragraphs\Functional\WidgetStableCode
public function testFieldTranslationDisabled() {
$this
->loginAsAdmin([
'administer languages',
'administer content translation',
'create content translations',
'translate any entity',
]);
// Add a paragraphed content type.
$this
->addParagraphedContentType('paragraphed_test');
$this
->addParagraphsType('paragraph_type_test');
$this
->addParagraphsType('text');
// Add a second language.
ConfigurableLanguage::create([
'id' => 'de',
])
->save();
// Enable translation for paragraphed content type. Do not enable
// translation for the ERR paragraphs field nor for fields on the
// paragraph type.
$edit = [
'entity_types[node]' => TRUE,
'settings[node][paragraphed_test][translatable]' => TRUE,
'settings[node][paragraphed_test][fields][field_paragraphs]' => FALSE,
];
$this
->drupalGet('admin/config/regional/content-language');
$this
->submitForm($edit, 'Save configuration');
// Create a node with a paragraph.
$this
->drupalGet('node/add/paragraphed_test');
$this
->submitForm([], 'field_paragraphs_paragraph_type_test_add_more');
$edit = [
'title[0][value]' => 'paragraphed_title',
];
$this
->submitForm($edit, 'Save');
// Attempt to add a translation.
$node = $this
->drupalGetNodeByTitle('paragraphed_title');
$this
->drupalGet('node/' . $node
->id() . '/translations');
$this
->clickLink('Add');
// Save the translation.
$this
->submitForm([], 'Save (this translation)');
$this
->assertSession()
->pageTextContains('paragraphed_test paragraphed_title has been updated.');
}