Upgraded imagemagick and manually altered pdf to image module to handle changes....
[yaffs-website] / web / modules / contrib / paragraphs / src / Tests / Experimental / ParagraphsExperimentalEntityTranslationWithNonTranslatableParagraphs.php
1 <?php
2
3 namespace Drupal\paragraphs\Tests\Experimental;
4
5 /**
6  * Tests the translation of heavily nested / specialized setup.
7  *
8  * @group paragraphs
9  */
10 class ParagraphsExperimentalEntityTranslationWithNonTranslatableParagraphs extends ParagraphsExperimentalTestBase {
11
12   /**
13    * Modules to enable.
14    *
15    * @var array
16    */
17   public static $modules = [
18     'language',
19     'content_translation',
20   ];
21
22   /**
23    * {@inheritdoc}
24    */
25   protected function setUp() {
26     parent::setUp();
27
28     $this->admin_user = $this->drupalCreateUser([], NULL, TRUE);
29     $this->drupalLogin($this->admin_user);
30
31     // Add a languages.
32     $edit = array(
33       'predefined_langcode' => 'de',
34     );
35     $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
36     $edit = array(
37       'predefined_langcode' => 'fr',
38     );
39     $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
40
41     // Create article content type with a paragraphs field.
42     $this->addParagraphedContentType('article', 'field_paragraphs');
43     $this->drupalGet('admin/structure/types/manage/article');
44     // Make content type translatable.
45     $edit = array(
46       'language_configuration[content_translation]' => TRUE,
47     );
48     $this->drupalPostForm('admin/structure/types/manage/article', $edit, t('Save content type'));
49     $this->drupalGet('admin/structure/types/manage/article');
50
51     // Ensue the paragraphs field itself isn't translatable - this would be a
52     // currently not supported configuration otherwise.
53     $edit = array(
54       'translatable' => FALSE,
55     );
56     $this->drupalPostForm('admin/structure/types/manage/article/fields/node.article.field_paragraphs', $edit, t('Save settings'));
57
58     // Add Paragraphs type.
59     $this->addParagraphsType('test_paragraph_type');
60     // Configure Paragraphs type.
61     static::fieldUIAddNewField('admin/structure/paragraphs_type/test_paragraph_type', 'text', 'Text', 'string', [
62       'cardinality' => '-1',
63     ]);
64
65     // Just for verbose-sake - check the content language settings.
66     $this->drupalGet('admin/config/regional/content-language');
67   }
68
69   /**
70    * Tests the revision of paragraphs.
71    */
72   public function testParagraphsIEFTranslation() {
73     $this->drupalLogin($this->admin_user);
74
75     // Create node with one paragraph.
76     $this->drupalGet('node/add/article');
77
78     // Set the values and save.
79     $edit = [
80       'title[0][value]' => 'Title English',
81     ];
82     $this->drupalPostForm(NULL, $edit, t('Save'));
83
84     // Add french translation.
85     $this->clickLink(t('Translate'));
86     $this->clickLink(t('Add'), 1);
87     // Make sure that the original paragraph text is displayed.
88     $this->assertText('Title English');
89
90     $edit = array(
91       'title[0][value]' => 'Title French',
92     );
93     $this->drupalPostForm(NULL, $edit, t('Save (this translation)'));
94     $this->assertText('article Title French has been updated.');
95
96     // Add german translation.
97     $this->clickLink(t('Translate'));
98     $this->clickLink(t('Add'));
99     // Make sure that the original paragraph text is displayed.
100     $this->assertText('Title English');
101
102     $edit = array(
103       'title[0][value]' => 'Title German',
104     );
105     $this->drupalPostForm(NULL, $edit, t('Save (this translation)'));
106     $this->assertText('article Title German has been updated.');
107   }
108
109 }