mirror of
https://github.com/Intervention/image.git
synced 2025-09-03 10:53:01 +02:00
fixed issue when cloning Image objects
This commit is contained in:
@@ -1482,6 +1482,20 @@ class GdSystemTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertColorAtPosition('#939393', $img, 35, 35);
|
||||
}
|
||||
|
||||
public function testCloneImageObject()
|
||||
{
|
||||
$img = $this->manager()->make('tests/images/trim.png');
|
||||
$cln = clone $img;
|
||||
|
||||
// destroy original
|
||||
$img->destroy();
|
||||
unset($img);
|
||||
|
||||
// clone should be still intact
|
||||
$this->assertInstanceOf('Intervention\Image\Image', $cln);
|
||||
$this->assertInternalType('resource', $cln->getCore());
|
||||
}
|
||||
|
||||
private function assertColorAtPosition($color, $img, $x, $y)
|
||||
{
|
||||
$pick = $img->pickColor($x, $y, 'hex');
|
||||
|
@@ -1463,6 +1463,20 @@ class ImagickSystemTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertInstanceOf('Intervention\Image\Image', $img);
|
||||
}
|
||||
|
||||
public function testCloneImageObject()
|
||||
{
|
||||
$img = $this->manager()->make('tests/images/trim.png');
|
||||
$cln = clone $img;
|
||||
|
||||
// destroy original
|
||||
$img->destroy();
|
||||
unset($img);
|
||||
|
||||
// clone should be still intact
|
||||
$this->assertInstanceOf('Intervention\Image\Image', $cln);
|
||||
$this->assertInstanceOf('Imagick', $cln->getCore());
|
||||
}
|
||||
|
||||
private function assertColorAtPosition($color, $img, $x, $y)
|
||||
{
|
||||
$pick = $img->pickColor($x, $y, 'hex');
|
||||
|
Reference in New Issue
Block a user