Issue followup #1579810 by SeeSchloss, Albert Volkman, claudiu.cristea: Remove t() and format_string() from toolkit tests.

8.0.x
Alex Pott 2013-10-14 09:30:08 +01:00
parent f805ecfc75
commit 3992f9b68c
2 changed files with 10 additions and 8 deletions

View File

@ -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)));
}
}
}

View File

@ -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.');