updated webform, webform_localization, profile2, term_merge, search_api_saved_pages, rules, redirect, overide_node_options

This commit is contained in:
2019-05-13 18:47:27 +02:00
parent 58cd990c8c
commit 9adc940a67
281 changed files with 28658 additions and 7138 deletions

View File

@@ -12,6 +12,9 @@ class L10nUpdateCronTest extends L10nUpdateTestBase {
protected $batch_output = array();
/**
* {@inheritdoc}
*/
public static function getInfo() {
return array(
'name' => 'Update translations using cron',
@@ -20,7 +23,10 @@ class L10nUpdateCronTest extends L10nUpdateTestBase {
);
}
function setUp() {
/**
* {@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);
@@ -30,7 +36,7 @@ class L10nUpdateCronTest extends L10nUpdateTestBase {
/**
* Tests interface translation update using cron.
*/
function testUpdateCron() {
public function testUpdateCron() {
// Set a flag to let the l10n_update_test module replace the project data
// with a set of test projects.
variable_set('l10n_update_test_projects_alter', TRUE);
@@ -112,4 +118,5 @@ class L10nUpdateCronTest extends L10nUpdateTestBase {
$this->assertTrue($current->timestamp > $initial->timestamp, 'Timestamp is updated');
$this->assertTrue($current->last_checked > $initial->last_checked, 'Last checked is updated');
}
}

View File

@@ -10,6 +10,9 @@
*/
class L10nUpdateInterfaceTest extends L10nUpdateTestBase {
/**
* {@inheritdoc}
*/
public static function getInfo() {
return array(
'name' => 'Update translations user interface',
@@ -18,7 +21,10 @@ class L10nUpdateInterfaceTest extends L10nUpdateTestBase {
);
}
function setUp() {
/**
* {@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);
@@ -30,12 +36,19 @@ class L10nUpdateInterfaceTest extends L10nUpdateTestBase {
* Testing the Available updates summary on the side wide status page and the
* Avaiable translation updates page.
*/
function testInterface() {
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 Available translation updates page.
// Check status page and Translate interface update page.
$this->drupalGet('admin/reports/status');
$this->assertNoText(t('Translation update status'), 'No status message');
@@ -50,7 +63,7 @@ class L10nUpdateInterfaceTest extends L10nUpdateTestBase {
// 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);
cache_set('l10n_update_status', $status);
// One language added, all translations up to date.
$this->drupalGet('admin/reports/status');
@@ -59,15 +72,16 @@ class L10nUpdateInterfaceTest extends L10nUpdateTestBase {
$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.
// 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);
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">Available translation updates</a> page for more information.', array('@languages' => t('German'), '@updates' => url('admin/config/regional/translate/update'))), 'Updates available 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');
@@ -76,12 +90,12 @@ class L10nUpdateInterfaceTest extends L10nUpdateTestBase {
$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);
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">Available translation updates</a> page for more information.', array('@languages' => t('German'), '@updates' => url('admin/config/regional/translate/update'))), 'Missing translations 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');

View File

@@ -10,6 +10,9 @@
*/
class L10nUpdateTest extends L10nUpdateTestBase {
/**
* {@inheritdoc}
*/
public static function getInfo() {
return array(
'name' => 'Update translations',
@@ -18,15 +21,25 @@ class L10nUpdateTest extends L10nUpdateTestBase {
);
}
function setUp() {
/**
* {@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);
// Exclude drupal core and nl10n_update so no remote translations are
// fetched.
$edit = array(
'disabled_projects' => 'drupal\nl10n_update',
);
$this->drupalPost('admin/config/regional/language/update', $edit, t('Save configuration'));
// We use German as test language. This language must match the translation
// file that come with the l10n_update_test module (test.de.po) and can therefore
// not be chosen randomly.
// file that come with the l10n_update_test module (test.de.po) and can
// therefore not be chosen randomly.
$this->addLanguage('de');
module_load_include('compare.inc', 'l10n_update');
@@ -36,21 +49,22 @@ class L10nUpdateTest extends L10nUpdateTestBase {
/**
* Checks if a list of translatable projects gets build.
*/
function testUpdateProjects() {
public function testUpdateProjects() {
module_load_include('compare.inc', 'l10n_update');
variable_set('l10n_update_test_projects_alter', TRUE);
// Make the test modules look like a normal custom module. i.e. make the
// modules not hidden. l10n_update_test_system_info_alter() modifies the project
// info of the l10n_update_test and l10n_update_test_translate modules.
// modules not hidden. l10n_update_test_system_info_alter() modifies the
// project info of the l10n_update_test and l10n_update_test_translate
// modules.
variable_set('l10n_update_test_system_info_alter', TRUE);
$this->resetAll();
// Check if interface translation data is collected from hook_info.
$projects = l10n_update_project_list();
$this->assertFalse(isset($projects['l10n_update_test_translate']), 'Hidden module not found');
$this->assertEqual($projects['l10n_update_test']['info']['interface translation server pattern'], 'sites/all/modules/l10n_update/tests/test.%language.po', 'Interface translation parameter found in project info.');
$this->assertEqual($projects['l10n_update_test']['name'] , 'l10n_update_test', format_string('%key found in project info.', array('%key' => 'interface translation project')));
$this->assertEqual($projects['l10n_update_test']['info']['l10n path'], drupal_get_path('module', 'l10n_update') . '/tests/test.%language.po', 'l10n path parameter found in project info.');
$this->assertEqual($projects['l10n_update_test']['name'], 'l10n_update_test', format_string('%key found in project info.', array('%key' => 'interface translation project')));
}
/**
@@ -67,9 +81,9 @@ class L10nUpdateTest extends L10nUpdateTestBase {
* the most recent files are selected in the different check scenarios: check
* for local files only, check for both local and remote files.
*/
function testUpdateCheckStatus() {
// Set a flag to let the l10n_update_test module replace the project data with a
// set of test projects.
public function testUpdateCheckStatus() {
// Set a flag to let the l10n_update_test module replace the project data
// with a set of test projects.
variable_set('l10n_update_test_projects_alter', TRUE);
// Create local and remote translations files.
@@ -116,18 +130,18 @@ class L10nUpdateTest extends L10nUpdateTestBase {
*
* Test conditions:
* - Source: remote and local files
* - Import overwrite: all existing translations
* - Import overwrite: all existing translations.
*/
function testUpdateImportSourceRemote() {
public function testUpdateImportSourceRemote() {
// Build the test environment.
$this->setTranslationFiles();
$this-> setCurrentTranslations();
$this->setCurrentTranslations();
variable_set('l10n_update_default_filename', '%project-%release.%language._po');
// Set the update conditions for this test.
$edit = array(
'l10n_update_check_mode' => L10N_UPDATE_USE_SOURCE_REMOTE_AND_LOCAL,
'overwrite' => LOCALE_IMPORT_OVERWRITE,
'l10n_update_import_mode' => LOCALE_IMPORT_OVERWRITE,
);
$this->drupalPost('admin/config/regional/language/update', $edit, t('Save configuration'));
@@ -176,18 +190,18 @@ class L10nUpdateTest extends L10nUpdateTestBase {
*
* Test conditions:
* - Source: local files only
* - Import overwrite: all existing translations
* - Import overwrite: all existing translations.
*/
function testUpdateImportSourceLocal() {
public function testUpdateImportSourceLocal() {
// Build the test environment.
$this->setTranslationFiles();
$this-> setCurrentTranslations();
$this->setCurrentTranslations();
variable_set('l10n_update_default_filename', '%project-%release.%language._po');
// Set the update conditions for this test.
$edit = array(
'l10n_update_check_mode' => L10N_UPDATE_USE_SOURCE_LOCAL,
'overwrite' => LOCALE_IMPORT_OVERWRITE,
'l10n_update_import_mode' => LOCALE_IMPORT_OVERWRITE,
);
$this->drupalPost('admin/config/regional/language/update', $edit, t('Save configuration'));
@@ -228,18 +242,18 @@ class L10nUpdateTest extends L10nUpdateTestBase {
*
* Test conditions:
* - Source: remote and local files
* - Import overwrite: only overwrite non-customized translations
* - Import overwrite: only overwrite non-customized translations.
*/
function testUpdateImportModeNonCustomized() {
public function testUpdateImportModeNonCustomized() {
// Build the test environment.
$this->setTranslationFiles();
$this-> setCurrentTranslations();
$this->setCurrentTranslations();
variable_set('l10n_update_default_filename', '%project-%release.%language._po');
// Set the test conditions.
$edit = array(
'l10n_update_check_mode' => L10N_UPDATE_USE_SOURCE_REMOTE_AND_LOCAL,
'overwrite' => L10N_UPDATE_OVERWRITE_NON_CUSTOMIZED,
'l10n_update_import_mode' => L10N_UPDATE_OVERWRITE_NON_CUSTOMIZED,
);
$this->drupalPost('admin/config/regional/language/update', $edit, t('Save configuration'));
@@ -262,18 +276,18 @@ class L10nUpdateTest extends L10nUpdateTestBase {
*
* Test conditions:
* - Source: remote and local files
* - Import overwrite: don't overwrite any existing translation
* - Import overwrite: don't overwrite any existing translation.
*/
function testUpdateImportModeNone() {
public function testUpdateImportModeNone() {
// Build the test environment.
$this->setTranslationFiles();
$this-> setCurrentTranslations();
$this->setCurrentTranslations();
variable_set('l10n_update_default_filename', '%project-%release.%language._po');
// Set the test conditions.
$edit = array(
'l10n_update_check_mode' => L10N_UPDATE_USE_SOURCE_REMOTE_AND_LOCAL,
'overwrite' => LOCALE_IMPORT_KEEP,
'l10n_update_import_mode' => LOCALE_IMPORT_KEEP,
);
$this->drupalPost('admin/config/regional/language/update', $edit, t('Save configuration'));
@@ -294,7 +308,7 @@ class L10nUpdateTest extends L10nUpdateTestBase {
/**
* Tests automatic translation import when a module is enabled.
*/
function testEnableUninstallModule() {
public function testEnableUninstallModule() {
// Make the hidden test modules look like a normal custom module.
variable_set('l10n_update_test_system_info_alter', TRUE);
@@ -308,23 +322,24 @@ class L10nUpdateTest extends L10nUpdateTestBase {
$this->drupalPost('admin/modules', $edit, t('Save configuration'));
// Check if translations have been imported.
// @TODO: Find out why this currently returns 0 translations.
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.',
array('%number' => 0, '%update' => 7, '%delete' => 0)), 'One translation file imported.');
array('%number' => 0, '%update' => 0 /* 7 */, '%delete' => 0)), 'One translation file imported.');
$this->assertTranslation('Tuesday', 'Dienstag', 'de');
// // Disable and uninstall a module
// module_disable(array('l10n_update_test_translate'));
// $edit = array(
// 'uninstall[l10n_update_test_translate]' => '1',
// );
// $this->drupalPost('admin/modules/uninstall', $edit, t('Uninstall'));
// $this->drupalPost(NULL, array(), t('Uninstall'));
//
// // Check if the file data is removed from the database.
// $history = l10n_update_get_file_history();
// $this->assertFalse(isset($history['l10n_update_test_translate']), 'Project removed from the file history');
// $projects = l10n_update_get_projects();
// $this->assertFalse(isset($projects['l10n_update_test_translate']), 'Project removed from the project list');
// Disable and uninstall a module
// module_disable(array('l10n_update_test_translate'));
// $edit = array(
// 'uninstall[l10n_update_test_translate]' => '1',
// );
// $this->drupalPost('admin/modules/uninstall', $edit, t('Uninstall'));
// $this->drupalPost(NULL, array(), t('Uninstall'));
//
// // Check if the file data is removed from the database.
// $history = l10n_update_get_file_history();
// $this->assertFalse(isset($history['l10n_update_test_translate']), 'Project removed from the file history');
// $projects = l10n_update_get_projects();
// $this->assertFalse(isset($projects['l10n_update_test_translate']), 'Project removed from the project list');
}
/**
@@ -334,7 +349,7 @@ class L10nUpdateTest extends L10nUpdateTestBase {
* enabled modules and will import them. When a language is removed the system
* will remove all translations of that langugue from the database.
*/
function testEnableLanguage() {
public function testEnableLanguage() {
// Make the hidden test modules look like a normal custom module.
variable_set('l10n_update_test_system_info_alter', TRUE);
@@ -352,8 +367,9 @@ class L10nUpdateTest extends L10nUpdateTestBase {
$this->addLanguage('nl');
// Check if the right number of translations are added.
// @TODO: Find out why this currently returns 0 translations.
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.',
array('%number' => 0, '%update' => 8, '%delete' => 0)), 'One language added.');
array('%number' => 0, '%update' => 0 /* 8 */, '%delete' => 0)), 'One language added.');
$this->assertTranslation('Extraday', 'extra dag', 'nl');
// Check if the language data is added to the database.
@@ -375,7 +391,7 @@ class L10nUpdateTest extends L10nUpdateTestBase {
/**
* Tests automatic translation import when a custom langauge is enabled.
*/
function testEnableCustomLanguage() {
public function testEnableCustomLanguage() {
// Make the hidden test modules look like a normal custom module.
variable_set('l10n_update_test_system_info_alter', TRUE);
@@ -433,8 +449,7 @@ class L10nUpdateTest extends L10nUpdateTestBase {
'translation' => 'translated',
);
$this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
// $this->assertText('Allowed HTML source string', 'String successfully imported.');
$this->assertNoText('Another allowed HTML source string', 'String with disallowed translation not imported.');
// $this->assertText('Allowed HTML source string', 'String successfully imported.'); $this->assertNoText('Another allowed HTML source string', 'String with disallowed translation not imported.');
}
}

View File

@@ -31,7 +31,10 @@ class L10nUpdateTestBase extends DrupalWebTestCase {
*/
protected $timestamp_new;
function setUp() {
/**
*
*/
public function setUp() {
parent::setUp('update', 'locale', 'l10n_update', 'l10n_update_test');
// Setup timestamps to identify old and new translation sources.
@@ -56,7 +59,7 @@ class L10nUpdateTestBase extends DrupalWebTestCase {
/**
* Adds a language.
*
* @param $langcode
* @param string $langcode
* The language code of the language to add.
*/
protected function addLanguage($langcode) {
@@ -74,7 +77,7 @@ class L10nUpdateTestBase extends DrupalWebTestCase {
* Path of the file relative to the public file path.
* @param string $filename
* Name of the file to create.
* @param integer $timestamp
* @param int $timestamp
* Timestamp to set the file to. Defaults to current time.
* @param array $translations
* Array of source/target value translation strings. Only singular strings
@@ -99,8 +102,8 @@ EOF;
// Convert array of translations to Gettext source and translation strings.
if ($translations) {
foreach ($translations as $source => $target) {
$text .= 'msgid "'. $source . '"' . "\n";
$text .= 'msgstr "'. $target . '"' . "\n";
$text .= 'msgid "' . $source . '"' . "\n";
$text .= 'msgstr "' . $target . '"' . "\n";
}
}
@@ -151,8 +154,8 @@ EOF;
* imported.
*/
protected function setTranslationFiles() {
// A flag is set to let the l10n_update_test module replace the project data with
// a set of test projects which match the below project files.
// A flag is set to let the l10n_update_test module replace the project data
// with a set of test projects which match the below project files.
variable_set('l10n_update_test_projects_alter', TRUE);
// Setup the environment.
@@ -162,7 +165,7 @@ EOF;
// Setting up sets of translations for the translation files.
$translations_one = array('January' => 'Januar_1', 'February' => 'Februar_1', 'March' => 'Marz_1');
$translations_two = array( 'February' => 'Februar_2', 'March' => 'Marz_2', 'April' => 'April_2');
$translations_two = array('February' => 'Februar_2', 'March' => 'Marz_2', 'April' => 'April_2');
$translations_three = array('April' => 'April_3', 'May' => 'Mai_3', 'June' => 'Juni_3');
// Add a number of files to the local file system to serve as remote
@@ -182,8 +185,7 @@ EOF;
}
/**
* Setup existing translations in the database and set up the status of
* existing translations.
* Setup existing translations in the database and their status.
*/
protected function setCurrentTranslations() {
// Setup to add German translations to the database.
@@ -281,4 +283,5 @@ EOF;
$db_translation = $db_translation == FALSE ? '' : $db_translation;
$this->assertEqual($translation, $db_translation, $message ? $message : format_string('Correct translation of %source (%language)', array('%source' => $source, '%language' => $langcode)));
}
}

View File

@@ -6,9 +6,9 @@ version = '1.2'
core = 7.x
hidden = true
; Information added by Drupal.org packaging script on 2014-11-10
version = "7.x-2.0"
; Information added by Drupal.org packaging script on 2017-09-18
version = "7.x-2.2"
core = "7.x"
project = "l10n_update"
datestamp = "1415625781"
datestamp = "1505717347"

View File

@@ -13,7 +13,8 @@
*/
function l10n_update_test_system_info_alter(&$info, $file, $type) {
// Only modify the system info if required.
// By default the l10n_update_test modules are hidden and have a project specified.
// By default the l10n_update_test modules are hidden and have a project
// specified.
// To test the module detection process by l10n_update_project_list() the
// test modules should mimic a custom module. I.e. be non-hidden.
if (variable_get('l10n_update_test_system_info_alter', FALSE)) {
@@ -45,10 +46,10 @@ function l10n_update_test_l10n_update_projects_alter(&$projects) {
$remote_url = $wrapper->getExternalUrl() . '/remote/';
// Completely replace the project data with a set of test projects.
$projects = array (
'contrib_module_one' => array (
$projects = array(
'contrib_module_one' => array(
'name' => 'contrib_module_one',
'info' => array (
'info' => array(
'name' => 'Contributed module one',
'l10n path' => $remote_url . '%core/%project/%project-%release.%language._po',
'package' => 'Other',
@@ -58,15 +59,15 @@ function l10n_update_test_l10n_update_projects_alter(&$projects) {
'_info_file_ctime' => 1348767306,
),
'datestamp' => '1344471537',
'includes' => array (
'includes' => array(
'contrib_module_one' => 'Contributed module one',
),
'project_type' => 'module',
'project_status' => TRUE,
),
'contrib_module_two' => array (
'contrib_module_two' => array(
'name' => 'contrib_module_two',
'info' => array (
'info' => array(
'name' => 'Contributed module two',
'l10n path' => $remote_url . '%core/%project/%project-%release.%language._po',
'package' => 'Other',
@@ -76,15 +77,15 @@ function l10n_update_test_l10n_update_projects_alter(&$projects) {
'_info_file_ctime' => 1348767306,
),
'datestamp' => '1344471537',
'includes' => array (
'includes' => array(
'contrib_module_two' => 'Contributed module two',
),
'project_type' => 'module',
'project_status' => TRUE,
),
'contrib_module_three' => array (
'contrib_module_three' => array(
'name' => 'contrib_module_three',
'info' => array (
'info' => array(
'name' => 'Contributed module three',
'l10n path' => $remote_url . '%core/%project/%project-%release.%language._po',
'package' => 'Other',
@@ -94,18 +95,18 @@ function l10n_update_test_l10n_update_projects_alter(&$projects) {
'_info_file_ctime' => 1348767306,
),
'datestamp' => '1344471537',
'includes' => array (
'includes' => array(
'contrib_module_three' => 'Contributed module three',
),
'project_type' => 'module',
'project_status' => TRUE,
),
'l10n_update_test' => array (
'l10n_update_test' => array(
'name' => 'l10n_update_test',
'info' => array (
'info' => array(
'name' => 'Locale test',
'interface translation project' => 'l10n_update_test',
'l10n path' => 'sites/all/modules/l10n_update/tests/test.%language.po',
'l10n path' => drupal_get_path('module', 'l10n_update') . '/tests/test.%language.po',
'package' => 'Other',
'version' => NULL,
'project' => 'l10n_update_test',
@@ -113,15 +114,15 @@ function l10n_update_test_l10n_update_projects_alter(&$projects) {
'datestamp' => 0,
),
'datestamp' => 0,
'includes' => array (
'includes' => array(
'l10n_update_test' => 'Locale test',
),
'project_type' => 'module',
'project_status' => TRUE,
),
'custom_module_one' => array (
'custom_module_one' => array(
'name' => 'custom_module_one',
'info' => array (
'info' => array(
'name' => 'Custom module one',
'interface translation project' => 'custom_module_one',
'l10n path' => 'translations://custom_module_one.%language.po',
@@ -132,7 +133,7 @@ function l10n_update_test_l10n_update_projects_alter(&$projects) {
'datestamp' => 0,
),
'datestamp' => 0,
'includes' => array (
'includes' => array(
'custom_module_one' => 'Custom module one',
),
'project_type' => 'module',

View File

@@ -8,9 +8,9 @@ hidden = true
interface translation project = l10n_update_test_translate
l10n path = sites/all/modules/contrib/l10n_update/tests/modules/l10n_update_test_translate/translations/l10n_update_test_translate.%language.po
; Information added by Drupal.org packaging script on 2014-11-10
version = "7.x-2.0"
; Information added by Drupal.org packaging script on 2017-09-18
version = "7.x-2.2"
core = "7.x"
project = "l10n_update"
datestamp = "1415625781"
datestamp = "1505717347"