Issue #2080527 by chertzog: Remove Unused local variable $base_url from /core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php.
parent
160e691c08
commit
72a600a198
|
@ -155,7 +155,6 @@ class PoDatabaseWriter implements PoWriterInterface {
|
||||||
*/
|
*/
|
||||||
function setHeader(PoHeader $header) {
|
function setHeader(PoHeader $header) {
|
||||||
$this->_header = $header;
|
$this->_header = $header;
|
||||||
$config = \Drupal::config('locale.settings');
|
|
||||||
$locale_plurals = \Drupal::state()->get('locale.translation.plurals') ?: array();
|
$locale_plurals = \Drupal::state()->get('locale.translation.plurals') ?: array();
|
||||||
|
|
||||||
// Check for options.
|
// Check for options.
|
||||||
|
@ -267,7 +266,7 @@ class PoDatabaseWriter implements PoWriterInterface {
|
||||||
// No such source string in the database yet.
|
// No such source string in the database yet.
|
||||||
$string = \Drupal::service('locale.storage')->createString(array('source' => $source, 'context' => $context))
|
$string = \Drupal::service('locale.storage')->createString(array('source' => $source, 'context' => $context))
|
||||||
->save();
|
->save();
|
||||||
$target = \Drupal::service('locale.storage')->createTranslation(array(
|
\Drupal::service('locale.storage')->createTranslation(array(
|
||||||
'lid' => $string->getId(),
|
'lid' => $string->getId(),
|
||||||
'language' => $this->_langcode,
|
'language' => $this->_langcode,
|
||||||
'translation' => $translation,
|
'translation' => $translation,
|
||||||
|
|
|
@ -63,8 +63,6 @@ class LocaleContentTest extends WebTestBase {
|
||||||
* Test if a content type can be set to multilingual and language is present.
|
* Test if a content type can be set to multilingual and language is present.
|
||||||
*/
|
*/
|
||||||
function testContentTypeLanguageConfiguration() {
|
function testContentTypeLanguageConfiguration() {
|
||||||
global $base_url;
|
|
||||||
|
|
||||||
$type1 = $this->drupalCreateContentType();
|
$type1 = $this->drupalCreateContentType();
|
||||||
$type2 = $this->drupalCreateContentType();
|
$type2 = $this->drupalCreateContentType();
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ class LocaleImportFunctionalTest extends WebTestBase {
|
||||||
$this->importPoFile($this->getPoFile(), array(
|
$this->importPoFile($this->getPoFile(), array(
|
||||||
'langcode' => 'fr',
|
'langcode' => 'fr',
|
||||||
));
|
));
|
||||||
$config = \Drupal::config('locale.settings');
|
\Drupal::config('locale.settings');
|
||||||
// The import should automatically create the corresponding language.
|
// 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.');
|
$this->assertRaw(t('The language %language has been created.', array('%language' => 'French')), 'The language has been automatically created.');
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,6 @@ class LocalePathTest extends WebTestBase {
|
||||||
* Test if a language can be associated with a path alias.
|
* Test if a language can be associated with a path alias.
|
||||||
*/
|
*/
|
||||||
function testPathLanguageConfiguration() {
|
function testPathLanguageConfiguration() {
|
||||||
global $base_url;
|
|
||||||
|
|
||||||
// User to add and remove language.
|
// 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'));
|
$admin_user = $this->drupalCreateUser(array('administer languages', 'create page content', 'administer url aliases', 'create url aliases', 'access administration pages'));
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ class LocaleStringTest extends WebTestBase {
|
||||||
|
|
||||||
// Create some translations and then delete string and all of its translations.
|
// Create some translations and then delete string and all of its translations.
|
||||||
$lid = $source->lid;
|
$lid = $source->lid;
|
||||||
$translations = $this->createAllTranslations($source);
|
$this->createAllTranslations($source);
|
||||||
$search = $this->storage->getTranslations(array('lid' => $source->lid));
|
$search = $this->storage->getTranslations(array('lid' => $source->lid));
|
||||||
$this->assertEqual(count($search), 3, 'Created and retrieved all translations for our source string.');
|
$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.
|
// Not customized translations.
|
||||||
$translate1 = $this->createAllTranslations($source1);
|
$translate1 = $this->createAllTranslations($source1);
|
||||||
// Customized translations.
|
// 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.
|
// Try quick search function with different field combinations.
|
||||||
$langcode = 'es';
|
$langcode = 'es';
|
||||||
$found = $this->storage->findTranslation(array('language' => $langcode, 'source' => $source1->source, 'context' => $source1->context));
|
$found = $this->storage->findTranslation(array('language' => $langcode, 'source' => $source1->source, 'context' => $source1->context));
|
||||||
|
|
|
@ -46,8 +46,6 @@ class LocaleTranslationUiTest extends WebTestBase {
|
||||||
* Adds a language and tests string translation by users with the appropriate permissions.
|
* Adds a language and tests string translation by users with the appropriate permissions.
|
||||||
*/
|
*/
|
||||||
function testStringTranslation() {
|
function testStringTranslation() {
|
||||||
global $base_url;
|
|
||||||
|
|
||||||
// User to add and remove language.
|
// User to add and remove language.
|
||||||
$admin_user = $this->drupalCreateUser(array('administer languages', 'access administration pages'));
|
$admin_user = $this->drupalCreateUser(array('administer languages', 'access administration pages'));
|
||||||
// User to translate and delete string.
|
// User to translate and delete string.
|
||||||
|
@ -56,9 +54,6 @@ class LocaleTranslationUiTest extends WebTestBase {
|
||||||
$langcode = 'xx';
|
$langcode = 'xx';
|
||||||
// The English name for the language. This will be translated.
|
// The English name for the language. This will be translated.
|
||||||
$name = $this->randomName(16);
|
$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.
|
// This will be the translation of $name.
|
||||||
$translation = $this->randomName(16);
|
$translation = $this->randomName(16);
|
||||||
$translation_to_en = $this->randomName(16);
|
$translation_to_en = $this->randomName(16);
|
||||||
|
@ -94,9 +89,7 @@ class LocaleTranslationUiTest extends WebTestBase {
|
||||||
// We save the lid from the path.
|
// We save the lid from the path.
|
||||||
$textarea = current($this->xpath('//textarea'));
|
$textarea = current($this->xpath('//textarea'));
|
||||||
$lid = (string) $textarea[0]['name'];
|
$lid = (string) $textarea[0]['name'];
|
||||||
$edit = array(
|
|
||||||
$lid => $this->randomName(),
|
|
||||||
);
|
|
||||||
// No t() here, it's surely not translated yet.
|
// No t() here, it's surely not translated yet.
|
||||||
$this->assertText($name, 'name found on edit screen.');
|
$this->assertText($name, 'name found on edit screen.');
|
||||||
$this->assertNoOption('edit-langcode', 'en', 'No way to translate the string to English.');
|
$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.
|
* Tests the validation of the translation input.
|
||||||
*/
|
*/
|
||||||
function testStringValidation() {
|
function testStringValidation() {
|
||||||
global $base_url;
|
|
||||||
|
|
||||||
// User to add language and strings.
|
// User to add language and strings.
|
||||||
$admin_user = $this->drupalCreateUser(array('administer languages', 'access administration pages', 'translate interface'));
|
$admin_user = $this->drupalCreateUser(array('administer languages', 'access administration pages', 'translate interface'));
|
||||||
$this->drupalLogin($admin_user);
|
$this->drupalLogin($admin_user);
|
||||||
|
@ -316,7 +307,7 @@ class LocaleTranslationUiTest extends WebTestBase {
|
||||||
|
|
||||||
$textarea = current($this->xpath('//textarea'));
|
$textarea = current($this->xpath('//textarea'));
|
||||||
$lid = (string) $textarea[0]['name'];
|
$lid = (string) $textarea[0]['name'];
|
||||||
foreach ($bad_translations as $key => $translation) {
|
foreach ($bad_translations as $translation) {
|
||||||
$edit = array(
|
$edit = array(
|
||||||
$lid => $translation,
|
$lid => $translation,
|
||||||
);
|
);
|
||||||
|
@ -332,8 +323,6 @@ class LocaleTranslationUiTest extends WebTestBase {
|
||||||
* Tests translation search form.
|
* Tests translation search form.
|
||||||
*/
|
*/
|
||||||
function testStringSearch() {
|
function testStringSearch() {
|
||||||
global $base_url;
|
|
||||||
|
|
||||||
// User to add and remove language.
|
// User to add and remove language.
|
||||||
$admin_user = $this->drupalCreateUser(array('administer languages', 'access administration pages'));
|
$admin_user = $this->drupalCreateUser(array('administer languages', 'access administration pages'));
|
||||||
// User to translate and delete string.
|
// User to translate and delete string.
|
||||||
|
@ -343,9 +332,6 @@ class LocaleTranslationUiTest extends WebTestBase {
|
||||||
$langcode = 'xx';
|
$langcode = 'xx';
|
||||||
// The English name for the language. This will be translated.
|
// The English name for the language. This will be translated.
|
||||||
$name = $this->randomName(16);
|
$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.
|
// This will be the translation of $name.
|
||||||
$translation = $this->randomName(16);
|
$translation = $this->randomName(16);
|
||||||
|
|
||||||
|
@ -510,7 +496,7 @@ class LocaleTranslationUiTest extends WebTestBase {
|
||||||
);
|
);
|
||||||
$this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
|
$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.
|
// Submit the translations without changing the translation.
|
||||||
$textarea = current($this->xpath('//textarea'));
|
$textarea = current($this->xpath('//textarea'));
|
||||||
|
@ -528,7 +514,7 @@ class LocaleTranslationUiTest extends WebTestBase {
|
||||||
'customized' => '0',
|
'customized' => '0',
|
||||||
);
|
);
|
||||||
$this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
|
$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.
|
// Submit the translations with a new translation.
|
||||||
$textarea = current($this->xpath('//textarea'));
|
$textarea = current($this->xpath('//textarea'));
|
||||||
|
|
|
@ -65,7 +65,7 @@ class LocaleUpdateTest extends LocaleUpdateBase {
|
||||||
*/
|
*/
|
||||||
function testUpdateProjectsHidden() {
|
function testUpdateProjectsHidden() {
|
||||||
module_load_include('compare.inc', 'locale');
|
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.
|
// Make the test modules look like a normal custom module.
|
||||||
\Drupal::state()->set('locale.test_system_info_alter', TRUE);
|
\Drupal::state()->set('locale.test_system_info_alter', TRUE);
|
||||||
|
|
Loading…
Reference in New Issue