mirror of
https://github.com/Intervention/image.git
synced 2025-08-30 01:00:06 +02:00
added ImageBackupNotAvailableException
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Intervention\Image\Exception;
|
||||
|
||||
class ImageBackupNotAvailableException extends \RuntimeException
|
||||
{
|
||||
# nothing to override
|
||||
}
|
@@ -1469,6 +1469,8 @@ class Image
|
||||
if ($this->isImageResource($this->original)) {
|
||||
is_resource($this->resource) ? imagedestroy($this->resource) : null;
|
||||
$this->initFromResource($this->original);
|
||||
} else {
|
||||
throw new Exception\ImageBackupNotAvailableException('backup() must be called first to use reset().');
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
@@ -1419,6 +1419,15 @@ class ImageTest extends PHPUnit_Framework_Testcase
|
||||
$this->assertEquals('#0000ff', $img->pickColor(0, 0, 'hex'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Intervention\Image\Exception\ImageBackupNotAvailableException
|
||||
*/
|
||||
public function testResetImageWithoutBackup()
|
||||
{
|
||||
$img = $this->getTestImage();
|
||||
$img->reset();
|
||||
}
|
||||
|
||||
public function testBackup()
|
||||
{
|
||||
$img = new Image(null, 800, 600, '#0000ff');
|
||||
|
Reference in New Issue
Block a user