update drupal

This commit is contained in:
Tessier
2020-10-15 11:59:37 +02:00
parent ebb5db14b5
commit d8b9162932
558 changed files with 5954 additions and 4475 deletions
@@ -202,7 +202,11 @@ class LocaleImportFunctionalTest extends BrowserTestBase {
// The database should now contain 6 customized strings (two imported
// strings are not translated).
$count = Database::getConnection()->query('SELECT COUNT(*) FROM {locales_target} WHERE customized = :custom', [':custom' => 1])->fetchField();
$count = Database::getConnection()->select('locales_target')
->condition('customized', 1)
->countQuery()
->execute()
->fetchField();
$this->assertEqual($count, 6, 'Customized translations successfully imported.');
// Try importing a .po file with overriding strings, and ensure existing
@@ -197,7 +197,12 @@ class LocalePluralFormatTest extends BrowserTestBase {
// not save our source string for performance optimization if we do not ask
// specifically for a language.
\Drupal::translation()->formatPlural(1, '1 second', '@count seconds', [], ['langcode' => 'fr'])->render();
$lid = Database::getConnection()->query("SELECT lid FROM {locales_source} WHERE source = :source AND context = ''", [':source' => "1 second" . PoItem::DELIMITER . "@count seconds"])->fetchField();
$lid = Database::getConnection()->select('locales_source', 'ls')
->fields('ls', ['lid'])
->condition('source', "1 second" . PoItem::DELIMITER . "@count seconds")
->condition('context', '')
->execute()
->fetchField();
// Look up editing page for this plural string and check fields.
$search = [
'string' => '1 second',
@@ -282,7 +287,12 @@ class LocalePluralFormatTest extends BrowserTestBase {
$connection = Database::getConnection();
// Edit langcode hr translations and see if that took effect.
$lid = $connection->query("SELECT lid FROM {locales_source} WHERE source = :source AND context = ''", [':source' => "1 hour" . PoItem::DELIMITER . "@count hours"])->fetchField();
$lid = $connection->select('locales_source', 'ls')
->fields('ls', ['lid'])
->condition('source', "1 hour" . PoItem::DELIMITER . "@count hours")
->condition('context', '')
->execute()
->fetchField();
$edit = [
"strings[$lid][translations][1]" => '@count sata edited',
];
@@ -308,7 +318,12 @@ class LocalePluralFormatTest extends BrowserTestBase {
// not save our source string for performance optimization if we do not ask
// specifically for a language.
\Drupal::translation()->formatPlural(1, '1 day', '@count days', [], ['langcode' => 'fr'])->render();
$lid = $connection->query("SELECT lid FROM {locales_source} WHERE source = :source AND context = ''", [':source' => "1 day" . PoItem::DELIMITER . "@count days"])->fetchField();
$lid = $connection->select('locales_source', 'ls')
->fields('ls', ['lid'])
->condition('source', "1 day" . PoItem::DELIMITER . "@count days")
->condition('context', '')
->execute()
->fetchField();
// Look up editing page for this plural string and check fields.
$search = [
'string' => '1 day',
@@ -301,7 +301,13 @@ EOF;
* (optional) A message to display with the assertion.
*/
protected function assertTranslation($source, $translation, $langcode, $message = '') {
$db_translation = Database::getConnection()->query('SELECT translation FROM {locales_target} lt INNER JOIN {locales_source} ls ON ls.lid = lt.lid WHERE ls.source = :source AND lt.language = :langcode', [':source' => $source, ':langcode' => $langcode])->fetchField();
$query = Database::getConnection()->select('locales_target', 'lt');
$query->innerJoin('locales_source', 'ls', 'ls.lid = lt.lid');
$db_translation = $query->fields('lt', ['translation'])
->condition('ls.source', $source)
->condition('lt.language', $langcode)
->execute()
->fetchField();
$db_translation = $db_translation == FALSE ? '' : $db_translation;
$this->assertEqual($translation, $db_translation, $message ? $message : new FormattableMarkup('Correct translation of %source (%language)', ['%source' => $source, '%language' => $langcode]));
}
@@ -359,14 +359,22 @@ class LocaleUpdateTest extends LocaleUpdateBase {
// Check if the language data is added to the database.
$connection = Database::getConnection();
$result = $connection->query("SELECT project FROM {locale_file} WHERE langcode='nl'")->fetchField();
$result = $connection->select('locale_file', 'lf')
->fields('lf', ['project'])
->condition('langcode', 'nl')
->execute()
->fetchField();
$this->assertNotEmpty($result, 'Files added to file history');
// Remove a language.
$this->drupalPostForm('admin/config/regional/language/delete/nl', [], t('Delete'));
// Check if the language data is removed from the database.
$result = $connection->query("SELECT project FROM {locale_file} WHERE langcode='nl'")->fetchField();
$result = $connection->select('locale_file', 'lf')
->fields('lf', ['project'])
->condition('langcode', 'nl')
->execute()
->fetchField();
$this->assertFalse($result, 'Files removed from file history');
// Check that the Dutch translation is gone.