12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
- /**
- * @file
- * Contains L10nUpdateInterfaceTest.
- */
- /**
- * Tests for the l10n_update status user interfaces.
- */
- class L10nUpdateInterfaceTest extends L10nUpdateTestBase {
- public static function getInfo() {
- return array(
- 'name' => 'Update translations user interface',
- 'description' => 'Tests for the user interface of project interface translations.',
- 'group' => 'Localization Update',
- );
- }
- 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.
- */
- function testInterface() {
- // Enable the module this test uses for its translations.
- module_enable(array('l10n_update_test_translate'));
- // No language added.
- // Check status page and Available translation updates 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';
- variable_set('l10n_update_translation_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';
- variable_set('l10n_update_translation_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">Available translation updates</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 = '';
- variable_set('l10n_update_translation_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">Available translation updates</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');
- }
- }
|