commit 1264d18199362a9885ee9868f9bd59ed48c2567d Author: Erik Stielstra Date: Sat Sep 26 18:20:17 2015 +0200 1832946-locale-update.77.patch diff --git a/core/modules/locale/locale.compare.inc b/core/modules/locale/locale.compare.inc index 092e989..2aa6526 100644 --- a/core/modules/locale/locale.compare.inc +++ b/core/modules/locale/locale.compare.inc @@ -77,7 +77,6 @@ function locale_translation_build_projects() { 'status' => !empty($data['project_status']) ? 1 : 0, ); - $project = (object) $data; $projects[$name] = $project; @@ -99,8 +98,6 @@ function locale_translation_build_projects() { function locale_translation_project_list() { $projects = &drupal_static(__FUNCTION__, array()); if (empty($projects)) { - module_load_include('compare.inc', 'update'); - $config = \Drupal::config('locale.settings'); $projects = array(); $additional_whitelist = array( diff --git a/core/modules/locale/src/Form/TranslationStatusForm.php b/core/modules/locale/src/Form/TranslationStatusForm.php index c28120d..fab5635 100644 --- a/core/modules/locale/src/Form/TranslationStatusForm.php +++ b/core/modules/locale/src/Form/TranslationStatusForm.php @@ -241,11 +241,7 @@ protected function prepareUpdateData(array $status) { protected function createInfoString($project_info) { $remote_path = isset($project_info->files['remote']->uri) ? $project_info->files['remote']->uri : FALSE; $local_path = isset($project_info->files['local']->uri) ? $project_info->files['local']->uri : FALSE; - /* - if (strpos($project_info->version, 'dev') !== FALSE) { - return $this->t('No translation files are provided for development releases.'); - } - */ + if (locale_translation_use_remote_source() && $remote_path && $local_path) { return $this->t('File not found at %remote_path nor at %local_path', array( '%remote_path' => $remote_path, diff --git a/core/modules/locale/src/Tests/LocaleConfigTranslationImportTest.php b/core/modules/locale/src/Tests/LocaleConfigTranslationImportTest.php index a0a8684..17fd2c8 100644 --- a/core/modules/locale/src/Tests/LocaleConfigTranslationImportTest.php +++ b/core/modules/locale/src/Tests/LocaleConfigTranslationImportTest.php @@ -23,7 +23,7 @@ class LocaleConfigTranslationImportTest extends WebTestBase { * * @var array */ - public static $modules = array('language', 'update', 'locale_test_translate'); + public static $modules = array('language', 'locale_test_translate'); /** * {@inheritdoc} diff --git a/core/modules/locale/src/Tests/LocaleUpdateBase.php b/core/modules/locale/src/Tests/LocaleUpdateBase.php index 5f5408b..74edb4a 100644 --- a/core/modules/locale/src/Tests/LocaleUpdateBase.php +++ b/core/modules/locale/src/Tests/LocaleUpdateBase.php @@ -50,7 +50,7 @@ * * @var array */ - public static $modules = array('update', 'update_test', 'locale', 'locale_test'); + public static $modules = array('locale', 'locale_test'); /** * {@inheritdoc} @@ -58,11 +58,6 @@ protected function setUp() { parent::setUp(); - // Update module should not go out to d.o to check for updates. We override - // the url to the default update_test xml path. But without providing - // a mock xml file, no update data will be found. - $this->config('update.settings')->set('fetch.url', Url::fromRoute('update_test.update_test', [], ['absolute' => TRUE])->toString())->save(); - // Setup timestamps to identify old and new translation sources. $this->timestampOld = REQUEST_TIME - 300; $this->timestampMedium = REQUEST_TIME - 200; diff --git a/core/modules/locale/src/Tests/LocaleUpdateDevelopmentReleaseTest.php b/core/modules/locale/src/Tests/LocaleUpdateDevelopmentReleaseTest.php new file mode 100644 index 0000000..09ab884 --- /dev/null +++ b/core/modules/locale/src/Tests/LocaleUpdateDevelopmentReleaseTest.php @@ -0,0 +1,36 @@ +drupalCreateUser(array('administer modules', 'administer languages', 'access administration pages', 'translate interface')); + $this->drupalLogin($admin_user); + $this->drupalPostForm('admin/config/regional/language/add', array('predefined_langcode' => 'hu'), t('Add language')); + } + + public function testLocaleUpdateDevelopmentRelease() { + $projects = locale_translation_build_projects(); + $this->verbose($projects['drupal']->info['version']); + $this->assertEqual($projects['drupal']->info['version'], '8.0.x', 'The branch of the core dev release.'); + $this->verbose($projects['contrib']->info['version']); + $this->assertEqual($projects['contrib']->info['version'], '12.x-10.x', 'The branch of the contrib module dev release.'); + } +} diff --git a/core/modules/locale/src/Tests/LocaleUpdateInterfaceTest.php b/core/modules/locale/src/Tests/LocaleUpdateInterfaceTest.php index a66ff48..0490789 100644 --- a/core/modules/locale/src/Tests/LocaleUpdateInterfaceTest.php +++ b/core/modules/locale/src/Tests/LocaleUpdateInterfaceTest.php @@ -88,7 +88,8 @@ public function testInterface() { $this->drupalGet('admin/reports/translations'); $this->assertText(t('Missing translations for one project'), 'No translations found'); $this->assertText(SafeMarkup::format('@module (@version). @info', array('@module' => 'Locale test translate', '@version' => '1.3-dev', '@info' => t('No translation files are provided for development releases.'))), 'Release details'); - $this->assertText(t('No translation files are provided for development releases.'), 'Release info'); +// @todo Replace by an assertion for the 'branch' URL. +// $this->assertText(t('No translation files are provided for development releases.'), 'Release info'); // Override Drupal core translation status as 'no translations found'. $status = locale_translation_get_status(); diff --git a/core/modules/locale/src/Tests/LocaleUpdateNotDevelopmentReleaseTest.php b/core/modules/locale/src/Tests/LocaleUpdateNotDevelopmentReleaseTest.php deleted file mode 100644 index 0763809..0000000 --- a/core/modules/locale/src/Tests/LocaleUpdateNotDevelopmentReleaseTest.php +++ /dev/null @@ -1,83 +0,0 @@ -drupalCreateUser(array('administer modules', 'administer languages', 'access administration pages', 'translate interface')); - $this->drupalLogin($admin_user); - $this->drupalPostForm('admin/config/regional/language/add', array('predefined_langcode' => 'hu'), t('Add language')); - } - - public function testLocaleUpdateNotDevelopmentRelease() { - // Set available Drupal releases for test. - $available = array( - 'title' => 'Drupal core', - 'short_name' => 'drupal', - 'type' => 'project_core', - 'api_version' => '8.x', - 'project_status' => 'unsupported', - 'link' => 'https://www.drupal.org/project/drupal', - 'terms' => '', - 'releases' => array( - '8.0.0-alpha110' => array( - 'name' => 'drupal 8.0.0-alpha110', - 'version' => '8.0.0-alpha110', - 'tag' => '8.0.0-alpha110', - 'version_major' => '8', - 'version_minor' => '0', - 'version_patch' => '0', - 'version_extra' => 'alpha110', - 'status' => 'published', - 'release_link' => 'https://www.drupal.org/node/2316617', - 'download_link' => 'http://ftp.drupal.org/files/projects/drupal-8.0.0-alpha110.tar.gz', - 'date' => '1407344628', - 'mdhash' => '9d71afdd0ce541f2ff5ca2fbbca00df7', - 'filesize' => '9172832', - 'files' => '', - 'terms' => array(), - ), - '8.0.0-alpha100' => array( - 'name' => 'drupal 8.0.0-alpha100', - 'version' => '8.0.0-alpha100', - 'tag' => '8.0.0-alpha100', - 'version_major' => '8', - 'version_minor' => '0', - 'version_patch' => '0', - 'version_extra' => 'alpha100', - 'status' => 'published', - 'release_link' => 'https://www.drupal.org/node/2316617', - 'download_link' => 'http://ftp.drupal.org/files/projects/drupal-8.0.0-alpha100.tar.gz', - 'date' => '1407344628', - 'mdhash' => '9d71afdd0ce541f2ff5ca2fbbca00df7', - 'filesize' => '9172832', - 'files' => '', - 'terms' => array(), - ), - ), - ); - $available['last_fetch'] = REQUEST_TIME; - \Drupal::keyValueExpirable('update_available_releases')->setWithExpire('drupal', $available, 10); - $projects = locale_translation_build_projects(); - $this->verbose($projects['drupal']->info['version']); - $this->assertEqual($projects['drupal']->info['version'], '8.0.0-alpha110', 'The first release with the same major release number which is not a development release.'); - } -} diff --git a/core/modules/locale/tests/modules/locale_test_development_release/locale_test_development_release.info.yml b/core/modules/locale/tests/modules/locale_test_development_release/locale_test_development_release.info.yml new file mode 100644 index 0000000..fd1481c --- /dev/null +++ b/core/modules/locale/tests/modules/locale_test_development_release/locale_test_development_release.info.yml @@ -0,0 +1,7 @@ +name: 'Locale Test Development Release' +type: module +description: 'Helper module to test the behaviour when the core verison is a development release.' +package: Testing +version: VERSION +core: 8.x +hidden: true diff --git a/core/modules/locale/tests/modules/locale_test_development_release/locale_test_development_release.module b/core/modules/locale/tests/modules/locale_test_development_release/locale_test_development_release.module new file mode 100644 index 0000000..18a1f10 --- /dev/null +++ b/core/modules/locale/tests/modules/locale_test_development_release/locale_test_development_release.module @@ -0,0 +1,42 @@ + 'contrib', + 'info' => array( + 'name' => 'Contributed module', + 'package' => 'Other', + 'version' => '12.x-10.4-unstable11+14-dev', + 'project' => 'contrib_module', + 'datestamp' => '0', + '_info_file_ctime' => 1442933959, + ), + 'datestamp' => '0', + 'project_type' => 'module', + 'project_status' => TRUE, + ]; +} \ No newline at end of file diff --git a/core/modules/locale/tests/modules/locale_test_not_development_release/locale_test_not_development_release.info.yml b/core/modules/locale/tests/modules/locale_test_not_development_release/locale_test_not_development_release.info.yml deleted file mode 100644 index 7acf9a0..0000000 --- a/core/modules/locale/tests/modules/locale_test_not_development_release/locale_test_not_development_release.info.yml +++ /dev/null @@ -1,7 +0,0 @@ -name: 'Locale Test Not Development Release' -type: module -description: 'The first release with the same major release number which is not a development release.' -package: Testing -version: VERSION -core: 8.x -hidden: true diff --git a/core/modules/locale/tests/modules/locale_test_not_development_release/locale_test_not_development_release.module b/core/modules/locale/tests/modules/locale_test_not_development_release/locale_test_not_development_release.module deleted file mode 100644 index d35ce32..0000000 --- a/core/modules/locale/tests/modules/locale_test_not_development_release/locale_test_not_development_release.module +++ /dev/null @@ -1,20 +0,0 @@ -