X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fparagraphs%2Fsrc%2FTests%2FClassic%2FParagraphsConfigTest.php;fp=web%2Fmodules%2Fcontrib%2Fparagraphs%2Fsrc%2FTests%2FClassic%2FParagraphsConfigTest.php;h=0000000000000000000000000000000000000000;hp=64945433e9a5cb4375c62dcf4dcae89e9990c8cd;hb=059867c3f96750652c80f39e44c442a58c2549ee;hpb=f8fc16ae6b862bef59baaad5d051dd37b7ff11b2
diff --git a/web/modules/contrib/paragraphs/src/Tests/Classic/ParagraphsConfigTest.php b/web/modules/contrib/paragraphs/src/Tests/Classic/ParagraphsConfigTest.php
deleted file mode 100644
index 64945433e..000000000
--- a/web/modules/contrib/paragraphs/src/Tests/Classic/ParagraphsConfigTest.php
+++ /dev/null
@@ -1,240 +0,0 @@
-loginAsAdmin([
- 'administer languages',
- 'administer content translation',
- 'create content translations',
- 'translate any entity',
- ]);
-
- // Add a paragraphed content type.
- $this->addParagraphedContentType('paragraphed_test', 'paragraphs_field', 'entity_reference_paragraphs');
- $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][paragraphs_field]' => FALSE,
- ];
- $this->drupalPostForm('admin/config/regional/content-language', $edit, t('Save configuration'));
-
- // Create a node with a paragraph.
- $this->drupalPostAjaxForm('node/add/paragraphed_test', [], 'paragraphs_field_paragraph_type_test_add_more');
- $edit = ['title[0][value]' => 'paragraphed_title'];
- $this->drupalPostForm(NULL, $edit, t('Save'));
-
- // Attempt to add a translation.
- $node = $this->drupalGetNodeByTitle('paragraphed_title');
- $this->drupalGet('node/' . $node->id() . '/translations');
- $this->clickLink(t('Add'));
- // Save the translation.
- $this->drupalPostForm(NULL, [], t('Save (this translation)'));
- $this->assertText('paragraphed_test paragraphed_title has been updated.');
- }
-
- /**
- * Tests content translation form translatability constraints messages.
- */
- public function testContentTranslationForm() {
- $this->loginAsAdmin([
- 'administer languages',
- 'administer content translation',
- 'create content translations',
- 'translate any entity',
- ]);
-
- // Check warning message is displayed.
- $this->drupalGet('admin/config/regional/content-language');
- $this->assertText('(* unsupported) Paragraphs fields do not support translation.');
-
- $this->addParagraphedContentType('paragraphed_test', 'paragraphs_field', 'entity_reference_paragraphs');
-
- // Check error message is not displayed.
- $this->drupalGet('admin/config/regional/content-language');
- $this->assertText('(* unsupported) Paragraphs fields do not support translation.');
- $this->assertNoRaw('
drupalGet('admin/structure/types/manage/paragraphed_test/fields/node.paragraphed_test.paragraphs_field');
- $this->assertText('Paragraphs fields do not support translation.');
-
- // Make the paragraphs field translatable.
- $edit = [
- 'entity_types[node]' => TRUE,
- 'settings[node][paragraphed_test][translatable]' => TRUE,
- 'settings[node][paragraphed_test][fields][paragraphs_field]' => TRUE,
- ];
- $this->drupalPostForm('admin/config/regional/content-language', $edit, t('Save configuration'));
-
- // Check content type field management error.
- $this->drupalGet('admin/structure/types/manage/paragraphed_test/fields/node.paragraphed_test.paragraphs_field');
- $this->assertText('Paragraphs fields do not support translation.');
- $this->assertRaw('
loginAsAdmin();
-
- // Add a Paragraph content type and 2 Paragraphs types.
- $this->addParagraphedContentType('paragraphed_test', 'paragraphs', 'entity_reference_paragraphs');
- $this->addParagraphsType('paragraph_type_test');
- $this->addParagraphsType('text');
-
- // Make the paragraphs field required and save configuration.
- $this->drupalGet('admin/structure/types/manage/paragraphed_test/fields/node.paragraphed_test.paragraphs');
- $edit = [
- 'required' => TRUE,
- ];
- $this->drupalPostForm(NULL, $edit, 'Save settings');
- $this->assertText('Saved paragraphs configuration.');
-
- // Assert that the field is displayed in the form as required.
- $this->drupalGet('node/add/paragraphed_test');
- $this->assertRaw('');
- $edit = [
- 'title[0][value]' => 'test_title',
- ];
- $this->drupalPostForm(NULL, $edit, t('Save'));
- $this->assertText('paragraphs field is required.');
- $this->drupalPostAjaxForm(NULL, [], 'paragraphs_paragraph_type_test_add_more');
- $this->drupalPostForm(NULL, $edit, t('Save'));
- $this->assertText('paragraphed_test test_title has been created.');
- }
-
- /**
- * Tests that we can use paragraphs widget only for paragraphs.
- */
- public function testAvoidUsingParagraphsWithWrongEntity() {
- $node_type = NodeType::create([
- 'type' => 'article',
- 'name' => 'article',
- ]);
- $node_type->save();
- $this->loginAsAdmin([
- 'edit any article content',
- ]);
- $this->addParagraphsType('paragraphed_type');
-
- // Create reference to node.
- $this->fieldUIAddNewField('admin/structure/types/manage/article', 'node_reference', 'NodeReference', 'entity_reference_revisions', [
- 'cardinality' => 'number',
- 'cardinality_number' => 1,
- 'settings[target_type]' => 'node',
- ], [
- 'settings[handler_settings][target_bundles][article]' => 'article',
- ]);
- $this->drupalGet('admin/structure/types/manage/article/form-display');
- $this->assertNoOption('edit-fields-field-node-reference-type', 'entity_reference_paragraphs');
- $this->assertNoOption('edit-fields-field-node-reference-type', 'paragraphs');
- }
-
- /**
- * Test included Paragraph types.
- */
- public function testIncludedParagraphTypes() {
- $this->loginAsAdmin();
- // Add a Paragraph content type and 2 Paragraphs types.
- $this->addParagraphedContentType('paragraphed_test', 'paragraphs', 'entity_reference_paragraphs');
- $this->addParagraphsType('paragraph_type_test');
- $this->addParagraphsType('text');
-
- $this->drupalGet('admin/structure/types/manage/paragraphed_test/fields/node.paragraphed_test.paragraphs');
- $edit = [
- 'settings[handler_settings][negate]' => 0,
- 'settings[handler_settings][target_bundles_drag_drop][paragraph_type_test][enabled]' => 1,
- ];
- $this->drupalPostForm(NULL, $edit, 'Save settings');
- $this->assertText('Saved paragraphs configuration.');
-
- $this->drupalGet('node/add/paragraphed_test');
- $this->assertText('Add paragraph_type_test');
- $this->assertNoText('Add text');
- }
-
- /**
- * Test excluded Paragraph types.
- */
- public function testExcludedParagraphTypes() {
- $this->loginAsAdmin();
- // Add a Paragraph content type and 2 Paragraphs types.
- $this->addParagraphedContentType('paragraphed_test', 'paragraphs', 'entity_reference_paragraphs');
- $this->addParagraphsType('paragraph_type_test');
- $this->addParagraphsType('text');
-
- $this->drupalGet('admin/structure/types/manage/paragraphed_test/fields/node.paragraphed_test.paragraphs');
- $edit = [
- 'settings[handler_settings][negate]' => 1,
- 'settings[handler_settings][target_bundles_drag_drop][text][enabled]' => 1,
- ];
- $this->drupalPostForm(NULL, $edit, 'Save settings');
- $this->assertText('Saved paragraphs configuration.');
-
- $this->drupalGet('node/add/paragraphed_test');
- $this->assertText('Add paragraph_type_test');
- $this->assertNoText('Add text');
- }
-
-}