summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2013-10-14 08:30:08 (GMT)
committerAlex Pott2013-10-14 08:30:08 (GMT)
commit3992f9b68c001d1a387cb3a21d9c8a55681867c6 (patch)
treec0a7e62e3f79ae4595d840b552c348b57caec341
parentf805ecfc75e8a757624434447120c18ea715c2d7 (diff)
Issue followup #1579810 by SeeSchloss, Albert Volkman, claudiu.cristea: Remove t() and format_string() from toolkit tests.
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Image/ToolkitGdTest.php11
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTestBase.php7
2 files changed, 10 insertions, 8 deletions
diff --git a/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitGdTest.php b/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitGdTest.php
index 20005e6..89b9645 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitGdTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitGdTest.php
@@ -9,6 +9,7 @@ namespace Drupal\system\Tests\Image;
use Drupal\Core\Image\ImageInterface;
use Drupal\simpletest\DrupalUnitTestBase;
+use Drupal\Component\Utility\String;
/**
* Test the core GD image manipulation functions.
@@ -222,13 +223,13 @@ class ToolkitGdTest extends DrupalUnitTestBase {
// Load up a fresh image.
$image = $image_factory->get(drupal_get_path('module', 'simpletest') . '/files/' . $file);
if (!$image) {
- $this->fail(t('Could not load image %file.', array('%file' => $file)));
+ $this->fail(String::format('Could not load image %file.', array('%file' => $file)));
continue 2;
}
// All images should be converted to truecolor when loaded.
$image_truecolor = imageistruecolor($image->getResource());
- $this->assertTrue($image_truecolor, format_string('Image %file after load is a truecolor image.', array('%file' => $file)));
+ $this->assertTrue($image_truecolor, String::format('Image %file after load is a truecolor image.', array('%file' => $file)));
if ($image->getType() == IMAGETYPE_GIF) {
if ($op == 'desaturate') {
@@ -259,8 +260,8 @@ class ToolkitGdTest extends DrupalUnitTestBase {
file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
$image->save($directory . '/' . $op . '.' . $image->getExtension());
- $this->assertTrue($correct_dimensions_real, format_string('Image %file after %action action has proper dimensions.', array('%file' => $file, '%action' => $op)));
- $this->assertTrue($correct_dimensions_object, format_string('Image %file object after %action action is reporting the proper height and width values.', array('%file' => $file, '%action' => $op)));
+ $this->assertTrue($correct_dimensions_real, String::format('Image %file after %action action has proper dimensions.', array('%file' => $file, '%action' => $op)));
+ $this->assertTrue($correct_dimensions_object, String::format('Image %file object after %action action is reporting the proper height and width values.', array('%file' => $file, '%action' => $op)));
// JPEG colors will always be messed up due to compression.
if ($image->getType() != IMAGETYPE_JPEG) {
@@ -287,7 +288,7 @@ class ToolkitGdTest extends DrupalUnitTestBase {
}
$color = $this->getPixelColor($image, $x, $y);
$correct_colors = $this->colorsAreEqual($color, $corner);
- $this->assertTrue($correct_colors, format_string('Image %file object after %action action has the correct color placement at corner %corner.', array('%file' => $file, '%action' => $op, '%corner' => $key)));
+ $this->assertTrue($correct_colors, String::format('Image %file object after %action action has the correct color placement at corner %corner.', array('%file' => $file, '%action' => $op, '%corner' => $key)));
}
}
}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTestBase.php
index 74caee4..ce328aa 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTestBase.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTestBase.php
@@ -8,6 +8,7 @@
namespace Drupal\system\Tests\Image;
use Drupal\simpletest\WebTestBase;
+use Drupal\Component\Utility\String;
/**
* Base class for image manipulation testing.
@@ -89,16 +90,16 @@ abstract class ToolkitTestBase extends WebTestBase {
// Determine if there were any expected that were not called.
$uncalled = array_diff($expected, $actual);
if (count($uncalled)) {
- $this->assertTrue(FALSE, format_string('Expected operations %expected to be called but %uncalled was not called.', array('%expected' => implode(', ', $expected), '%uncalled' => implode(', ', $uncalled))));
+ $this->assertTrue(FALSE, String::format('Expected operations %expected to be called but %uncalled was not called.', array('%expected' => implode(', ', $expected), '%uncalled' => implode(', ', $uncalled))));
}
else {
- $this->assertTrue(TRUE, format_string('All the expected operations were called: %expected', array('%expected' => implode(', ', $expected))));
+ $this->assertTrue(TRUE, String::format('All the expected operations were called: %expected', array('%expected' => implode(', ', $expected))));
}
// Determine if there were any unexpected calls.
$unexpected = array_diff($actual, $expected);
if (count($unexpected)) {
- $this->assertTrue(FALSE, format_string('Unexpected operations were called: %unexpected.', array('%unexpected' => implode(', ', $unexpected))));
+ $this->assertTrue(FALSE, String::format('Unexpected operations were called: %unexpected.', array('%unexpected' => implode(', ', $unexpected))));
}
else {
$this->assertTrue(TRUE, 'No unexpected operations were called.');