protected function ImageTest::getTestImage in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Image/ImageTest.php \Drupal\Tests\Core\Image\ImageTest::getTestImage()
Get an image with a mocked toolkit, for testing.
Parameters
bool $load_expected: (optional) Whether the load() method is expected to be called. Defaults to TRUE.
array $stubs: (optional) Array containing toolkit methods to be replaced with stubs.
Return value
\Drupal\Core\Image\Image An image object.
10 calls to ImageTest::getTestImage()
- ImageTest::testChmodFails in core/
tests/ Drupal/ Tests/ Core/ Image/ ImageTest.php - Tests \Drupal\Core\Image\Image::save().
- ImageTest::testGetFileSize in core/
tests/ Drupal/ Tests/ Core/ Image/ ImageTest.php - Tests \Drupal\Core\Image\Image::getFileSize
- ImageTest::testGetHeight in core/
tests/ Drupal/ Tests/ Core/ Image/ ImageTest.php - Tests \Drupal\Core\Image\Image::getHeight().
- ImageTest::testGetMimeType in core/
tests/ Drupal/ Tests/ Core/ Image/ ImageTest.php - Tests \Drupal\Core\Image\Image::getMimeType().
- ImageTest::testGetToolkitId in core/
tests/ Drupal/ Tests/ Core/ Image/ ImageTest.php - Tests \Drupal\Core\Image\Image::getToolkitId().
File
- core/
tests/ Drupal/ Tests/ Core/ Image/ ImageTest.php, line 105 - Contains \Drupal\Tests\Core\Image\ImageTest.
Class
- ImageTest
- Tests the image class.
Namespace
Drupal\Tests\Core\ImageCode
protected function getTestImage($load_expected = TRUE, array $stubs = array()) {
if (!$load_expected && !in_array('load', $stubs)) {
$stubs = array_merge(array(
'load',
), $stubs);
}
$this->toolkit = $this
->getToolkitMock($stubs);
$this->toolkit
->expects($this
->any())
->method('getPluginId')
->will($this
->returnValue('gd'));
if (!$load_expected) {
$this->toolkit
->expects($this
->never())
->method('load');
}
$this->image = new Image($this->toolkit, $this->source);
}