silverstripe-framework/tests/model/ImagickImageTest.php

30 lines
700 B
PHP
Raw Normal View History

<?php
class ImagickImageTest extends ImageTest {
public function setUp() {
if(!extension_loaded("imagick")) {
$this->markTestSkipped("The Imagick extension is not available.");
$this->skipTest = true;
parent::setUp();
return;
}
2014-08-15 08:53:05 +02:00
parent::setUp();
2014-08-15 08:53:05 +02:00
Image::set_backend("ImagickBackend");
2014-08-15 08:53:05 +02:00
// Create a test files for each of the fixture references
$fileIDs = $this->allFixtureIDs('Image');
foreach($fileIDs as $fileID) {
$file = DataObject::get_by_id('Image', $fileID);
2014-08-15 08:53:05 +02:00
$image = new Imagick();
2014-08-15 08:53:05 +02:00
$image->newImage(300,300, new ImagickPixel("white"));
$image->setImageFormat("png");
$image->writeImage(BASE_PATH."/{$file->Filename}");
2014-08-15 08:53:05 +02:00
$file->write();
}
}
}