diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleCompareUnitTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleCompareTest.php similarity index 89% rename from core/modules/locale/lib/Drupal/locale/Tests/LocaleCompareUnitTest.php rename to core/modules/locale/lib/Drupal/locale/Tests/LocaleCompareTest.php index 27cd348..d545b1c 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleCompareUnitTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleCompareTest.php @@ -12,7 +12,10 @@ use Drupal\simpletest\WebTestBase; /** * Tests for comparing status of existing project translations with available translations. */ -class LocaleCompareUnitTest extends WebTestBase { +class LocaleCompareTest extends WebTestBase { + + protected static $modules = array('update', 'locale', 'locale_test'); + public static function getInfo() { return array( 'name' => 'Compare project states', @@ -21,21 +24,14 @@ class LocaleCompareUnitTest extends WebTestBase { ); } - function setUp() { - parent::setUp(array('update', 'locale', 'locale_test')); - - // Create Article node type. - $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article')); - - // Create and login user. - $admin_user = $this->drupalCreateUser(array('administer site configuration', 'administer languages', 'access administration pages', 'create article content')); - $this->drupalLogin($admin_user); - } - /** - * Unit tests for translation status storage and translation status compare. + * Tets for translation status storage and translation status compare. */ function testLocaleCompare() { + // Create and login user. + $admin_user = $this->drupalCreateUser(array('administer site configuration', 'administer languages', 'access administration pages')); + $this->drupalLogin($admin_user); + module_load_include('compare.inc', 'locale'); // Check if hidden modules are not included. diff --git a/core/modules/locale/locale.api.php b/core/modules/locale/locale.api.php index f5e5955..e1ad3a1 100644 --- a/core/modules/locale/locale.api.php +++ b/core/modules/locale/locale.api.php @@ -30,8 +30,7 @@ function hook_locale_translation_projects_alter(&$projects) { } /** - * Allows modules and themes to define or alter project definitions for - * interface translation. + * Allows to define or alter project definitions for interface translation. * * Themes can implement this hook too in their template.php file. * @@ -42,7 +41,7 @@ function hook_locale_translation_additional_project_info() { // If your custom module contains new strings the Locale interface translation // can be configured to recognize and import the translations. // The tanslations can be located in the local file system or remotely in a - // translation server (similar to localization.drupal.org). + // translation server (similar to localize.drupal.org). // Required: type. "project" is required if the "example_project" is a custom // module and not a contributed module. @@ -83,8 +82,7 @@ function hook_locale_translation_additional_project_info() { ), ); - // Themes can implement this hook too in their template.php file (but only - // in this file!). + // Themes can implement this hook too. $projects['zen'] = array( 'type' => 'theme', 'info' => array( diff --git a/core/modules/locale/locale.compare.inc b/core/modules/locale/locale.compare.inc index 644a73a..10bfaa7 100644 --- a/core/modules/locale/locale.compare.inc +++ b/core/modules/locale/locale.compare.inc @@ -2,7 +2,7 @@ /** * @file - * The API for comparing project translation status with available translation. + * The API for comparing project translation status with available translation. */ /** @@ -64,8 +64,6 @@ function locale_translation_flush_projects() { /** * Build list of projects and stores the result in the database. - * - * Based on l10n_update_build_projects(). */ function locale_translation_build_projects() { // This function depends on Update module. We degrade gracefully. @@ -76,6 +74,8 @@ function locale_translation_build_projects() { // Get the project list based on .info files. $projects = locale_translation_project_list(); + $transaction = db_transaction(); + // Mark all previous projects as disabled and store new project data. db_update('locale_project') ->fields(array( @@ -165,7 +165,7 @@ function locale_translation_build_projects() { /** * Fetch an array of projects for translation update. * - * @return + * @return array * Array of project data including .info file data. */ function locale_translation_project_list() { @@ -211,12 +211,12 @@ function locale_translation_project_list() { * project = myproject" in its .info file. This function will add a project * "myproject" to the info data. * - * @param $data + * @param array $data * Array of .info file data. - * @param $type + * @param string $type * The project type. i.e. module, theme. * - * @return + * @return array * Array of .info file data. */ function _locale_translation_prepare_project_list($data, $type) { @@ -250,15 +250,15 @@ function _locale_translation_prepare_project_list($data, $type) { /** * Fetch additional project definitions and definition overrides. * - * @return - * Array of custom project. + * @return array + * Array of custom projects. * * @see hook_locale_translation_additional_project_info(). */ function locale_translation_get_additional_projects() { $projects = &drupal_static(__FUNCTION__, array()); - if (empty($projects)) { + if (empty($projects)) { $hook = 'locale_translation_additional_project_info'; // Call hook_locale_translation_additional_project_info for modules. @@ -283,11 +283,11 @@ function locale_translation_get_additional_projects() { /** * Retrieve data for default server. * - * @return + * @return array * Array of server parameters: * - "server": Localization server name * - "server_url": Localization server URL where language list can be - * retrieved. + * retrieved. * - "server_pattern": URL containing po file pattern. */ // @todo: Rework the individual vars to a hook_locale_translation_server_info() with sets of server definitions? @@ -307,14 +307,14 @@ function locale_translation_default_translation_server() { * information or just the URL. * - From server_url in a project, we'll fetch the latest data from the server. * - * @param $name + * @param string $name * Server name e.g. localize.drupal.org - * @param $url + * @param string $url * Server url - * @param $refresh + * @param bool $refresh * TRUE = refresh the server data. * - * @return + * @return array * Array of server data. */ function locale_translation_translation_servers($name = NULL, $url = NULL, $refresh = FALSE) { @@ -329,11 +329,11 @@ function locale_translation_translation_servers($name = NULL, $url = NULL, $refr if (!$url && $name && isset($server_list[$name])) { $url = $server_list[$name]['server_url']; } - // If we still don't have an url, cannot find this server, return false. + // If we still don't have a URL, cannot find this server, return false. if (!$url) { return FALSE; } - // Cache server information based on the url, refresh if asked. + // Cache server information based on the URL, refresh if asked. $cid = 'interface_translation_server:' . $url; if ($refresh) { unset($info); @@ -376,10 +376,10 @@ function locale_translation_translation_servers($name = NULL, $url = NULL, $refr /** * Build path to translation source, out of a server path replacement pattern. * - * @param $project + * @param stdClass $project * Project object containing data to be inserted in the template. - * @param $template - * String containing place holders. Available place holders: + * @param string $template + * String containing place holders. Available placeholders: * - "%project": Project name. * - "%version": Poject version. * - "%core": Project core version. diff --git a/core/modules/locale/locale.install b/core/modules/locale/locale.install index a0b8415..fc9d4a0 100644 --- a/core/modules/locale/locale.install +++ b/core/modules/locale/locale.install @@ -654,7 +654,7 @@ function locale_update_8009() { /** * Add {locale_file} table. */ -function locale_update_8010() { +function locale_update_8011() { $table = array( 'description' => 'File import status information for interface translation files.', 'fields' => array( diff --git a/core/modules/locale/tests/modules/locale_test/locale_test.module b/core/modules/locale/tests/modules/locale_test/locale_test.module index 4504df0..bb47741 100644 --- a/core/modules/locale/tests/modules/locale_test/locale_test.module +++ b/core/modules/locale/tests/modules/locale_test/locale_test.module @@ -40,5 +40,5 @@ function locale_test_locale_translation_additional_project_info() { ), ); - return $projects; + return $projects; } diff --git a/core/modules/locale/tests/modules/locale_test_disabled/locale_test_disabled.module b/core/modules/locale/tests/modules/locale_test_disabled/locale_test_disabled.module index 5ceb07b..a80d9da 100644 --- a/core/modules/locale/tests/modules/locale_test_disabled/locale_test_disabled.module +++ b/core/modules/locale/tests/modules/locale_test_disabled/locale_test_disabled.module @@ -2,6 +2,5 @@ /** * @file - * Simulate a disabled contrib for Locale test scripts. - * Further, nothing to do here. + * Simulate a disabled contrib for Locale test scripts. */