comparison core/modules/image/src/Tests/ImageOnTranslatedEntityTest.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
93 $default_language_node = $this->drupalCreateNode(['type' => 'basicpage', 'title' => 'Lost in translation']); 93 $default_language_node = $this->drupalCreateNode(['type' => 'basicpage', 'title' => 'Lost in translation']);
94 94
95 // Edit the node to upload a file. 95 // Edit the node to upload a file.
96 $edit = []; 96 $edit = [];
97 $name = 'files[' . $this->fieldName . '_0]'; 97 $name = 'files[' . $this->fieldName . '_0]';
98 $edit[$name] = drupal_realpath($this->drupalGetTestFiles('image')[0]->uri); 98 $edit[$name] = \Drupal::service('file_system')->realpath($this->drupalGetTestFiles('image')[0]->uri);
99 $this->drupalPostForm('node/' . $default_language_node->id() . '/edit', $edit, t('Save')); 99 $this->drupalPostForm('node/' . $default_language_node->id() . '/edit', $edit, t('Save'));
100 $edit = [$this->fieldName . '[0][alt]' => 'Lost in translation image', $this->fieldName . '[0][title]' => 'Lost in translation image title']; 100 $edit = [$this->fieldName . '[0][alt]' => 'Lost in translation image', $this->fieldName . '[0][title]' => 'Lost in translation image title'];
101 $this->drupalPostForm(NULL, $edit, t('Save')); 101 $this->drupalPostForm(NULL, $edit, t('Save'));
102 $first_fid = $this->getLastFileId(); 102 $first_fid = $this->getLastFileId();
103 103
106 106
107 // Upload a different file. 107 // Upload a different file.
108 $edit = []; 108 $edit = [];
109 $edit['title[0][value]'] = 'Scarlett Johansson'; 109 $edit['title[0][value]'] = 'Scarlett Johansson';
110 $name = 'files[' . $this->fieldName . '_0]'; 110 $name = 'files[' . $this->fieldName . '_0]';
111 $edit[$name] = drupal_realpath($this->drupalGetTestFiles('image')[1]->uri); 111 $edit[$name] = \Drupal::service('file_system')->realpath($this->drupalGetTestFiles('image')[1]->uri);
112 $this->drupalPostForm(NULL, $edit, t('Save (this translation)')); 112 $this->drupalPostForm(NULL, $edit, t('Save (this translation)'));
113 $edit = [$this->fieldName . '[0][alt]' => 'Scarlett Johansson image', $this->fieldName . '[0][title]' => 'Scarlett Johansson image title']; 113 $edit = [$this->fieldName . '[0][alt]' => 'Scarlett Johansson image', $this->fieldName . '[0][title]' => 'Scarlett Johansson image title'];
114 $this->drupalPostForm(NULL, $edit, t('Save (this translation)')); 114 $this->drupalPostForm(NULL, $edit, t('Save (this translation)'));
115 // This inspects the HTML after the post of the translation, the image 115 // This inspects the HTML after the post of the translation, the image
116 // should be displayed on the original node. 116 // should be displayed on the original node.
138 138
139 // Upload a different file. 139 // Upload a different file.
140 $edit = []; 140 $edit = [];
141 $edit['title[0][value]'] = 'Akiko Takeshita'; 141 $edit['title[0][value]'] = 'Akiko Takeshita';
142 $name = 'files[' . $this->fieldName . '_0]'; 142 $name = 'files[' . $this->fieldName . '_0]';
143 $edit[$name] = drupal_realpath($this->drupalGetTestFiles('image')[2]->uri); 143 $edit[$name] = \Drupal::service('file_system')->realpath($this->drupalGetTestFiles('image')[2]->uri);
144 $this->drupalPostForm(NULL, $edit, t('Save (this translation)')); 144 $this->drupalPostForm(NULL, $edit, t('Save (this translation)'));
145 $edit = [$this->fieldName . '[0][alt]' => 'Akiko Takeshita image', $this->fieldName . '[0][title]' => 'Akiko Takeshita image title']; 145 $edit = [$this->fieldName . '[0][alt]' => 'Akiko Takeshita image', $this->fieldName . '[0][title]' => 'Akiko Takeshita image title'];
146 $this->drupalPostForm(NULL, $edit, t('Save (this translation)')); 146 $this->drupalPostForm(NULL, $edit, t('Save (this translation)'));
147 $third_fid = $this->getLastFileId(); 147 $third_fid = $this->getLastFileId();
148 148
173 173
174 // Upload a different file. 174 // Upload a different file.
175 $edit = []; 175 $edit = [];
176 $edit['title[0][value]'] = 'Giovanni Ribisi'; 176 $edit['title[0][value]'] = 'Giovanni Ribisi';
177 $name = 'files[' . $this->fieldName . '_0]'; 177 $name = 'files[' . $this->fieldName . '_0]';
178 $edit[$name] = drupal_realpath($this->drupalGetTestFiles('image')[3]->uri); 178 $edit[$name] = \Drupal::service('file_system')->realpath($this->drupalGetTestFiles('image')[3]->uri);
179 $this->drupalPostForm(NULL, $edit, t('Save (this translation)')); 179 $this->drupalPostForm(NULL, $edit, t('Save (this translation)'));
180 $name = $this->fieldName . '[0][alt]'; 180 $name = $this->fieldName . '[0][alt]';
181 181
182 $edit = [$name => 'Giovanni Ribisi image']; 182 $edit = [$name => 'Giovanni Ribisi image'];
183 $this->drupalPostForm(NULL, $edit, t('Save (this translation)')); 183 $this->drupalPostForm(NULL, $edit, t('Save (this translation)'));