Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/comment/tests/src/Functional/CommentTranslationUITest.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | a9cd425dd02b |
children |
comparison
equal
deleted
inserted
replaced
4:a9cd425dd02b | 5:12f9dff5fda9 |
---|---|
36 'session', | 36 'session', |
37 'theme', | 37 'theme', |
38 'timezone', | 38 'timezone', |
39 'url.query_args:_wrapper_format', | 39 'url.query_args:_wrapper_format', |
40 'url.query_args.pagers:0', | 40 'url.query_args.pagers:0', |
41 'url.site', | |
41 'user.permissions', | 42 'user.permissions', |
42 'user.roles', | 43 'user.roles', |
43 ]; | 44 ]; |
44 | 45 |
45 /** | 46 /** |
132 | 133 |
133 // Unpublish translations. | 134 // Unpublish translations. |
134 foreach ($this->langcodes as $index => $langcode) { | 135 foreach ($this->langcodes as $index => $langcode) { |
135 if ($index > 0) { | 136 if ($index > 0) { |
136 $edit = ['status' => 0]; | 137 $edit = ['status' => 0]; |
137 $url = $entity->urlInfo('edit-form', ['language' => ConfigurableLanguage::load($langcode)]); | 138 $url = $entity->toUrl('edit-form', ['language' => ConfigurableLanguage::load($langcode)]); |
138 $this->drupalPostForm($url, $edit, $this->getFormSubmitAction($entity, $langcode)); | 139 $this->drupalPostForm($url, $edit, $this->getFormSubmitAction($entity, $langcode)); |
139 $storage->resetCache(); | 140 $storage->resetCache(); |
140 $entity = $storage->load($this->entityId); | 141 $entity = $storage->load($this->entityId); |
141 $this->assertFalse($this->manager->getTranslationMetadata($entity->getTranslation($langcode))->isPublished(), 'The translation has been correctly unpublished.'); | 142 $this->assertFalse($this->manager->getTranslationMetadata($entity->getTranslation($langcode))->isPublished(), 'The translation has been correctly unpublished.'); |
142 } | 143 } |
154 $languages = $this->container->get('language_manager')->getLanguages(); | 155 $languages = $this->container->get('language_manager')->getLanguages(); |
155 $values = []; | 156 $values = []; |
156 | 157 |
157 // Post different authoring information for each translation. | 158 // Post different authoring information for each translation. |
158 foreach ($this->langcodes as $langcode) { | 159 foreach ($this->langcodes as $langcode) { |
159 $url = $entity->urlInfo('edit-form', ['language' => $languages[$langcode]]); | 160 $url = $entity->toUrl('edit-form', ['language' => $languages[$langcode]]); |
160 $user = $this->drupalCreateUser(); | 161 $user = $this->drupalCreateUser(); |
161 $values[$langcode] = [ | 162 $values[$langcode] = [ |
162 'uid' => $user->id(), | 163 'uid' => $user->id(), |
163 'created' => REQUEST_TIME - mt_rand(0, 1000), | 164 'created' => REQUEST_TIME - mt_rand(0, 1000), |
164 ]; | 165 ]; |
166 /** @var \Drupal\Core\Datetime\DateFormatterInterface $date_formatter */ | |
167 $date_formatter = $this->container->get('date.formatter'); | |
165 $edit = [ | 168 $edit = [ |
166 'uid' => $user->getUsername() . ' (' . $user->id() . ')', | 169 'uid' => $user->getAccountName() . ' (' . $user->id() . ')', |
167 'date[date]' => format_date($values[$langcode]['created'], 'custom', 'Y-m-d'), | 170 'date[date]' => $date_formatter->format($values[$langcode]['created'], 'custom', 'Y-m-d'), |
168 'date[time]' => format_date($values[$langcode]['created'], 'custom', 'H:i:s'), | 171 'date[time]' => $date_formatter->format($values[$langcode]['created'], 'custom', 'H:i:s'), |
169 ]; | 172 ]; |
170 $this->drupalPostForm($url, $edit, $this->getFormSubmitAction($entity, $langcode)); | 173 $this->drupalPostForm($url, $edit, $this->getFormSubmitAction($entity, $langcode)); |
171 } | 174 } |
172 | 175 |
173 $storage->resetCache([$this->entityId]); | 176 $storage->resetCache([$this->entityId]); |
208 | 211 |
209 foreach ($this->langcodes as $langcode) { | 212 foreach ($this->langcodes as $langcode) { |
210 // We only want to test the title for non-english translations. | 213 // We only want to test the title for non-english translations. |
211 if ($langcode != 'en') { | 214 if ($langcode != 'en') { |
212 $options = ['language' => $languages[$langcode]]; | 215 $options = ['language' => $languages[$langcode]]; |
213 $url = $entity->urlInfo('edit-form', $options); | 216 $url = $entity->toUrl('edit-form', $options); |
214 $this->drupalGet($url); | 217 $this->drupalGet($url); |
215 | 218 |
216 $title = t('Edit @type @title [%language translation]', [ | 219 $title = t('Edit @type @title [%language translation]', [ |
217 '@type' => $this->entityTypeId, | 220 '@type' => $this->entityTypeId, |
218 '@title' => $entity->getTranslation($langcode)->label(), | 221 '@title' => $entity->getTranslation($langcode)->label(), |