Issue #2080527 by chertzog: Remove Unused local variable $base_url from /core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php.

8.0.x
Nathaniel Catchpole 2013-12-03 13:36:13 +00:00
parent 160e691c08
commit 72a600a198
7 changed files with 9 additions and 28 deletions

View File

@ -155,7 +155,6 @@ class PoDatabaseWriter implements PoWriterInterface {
*/
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 @@ class PoDatabaseWriter implements PoWriterInterface {
// 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,

View File

@ -63,8 +63,6 @@ class LocaleContentTest extends WebTestBase {
* 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();

View File

@ -53,7 +53,7 @@ class LocaleImportFunctionalTest extends WebTestBase {
$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.');

View File

@ -41,8 +41,6 @@ class LocalePathTest extends WebTestBase {
* 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'));

View File

@ -96,7 +96,7 @@ class LocaleStringTest extends WebTestBase {
// 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 @@ class LocaleStringTest extends WebTestBase {
// 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));

View File

@ -46,8 +46,6 @@ class LocaleTranslationUiTest extends WebTestBase {
* 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 @@ class LocaleTranslationUiTest extends WebTestBase {
$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 @@ class LocaleTranslationUiTest extends WebTestBase {
// 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 @@ class LocaleTranslationUiTest extends WebTestBase {
* 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 @@ class LocaleTranslationUiTest extends WebTestBase {
$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 @@ class LocaleTranslationUiTest extends WebTestBase {
* 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 @@ class LocaleTranslationUiTest extends WebTestBase {
$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 @@ class LocaleTranslationUiTest extends WebTestBase {
);
$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 @@ class LocaleTranslationUiTest extends WebTestBase {
'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'));

View File

@ -65,7 +65,7 @@ class LocaleUpdateTest extends LocaleUpdateBase {
*/
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);