summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2014-08-20 16:28:00 (GMT)
committerAlex Pott2014-08-20 16:28:00 (GMT)
commit01372dd5298a9ca0f1a3190b4230de2c866c73f8 (patch)
tree28e611f0a6d05a2a420cebbe67267c820aaf3602
parent06278dc41dfdefc05581602713c6ce14cdb10e81 (diff)
Issue #2323521 by herom: Fixed a couple of t() calls in core.
-rw-r--r--core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php7
-rw-r--r--core/modules/file/file.field.inc2
-rw-r--r--core/modules/image/src/Tests/ImageFieldDisplayTest.php2
-rw-r--r--core/modules/image/src/Tests/ImageFieldValidateTest.php2
-rw-r--r--core/modules/system/src/Tests/Entity/FieldSqlStorageTest.php10
-rw-r--r--core/modules/system/src/Tests/Form/FormTest.php41
-rw-r--r--core/modules/system/src/Tests/System/DateTimeTest.php2
7 files changed, 37 insertions, 29 deletions
diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php
index 641dd7d..a5f0acd 100644
--- a/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php
+++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php
@@ -118,14 +118,11 @@ class Tasks extends InstallTasks {
$this->pass(t('Database is encoded in UTF-8'));
}
else {
- $replacements = array(
+ $this->fail(t('The %driver database must use %encoding encoding to work with Drupal. Recreate the database with %encoding encoding. See !link for more details.', array(
'%encoding' => 'UTF8',
'%driver' => $this->name(),
'!link' => '<a href="INSTALL.pgsql.txt">INSTALL.pgsql.txt</a>'
- );
- $text = 'The %driver database must use %encoding encoding to work with Drupal.';
- $text .= 'Recreate the database with %encoding encoding. See !link for more details.';
- $this->fail(t($text, $replacements));
+ )));
}
}
catch (\Exception $e) {
diff --git a/core/modules/file/file.field.inc b/core/modules/file/file.field.inc
index 2eb9bf3..3e88433 100644
--- a/core/modules/file/file.field.inc
+++ b/core/modules/file/file.field.inc
@@ -182,7 +182,7 @@ function template_preprocess_file_upload_help(&$variables) {
$descriptions[] = t('!size limit.', array('!size' => format_size($upload_validators['file_validate_size'][0])));
}
if (isset($upload_validators['file_validate_extensions'])) {
- $descriptions[] = t('Allowed types: !extensions.', array('!extensions' => String::checkPlain($upload_validators['file_validate_extensions'][0])));
+ $descriptions[] = t('Allowed types: @extensions.', array('@extensions' => $upload_validators['file_validate_extensions'][0]));
}
if (isset($upload_validators['file_validate_image_resolution'])) {
diff --git a/core/modules/image/src/Tests/ImageFieldDisplayTest.php b/core/modules/image/src/Tests/ImageFieldDisplayTest.php
index 77d112b..24330bf 100644
--- a/core/modules/image/src/Tests/ImageFieldDisplayTest.php
+++ b/core/modules/image/src/Tests/ImageFieldDisplayTest.php
@@ -184,7 +184,7 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
$this->drupalGet('node/add/article');
$this->assertText(t('50 KB limit.'), 'Image widget max file size is displayed on article form.');
- $this->assertText(t('Allowed types: ' . $test_image_extension . '.'), 'Image widget allowed file types displayed on article form.');
+ $this->assertText(t('Allowed types: @extensions.', array('@extensions' => $test_image_extension)), 'Image widget allowed file types displayed on article form.');
$this->assertText(t('Images must be larger than 10x10 pixels. Images larger than 100x100 pixels will be resized.'), 'Image widget allowed resolution displayed on article form.');
// We have to create the article first and then edit it because the alt
diff --git a/core/modules/image/src/Tests/ImageFieldValidateTest.php b/core/modules/image/src/Tests/ImageFieldValidateTest.php
index 22daeb3..fb7e9a4 100644
--- a/core/modules/image/src/Tests/ImageFieldValidateTest.php
+++ b/core/modules/image/src/Tests/ImageFieldValidateTest.php
@@ -44,7 +44,7 @@ class ImageFieldValidateTest extends ImageFieldTestBase {
}
}
$this->uploadNodeImage($image_that_is_too_small, $field_name, 'article');
- $this->assertText(t('The specified file ' . $image_that_is_too_small->filename . ' could not be uploaded. The image is too small; the minimum dimensions are 50x50 pixels.'), 'Node save failed when minimum image resolution was not met.');
+ $this->assertRaw(t('The specified file %name could not be uploaded.', array('%name' => $image_that_is_too_small->filename)) . ' ' . t('The image is too small; the minimum dimensions are %dimensions pixels.', array('%dimensions' => '50x50')), 'Node save failed when minimum image resolution was not met.');
$this->uploadNodeImage($image_that_is_too_big, $field_name, 'article');
$this->assertText(t('The image was resized to fit within the maximum allowed dimensions of 100x100 pixels.'), 'Image exceeding max resolution was properly resized.');
}
diff --git a/core/modules/system/src/Tests/Entity/FieldSqlStorageTest.php b/core/modules/system/src/Tests/Entity/FieldSqlStorageTest.php
index e8e12d6..924164c 100644
--- a/core/modules/system/src/Tests/Entity/FieldSqlStorageTest.php
+++ b/core/modules/system/src/Tests/Entity/FieldSqlStorageTest.php
@@ -382,8 +382,8 @@ class FieldSqlStorageTest extends EntityUnitTestBase {
// Verify the indexes we will create do not exist yet.
foreach ($tables as $table) {
- $this->assertFalse(Database::getConnection()->schema()->indexExists($table, 'value'), t("No index named value exists in $table"));
- $this->assertFalse(Database::getConnection()->schema()->indexExists($table, 'value_format'), t("No index named value_format exists in $table"));
+ $this->assertFalse(Database::getConnection()->schema()->indexExists($table, 'value'), t("No index named value exists in @table", array('@table' => $table)));
+ $this->assertFalse(Database::getConnection()->schema()->indexExists($table, 'value_format'), t("No index named value_format exists in @table", array('@table' => $table)));
}
// Add data so the table cannot be dropped.
@@ -399,15 +399,15 @@ class FieldSqlStorageTest extends EntityUnitTestBase {
$field_storage->indexes = array('value' => array(array('value', 255)));
$field_storage->save();
foreach ($tables as $table) {
- $this->assertTrue(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value"), t("Index on value created in $table"));
+ $this->assertTrue(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value"), t("Index on value created in @table", array('@table' => $table)));
}
// Add a different index, removing the existing custom one.
$field_storage->indexes = array('value_format' => array(array('value', 127), array('format', 127)));
$field_storage->save();
foreach ($tables as $table) {
- $this->assertTrue(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value_format"), t("Index on value_format created in $table"));
- $this->assertFalse(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value"), t("Index on value removed in $table"));
+ $this->assertTrue(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value_format"), t("Index on value_format created in @table", array('@table' => $table)));
+ $this->assertFalse(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value"), t("Index on value removed in @table", array('@table' => $table)));
}
// Verify that the tables were not dropped in the process.
diff --git a/core/modules/system/src/Tests/Form/FormTest.php b/core/modules/system/src/Tests/Form/FormTest.php
index 5b517fd..2a995d9 100644
--- a/core/modules/system/src/Tests/Form/FormTest.php
+++ b/core/modules/system/src/Tests/Form/FormTest.php
@@ -301,21 +301,32 @@ class FormTest extends WebTestBase {
// Posting without any values should throw validation errors.
$this->drupalPostForm(NULL, array(), 'Submit');
- $this->assertNoText(t($error, array('!name' => $form['select']['#title'])));
- $this->assertNoText(t($error, array('!name' => $form['select_required']['#title'])));
- $this->assertNoText(t($error, array('!name' => $form['select_optional']['#title'])));
- $this->assertNoText(t($error, array('!name' => $form['empty_value']['#title'])));
- $this->assertNoText(t($error, array('!name' => $form['empty_value_one']['#title'])));
- $this->assertText(t($error, array('!name' => $form['no_default']['#title'])));
- $this->assertNoText(t($error, array('!name' => $form['no_default_optional']['#title'])));
- $this->assertText(t($error, array('!name' => $form['no_default_empty_option']['#title'])));
- $this->assertNoText(t($error, array('!name' => $form['no_default_empty_option_optional']['#title'])));
- $this->assertText(t($error, array('!name' => $form['no_default_empty_value']['#title'])));
- $this->assertText(t($error, array('!name' => $form['no_default_empty_value_one']['#title'])));
- $this->assertNoText(t($error, array('!name' => $form['no_default_empty_value_optional']['#title'])));
- $this->assertNoText(t($error, array('!name' => $form['multiple']['#title'])));
- $this->assertNoText(t($error, array('!name' => $form['multiple_no_default']['#title'])));
- $this->assertText(t($error, array('!name' => $form['multiple_no_default_required']['#title'])));
+ $no_errors = array(
+ 'select',
+ 'select_required',
+ 'select_optional',
+ 'empty_value',
+ 'empty_value_one',
+ 'no_default_optional',
+ 'no_default_empty_option_optional',
+ 'no_default_empty_value_optional',
+ 'multiple',
+ 'multiple_no_default',
+ );
+ foreach ($no_errors as $key) {
+ $this->assertNoText(t('!name field is required.', array('!name' => $form[$key]['#title'])));
+ }
+
+ $expected_errors = array(
+ 'no_default',
+ 'no_default_empty_option',
+ 'no_default_empty_value',
+ 'no_default_empty_value_one',
+ 'multiple_no_default_required',
+ );
+ foreach ($expected_errors as $key) {
+ $this->assertText(t('!name field is required.', array('!name' => $form[$key]['#title'])));
+ }
// Post values for required fields.
$edit = array(
diff --git a/core/modules/system/src/Tests/System/DateTimeTest.php b/core/modules/system/src/Tests/System/DateTimeTest.php
index b8770c8..a14d002 100644
--- a/core/modules/system/src/Tests/System/DateTimeTest.php
+++ b/core/modules/system/src/Tests/System/DateTimeTest.php
@@ -112,7 +112,7 @@ class DateTimeTest extends WebTestBase {
$this->clickLink(t('Delete'));
$this->drupalPostForm('admin/config/regional/date-time/formats/manage/' . $date_format_id . '/delete', array(), t('Remove'));
$this->assertEqual($this->getUrl(), url('admin/config/regional/date-time', array('absolute' => TRUE)), 'Correct page redirection.');
- $this->assertText(t('Removed date format ' . $name), 'Custom date format removed.');
+ $this->assertRaw(t('Removed date format %format.', array('%format' => $name)), 'Custom date format removed.');
// Make sure the date does not exist in config.
$date_format = entity_load('date_format', $date_format_id);