Skip to content
Snippets Groups Projects
Commit 72a600a1 authored by catch's avatar catch
Browse files

Issue #2080527 by chertzog: Remove Unused local variable $base_url from...

Issue #2080527 by chertzog: Remove Unused local variable $base_url from /core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php.
parent 160e691c
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -155,7 +155,6 @@ function getHeader() {
*/
function setHeader(PoHeader $header) {
$this->_header = $header;
$config = \Drupal::config('locale.settings');
$locale_plurals = \Drupal::state()->get('locale.translation.plurals') ?: array();
// Check for options.
......@@ -267,7 +266,7 @@ private function importString(PoItem $item) {
// No such source string in the database yet.
$string = \Drupal::service('locale.storage')->createString(array('source' => $source, 'context' => $context))
->save();
$target = \Drupal::service('locale.storage')->createTranslation(array(
\Drupal::service('locale.storage')->createTranslation(array(
'lid' => $string->getId(),
'language' => $this->_langcode,
'translation' => $translation,
......
......@@ -63,8 +63,6 @@ function testMachineNameLTR() {
* Test if a content type can be set to multilingual and language is present.
*/
function testContentTypeLanguageConfiguration() {
global $base_url;
$type1 = $this->drupalCreateContentType();
$type2 = $this->drupalCreateContentType();
......
......@@ -53,7 +53,7 @@ function testStandalonePoFile() {
$this->importPoFile($this->getPoFile(), array(
'langcode' => 'fr',
));
$config = \Drupal::config('locale.settings');
\Drupal::config('locale.settings');
// The import should automatically create the corresponding language.
$this->assertRaw(t('The language %language has been created.', array('%language' => 'French')), 'The language has been automatically created.');
......
......@@ -41,8 +41,6 @@ function setUp() {
* Test if a language can be associated with a path alias.
*/
function testPathLanguageConfiguration() {
global $base_url;
// User to add and remove language.
$admin_user = $this->drupalCreateUser(array('administer languages', 'create page content', 'administer url aliases', 'create url aliases', 'access administration pages'));
......
......@@ -96,7 +96,7 @@ function testStringCRUDAPI() {
// Create some translations and then delete string and all of its translations.
$lid = $source->lid;
$translations = $this->createAllTranslations($source);
$this->createAllTranslations($source);
$search = $this->storage->getTranslations(array('lid' => $source->lid));
$this->assertEqual(count($search), 3, 'Created and retrieved all translations for our source string.');
......@@ -144,7 +144,7 @@ function testStringSearchAPI() {
// Not customized translations.
$translate1 = $this->createAllTranslations($source1);
// Customized translations.
$translate2 = $this->createAllTranslations($source2, array('customized' => LOCALE_CUSTOMIZED));
$this->createAllTranslations($source2, array('customized' => LOCALE_CUSTOMIZED));
// Try quick search function with different field combinations.
$langcode = 'es';
$found = $this->storage->findTranslation(array('language' => $langcode, 'source' => $source1->source, 'context' => $source1->context));
......
......@@ -46,8 +46,6 @@ function testEnglishTranslation() {
* Adds a language and tests string translation by users with the appropriate permissions.
*/
function testStringTranslation() {
global $base_url;
// User to add and remove language.
$admin_user = $this->drupalCreateUser(array('administer languages', 'access administration pages'));
// User to translate and delete string.
......@@ -56,9 +54,6 @@ function testStringTranslation() {
$langcode = 'xx';
// The English name for the language. This will be translated.
$name = $this->randomName(16);
// This is the language indicator on the translation search screen for
// untranslated strings.
$language_indicator = "<em class=\"locale-untranslated\">$langcode</em> ";
// This will be the translation of $name.
$translation = $this->randomName(16);
$translation_to_en = $this->randomName(16);
......@@ -94,9 +89,7 @@ function testStringTranslation() {
// We save the lid from the path.
$textarea = current($this->xpath('//textarea'));
$lid = (string) $textarea[0]['name'];
$edit = array(
$lid => $this->randomName(),
);
// No t() here, it's surely not translated yet.
$this->assertText($name, 'name found on edit screen.');
$this->assertNoOption('edit-langcode', 'en', 'No way to translate the string to English.');
......@@ -276,8 +269,6 @@ function testJavaScriptTranslation() {
* Tests the validation of the translation input.
*/
function testStringValidation() {
global $base_url;
// User to add language and strings.
$admin_user = $this->drupalCreateUser(array('administer languages', 'access administration pages', 'translate interface'));
$this->drupalLogin($admin_user);
......@@ -316,7 +307,7 @@ function testStringValidation() {
$textarea = current($this->xpath('//textarea'));
$lid = (string) $textarea[0]['name'];
foreach ($bad_translations as $key => $translation) {
foreach ($bad_translations as $translation) {
$edit = array(
$lid => $translation,
);
......@@ -332,8 +323,6 @@ function testStringValidation() {
* Tests translation search form.
*/
function testStringSearch() {
global $base_url;
// User to add and remove language.
$admin_user = $this->drupalCreateUser(array('administer languages', 'access administration pages'));
// User to translate and delete string.
......@@ -343,9 +332,6 @@ function testStringSearch() {
$langcode = 'xx';
// The English name for the language. This will be translated.
$name = $this->randomName(16);
// This is the language indicator on the translation search screen for
// untranslated strings.
$language_indicator = "<em class=\"locale-untranslated\">$langcode</em> ";
// This will be the translation of $name.
$translation = $this->randomName(16);
......@@ -510,7 +496,7 @@ function testUICustomizedStrings(){
);
$this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
$source = $this->assertText($translation->getString(), 'Translation is found in search result.');
$this->assertText($translation->getString(), 'Translation is found in search result.');
// Submit the translations without changing the translation.
$textarea = current($this->xpath('//textarea'));
......@@ -528,7 +514,7 @@ function testUICustomizedStrings(){
'customized' => '0',
);
$this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
$source = $this->assertText($string->getString(), 'Translation is not marked as customized.');
$this->assertText($string->getString(), 'Translation is not marked as customized.');
// Submit the translations with a new translation.
$textarea = current($this->xpath('//textarea'));
......
......@@ -65,7 +65,7 @@ function testUpdateProjects() {
*/
function testUpdateProjectsHidden() {
module_load_include('compare.inc', 'locale');
$config = \Drupal::config('locale.settings');
\Drupal::config('locale.settings');
// Make the test modules look like a normal custom module.
\Drupal::state()->set('locale.test_system_info_alter', TRUE);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment