Mercurial > hg > isophonics-drupal-site
comparison core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php @ 18:af1871eacc83
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:33:08 +0100 |
parents | 129ea1e6d783 |
children |
comparison
equal
deleted
inserted
replaced
17:129ea1e6d783 | 18:af1871eacc83 |
---|---|
1 <?php | 1 <?php |
2 | 2 |
3 namespace Drupal\Tests\locale\Functional; | 3 namespace Drupal\Tests\locale\Functional; |
4 | 4 |
5 use Drupal\Core\Url; | |
5 use Drupal\Component\Render\FormattableMarkup; | 6 use Drupal\Component\Render\FormattableMarkup; |
6 | 7 |
7 /** | 8 /** |
8 * Tests for the user interface of project interface translations. | 9 * Tests for the user interface of project interface translations. |
9 * | 10 * |
38 // Check status page and Available translation updates page. | 39 // Check status page and Available translation updates page. |
39 $this->drupalGet('admin/reports/status'); | 40 $this->drupalGet('admin/reports/status'); |
40 $this->assertNoText(t('Translation update status'), 'No status message'); | 41 $this->assertNoText(t('Translation update status'), 'No status message'); |
41 | 42 |
42 $this->drupalGet('admin/reports/translations'); | 43 $this->drupalGet('admin/reports/translations'); |
43 $this->assertRaw(t('No translatable languages available. <a href=":add_language">Add a language</a> first.', [':add_language' => \Drupal::url('entity.configurable_language.collection')]), 'Language message'); | 44 $this->assertRaw(t('No translatable languages available. <a href=":add_language">Add a language</a> first.', [':add_language' => Url::fromRoute('entity.configurable_language.collection')->toString()]), 'Language message'); |
44 | 45 |
45 // Add German language. | 46 // Add German language. |
46 $this->addLanguage('de'); | 47 $this->addLanguage('de'); |
47 | 48 |
48 // Override Drupal core translation status as 'up-to-date'. | 49 // Override Drupal core translation status as 'up-to-date'. |
63 \Drupal::keyValue('locale.translation_status')->set('locale_test_translate', $status['locale_test_translate']); | 64 \Drupal::keyValue('locale.translation_status')->set('locale_test_translate', $status['locale_test_translate']); |
64 | 65 |
65 // Check if updates are available for German. | 66 // Check if updates are available for German. |
66 $this->drupalGet('admin/reports/status'); | 67 $this->drupalGet('admin/reports/status'); |
67 $this->assertText(t('Translation update status'), 'Status message'); | 68 $this->assertText(t('Translation update status'), 'Status message'); |
68 $this->assertRaw(t('Updates available for: @languages. See the <a href=":updates">Available translation updates</a> page for more information.', ['@languages' => t('German'), ':updates' => \Drupal::url('locale.translate_status')]), 'Updates available message'); | 69 $this->assertRaw(t('Updates available for: @languages. See the <a href=":updates">Available translation updates</a> page for more information.', ['@languages' => t('German'), ':updates' => Url::fromRoute('locale.translate_status')->toString()]), 'Updates available message'); |
69 $this->drupalGet('admin/reports/translations'); | 70 $this->drupalGet('admin/reports/translations'); |
70 $this->assertText(t('Updates for: @modules', ['@modules' => 'Locale test translate']), 'Translations available'); | 71 $this->assertText(t('Updates for: @modules', ['@modules' => 'Locale test translate']), 'Translations available'); |
71 | 72 |
72 // Set locale_test_translate module to have a dev release and no | 73 // Set locale_test_translate module to have a dev release and no |
73 // translation found. | 74 // translation found. |
77 \Drupal::keyValue('locale.translation_status')->set('locale_test_translate', $status['locale_test_translate']); | 78 \Drupal::keyValue('locale.translation_status')->set('locale_test_translate', $status['locale_test_translate']); |
78 | 79 |
79 // Check if no updates were found. | 80 // Check if no updates were found. |
80 $this->drupalGet('admin/reports/status'); | 81 $this->drupalGet('admin/reports/status'); |
81 $this->assertText(t('Translation update status'), 'Status message'); | 82 $this->assertText(t('Translation update status'), 'Status message'); |
82 $this->assertRaw(t('Missing translations for: @languages. See the <a href=":updates">Available translation updates</a> page for more information.', ['@languages' => t('German'), ':updates' => \Drupal::url('locale.translate_status')]), 'Missing translations message'); | 83 $this->assertRaw(t('Missing translations for: @languages. See the <a href=":updates">Available translation updates</a> page for more information.', ['@languages' => t('German'), ':updates' => Url::fromRoute('locale.translate_status')->toString()]), 'Missing translations message'); |
83 $this->drupalGet('admin/reports/translations'); | 84 $this->drupalGet('admin/reports/translations'); |
84 $this->assertText(t('Missing translations for one project'), 'No translations found'); | 85 $this->assertText(t('Missing translations for one project'), 'No translations found'); |
85 $release_details = new FormattableMarkup('@module (@version). @info', [ | 86 $release_details = new FormattableMarkup('@module (@version). @info', [ |
86 '@module' => 'Locale test translate', | 87 '@module' => 'Locale test translate', |
87 '@version' => '1.3-dev', | 88 '@version' => '1.3-dev', |
109 \Drupal::keyValue('locale.translation_status')->set('drupal', $status['drupal']); | 110 \Drupal::keyValue('locale.translation_status')->set('drupal', $status['drupal']); |
110 | 111 |
111 // Check if translations are available for Drupal core. | 112 // Check if translations are available for Drupal core. |
112 $this->drupalGet('admin/reports/translations'); | 113 $this->drupalGet('admin/reports/translations'); |
113 $this->assertText(t('Updates for: @project', ['@project' => t('Drupal core')]), 'Translations found'); | 114 $this->assertText(t('Updates for: @project', ['@project' => t('Drupal core')]), 'Translations found'); |
114 $this->assertText(new FormattableMarkup('@module (@date)', ['@module' => t('Drupal core'), '@date' => format_date(REQUEST_TIME, 'html_date')]), 'Core translation update'); | 115 $this->assertText(new FormattableMarkup('@module (@date)', [ |
116 '@module' => t('Drupal core'), | |
117 '@date' => $this->container->get('date.formatter')->format(REQUEST_TIME, 'html_date'), | |
118 ]), 'Core translation update'); | |
115 $update_button = $this->xpath('//input[@type="submit"][@value="' . t('Update translations') . '"]'); | 119 $update_button = $this->xpath('//input[@type="submit"][@value="' . t('Update translations') . '"]'); |
116 $this->assertTrue($update_button, 'Update translations button'); | 120 $this->assertTrue($update_button, 'Update translations button'); |
117 } | 121 } |
118 | 122 |
119 } | 123 } |