123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- <?php
- /**
- * @file
- * Contains L10nUpdateInterfaceTest.
- */
- /**
- * Tests for the l10n_update status user interfaces.
- */
- class L10nUpdateInterfaceTest extends L10nUpdateTestBase {
- /**
- * {@inheritdoc}
- */
- public static function getInfo() {
- return array(
- 'name' => 'Update translations user interface',
- 'description' => 'Tests for the user interface of project interface translations.',
- 'group' => 'Localization Update',
- );
- }
- /**
- * {@inheritdoc}
- */
- public function setUp() {
- parent::setUp();
- $admin_user = $this->drupalCreateUser(array('administer modules', 'administer site configuration', 'administer languages', 'access administration pages', 'translate interface'));
- $this->drupalLogin($admin_user);
- }
- /**
- * Tests the user interfaces of the interface translation update system.
- *
- * Testing the Available updates summary on the side wide status page and the
- * Avaiable translation updates page.
- */
- public function testInterface() {
- // Enable the module this test uses for its translations.
- module_enable(array('l10n_update_test_translate'));
- // Exclude l10n_update so no remote translations are fetched.
- $edit = array(
- 'disabled_projects' => "l10n_update",
- );
- $this->drupalPost('admin/config/regional/language/update', $edit, t('Save configuration'));
- // No language added.
- // Check status page and Translate interface update page.
- $this->drupalGet('admin/reports/status');
- $this->assertNoText(t('Translation update status'), 'No status message');
- $this->drupalGet('admin/config/regional/translate/update');
- $this->assertRaw(t('No translatable languages available. <a href="@add_language">Add a language</a> first.', array('@add_language' => url('admin/config/regional/language'))), 'Language message');
- // Add German language.
- $this->addLanguage('de');
- // Drupal core is probably in 7.x, but tests may also be executed with
- // stable releases. As this is an uncontrolled factor in the test, we will
- // mark Drupal core as translated and continue with the prepared modules.
- $status = l10n_update_get_status();
- $status['drupal']['de']->type = 'current';
- cache_set('l10n_update_status', $status);
- // One language added, all translations up to date.
- $this->drupalGet('admin/reports/status');
- $this->assertText(t('Translation update status'), 'Status message');
- $this->assertText(t('Up to date'), 'Translations up to date');
- $this->drupalGet('admin/config/regional/translate/update');
- $this->assertText(t('All translations up to date.'), 'Translations up to date');
- // Set l10n_update_test_translate module to have a local translation
- // available.
- $status = l10n_update_get_status();
- $status['l10n_update_test_translate']['de']->type = 'local';
- cache_set('l10n_update_status', $status);
- // Check if updates are available for German.
- $this->drupalGet('admin/reports/status');
- $this->assertText(t('Translation update status'), 'Status message');
- $this->assertRaw(t('Updates available for: @languages. See the <a href="@updates">Translate interface update</a> page for more information.', array('@languages' => t('German'), '@updates' => url('admin/config/regional/translate/update'))), 'Updates available message');
- $this->drupalGet('admin/config/regional/translate/update');
- $this->assertText(t('Updates for: @modules', array('@modules' => 'Localization Update test translate')), 'Translations avaiable');
- // Set l10n_update_test_translate module to have a dev release and no
- // translation found.
- $status = l10n_update_get_status();
- $status['l10n_update_test_translate']['de']->version = '1.3-dev';
- $status['l10n_update_test_translate']['de']->type = '';
- cache_set('l10n_update_status', $status);
- // Check if no updates were found.
- $this->drupalGet('admin/reports/status');
- $this->assertText(t('Translation update status'), 'Status message');
- $this->assertRaw(t('Missing translations for: @languages. See the <a href="@updates">Translate interface update</a> page for more information.', array('@languages' => t('German'), '@updates' => url('admin/config/regional/translate/update'))), 'Missing translations message');
- $this->drupalGet('admin/config/regional/translate/update');
- $this->assertText(t('Missing translations for one project'), 'No translations found');
- $this->assertText(t('@module (@version).', array('@module' => 'Localization Update test translate', '@version' => '1.3-dev')), 'Release details');
- $this->assertText(t('No translation files are provided for development releases.'), 'Release info');
- }
- }
|