Commit 3992f9b6 authored by alexpott's avatar alexpott

Issue followup #1579810 by SeeSchloss, Albert Volkman, claudiu.cristea: Remove...

Issue followup #1579810 by SeeSchloss, Albert Volkman, claudiu.cristea: Remove t() and format_string() from toolkit tests.
parent f805ecfc
......@@ -9,6 +9,7 @@
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 @@ function testManipulations() {
// 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 @@ function testManipulations() {
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 @@ function testManipulations() {
}
$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)));
}
}
}
......
......@@ -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 @@ function assertToolkitOperationsCalled(array $expected) {
// 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.');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment