blob: 8d0b315e99edfef6254d53fadfd79b7e2c0edb2b (
plain)
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
|
<?php
namespace League\Glide\Manipulators;
use Mockery;
class BlurTest extends \PHPUnit_Framework_TestCase
{
private $manipulator;
public function setUp()
{
$this->manipulator = new Blur();
}
public function tearDown()
{
Mockery::close();
}
public function testCreateInstance()
{
$this->assertInstanceOf('League\Glide\Manipulators\Blur', $this->manipulator);
}
public function testRun()
{
$image = Mockery::mock('Intervention\Image\Image', function ($mock) {
$mock->shouldReceive('blur')->with('10')->once();
});
$this->assertInstanceOf(
'Intervention\Image\Image',
$this->manipulator->setParams(['blur' => 10])->run($image)
);
}
public function testGetBlur()
{
$this->assertSame(50, $this->manipulator->setParams(['blur' => '50'])->getBlur());
$this->assertSame(50, $this->manipulator->setParams(['blur' => 50])->getBlur());
$this->assertSame(null, $this->manipulator->setParams(['blur' => null])->getBlur());
$this->assertSame(null, $this->manipulator->setParams(['blur' => 'a'])->getBlur());
$this->assertSame(null, $this->manipulator->setParams(['blur' => '-1'])->getBlur());
$this->assertSame(null, $this->manipulator->setParams(['blur' => '101'])->getBlur());
}
}
|