diff --git a/core/modules/locale/src/Tests/LocaleUpdateTest.php b/core/modules/locale/src/Tests/LocaleUpdateTest.php index 8e754f9..888d28b 100644 --- a/core/modules/locale/src/Tests/LocaleUpdateTest.php +++ b/core/modules/locale/src/Tests/LocaleUpdateTest.php @@ -21,9 +21,6 @@ class LocaleUpdateTest extends LocaleUpdateBase { */ public static $modules = array('update', 'locale', 'locale_test'); - /** - * {@inheritdoc} - */ public static function getInfo() { return array( 'name' => 'Update translations', @@ -32,20 +29,11 @@ public static function getInfo() { ); } - /** - * {@inheritdoc} - */ - public function setUp() { + function setUp() { parent::setUp(); module_load_include('compare.inc', 'locale'); module_load_include('fetch.inc', 'locale'); - $admin_user = $this->drupalCreateUser(array( - 'administer modules', - 'administer site configuration', - 'administer languages', - 'access administration pages', - 'translate interface', - )); + $admin_user = $this->drupalCreateUser(array('administer modules', 'administer site configuration', 'administer languages', 'access administration pages', 'translate interface')); $this->drupalLogin($admin_user); // We use German as test language. This language must match the translation // file that come with the locale_test module (test.de.po) and can therefore @@ -56,7 +44,7 @@ public function setUp() { /** * Checks if a list of translatable projects gets build. */ - public function testUpdateProjects() { + function testUpdateProjects() { module_load_include('compare.inc', 'locale'); // Make the test modules look like a normal custom module. i.e. make the @@ -69,7 +57,7 @@ public function testUpdateProjects() { $projects = locale_translation_project_list(); $this->assertFalse(isset($projects['locale_test_translate']), 'Hidden module not found'); $this->assertEqual($projects['locale_test']['info']['interface translation server pattern'], 'core/modules/locale/test/test.%language.po', 'Interface translation parameter found in project info.'); - $this->assertEqual($projects['locale_test']['name'], 'locale_test', format_string('%key found in project info.', array('%key' => 'interface translation project'))); + $this->assertEqual($projects['locale_test']['name'] , 'locale_test', format_string('%key found in project info.', array('%key' => 'interface translation project'))); } /** @@ -86,7 +74,7 @@ public function testUpdateProjects() { * the most recent files are selected in the different check scenarios: check * for local files only, check for both local and remote files. */ - public function testUpdateCheckStatus() { + function testUpdateCheckStatus() { // Case when contributed modules are absent. $this->drupalGet('admin/reports/translations'); $this->assertText(t('Missing translations for one project')); @@ -98,8 +86,7 @@ public function testUpdateCheckStatus() { // Create local and remote translations files. $this->setTranslationFiles(); - $config->set('translation.default_filename', '%project-%version.%language._po') - ->save(); + $config->set('translation.default_filename', '%project-%version.%language._po')->save(); // Set the test conditions. $edit = array( @@ -143,12 +130,12 @@ public function testUpdateCheckStatus() { * - Source: remote and local files * - Import overwrite: all existing translations */ - public function testUpdateImportSourceRemote() { + function testUpdateImportSourceRemote() { $config = \Drupal::config('locale.settings'); // Build the test environment. $this->setTranslationFiles(); - $this->setCurrentTranslations(); + $this-> setCurrentTranslations(); $config->set('translation.default_filename', '%project-%version.%language._po'); // Set the update conditions for this test. @@ -205,12 +192,12 @@ public function testUpdateImportSourceRemote() { * - Source: local files only * - Import overwrite: all existing translations */ - public function testUpdateImportSourceLocal() { + function testUpdateImportSourceLocal() { $config = \Drupal::config('locale.settings'); // Build the test environment. $this->setTranslationFiles(); - $this->setCurrentTranslations(); + $this-> setCurrentTranslations(); $config->set('translation.default_filename', '%project-%version.%language._po'); // Set the update conditions for this test. @@ -259,12 +246,12 @@ public function testUpdateImportSourceLocal() { * - Source: remote and local files * - Import overwrite: only overwrite non-customized translations */ - public function testUpdateImportModeNonCustomized() { + function testUpdateImportModeNonCustomized() { $config = \Drupal::config('locale.settings'); // Build the test environment. $this->setTranslationFiles(); - $this->setCurrentTranslations(); + $this-> setCurrentTranslations(); $config->set('translation.default_filename', '%project-%version.%language._po'); // Set the test conditions. @@ -295,12 +282,12 @@ public function testUpdateImportModeNonCustomized() { * - Source: remote and local files * - Import overwrite: don't overwrite any existing translation */ - public function testUpdateImportModeNone() { + function testUpdateImportModeNone() { $config = \Drupal::config('locale.settings'); // Build the test environment. $this->setTranslationFiles(); - $this->setCurrentTranslations(); + $this-> setCurrentTranslations(); $config->set('translation.default_filename', '%project-%version.%language._po'); // Set the test conditions. @@ -327,7 +314,7 @@ public function testUpdateImportModeNone() { /** * Tests automatic translation import when a module is enabled. */ - public function testEnableUninstallModule() { + function testEnableUninstallModule() { // Make the hidden test modules look like a normal custom module. \Drupal::state()->set('locale.test_system_info_alter', TRUE); @@ -342,11 +329,7 @@ public function testEnableUninstallModule() { // Check if translations have been imported. $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', - array( - '%number' => 7, - '%update' => 0, - '%delete' => 0, - )), 'One translation file imported.'); + array('%number' => 7, '%update' => 0, '%delete' => 0)), 'One translation file imported.'); $this->assertTranslation('Tuesday', 'Dienstag', 'de'); $edit = array( @@ -369,7 +352,7 @@ public function testEnableUninstallModule() { * enabled modules and will import them. When a language is removed the system * will remove all translations of that langugue from the database. */ - public function testEnableLanguage() { + function testEnableLanguage() { // Make the hidden test modules look like a normal custom module. \Drupal::state()->set('locale.test_system_info_alter', TRUE); @@ -391,11 +374,7 @@ public function testEnableLanguage() { // Check if the right number of translations are added. $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', - array( - '%number' => 8, - '%update' => 0, - '%delete' => 0, - )), 'One language added.'); + array('%number' => 8, '%update' => 0, '%delete' => 0)), 'One language added.'); $this->assertTranslation('Extraday', 'extra dag', 'nl'); // Check if the language data is added to the database. @@ -417,7 +396,7 @@ public function testEnableLanguage() { /** * Tests automatic translation import when a custom langauge is added. */ - public function testEnableCustomLanguage() { + function testEnableCustomLanguage() { // Make the hidden test modules look like a normal custom module. \Drupal::state()->set('locale.test_system_info_alter', TRUE);