Nextrek
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
<?php
use Intervention\Image\Gd\Shapes\CircleShape as CircleGd;
use Intervention\Image\Imagick\Shapes\CircleShape as CircleImagick;
class CircleShapeTest extends PHPUnit_Framework_TestCase
{
public function tearDown()
{
Mockery::close();
}
public function testGdConstructor()
{
$circle = new CircleGd(250);
$this->assertInstanceOf('Intervention\Image\Gd\Shapes\CircleShape', $circle);
$this->assertEquals(250, $circle->diameter);
}
public function testGdApplyToImage()
{
$core = imagecreatetruecolor(300, 200);
$image = Mockery::mock('\Intervention\Image\Image');
$image->shouldReceive('getCore')->once()->andReturn($core);
$circle = new CircleGd(250);
$result = $circle->applyToImage($image, 10, 20);
$this->assertInstanceOf('Intervention\Image\Gd\Shapes\CircleShape', $circle);
$this->assertTrue($result);
}
public function testImagickConstructor()
{
$circle = new CircleImagick(250);
$this->assertInstanceOf('Intervention\Image\Imagick\Shapes\CircleShape', $circle);
$this->assertEquals(250, $circle->width);
}
public function testImagickApplyToImage()
{
$core = Mockery::mock('\Imagick');
$core->shouldReceive('drawimage')->once();
$image = Mockery::mock('\Intervention\Image\Image');
$image->shouldReceive('getCore')->once()->andReturn($core);
$circle = new CircleImagick(250);
$result = $circle->applyToImage($image, 10, 20);
$this->assertInstanceOf('Intervention\Image\Imagick\Shapes\CircleShape', $circle);
$this->assertTrue($result);
}
}
|
Revision |
Author |
Commited |
Message |
1464
|
MOliva
|
Tue 13 Oct, 2020 11:16:56 +0000 |
|