summaryrefslogtreecommitdiff
path: root/vendor/league/glide/tests/Manipulators/SharpenTest.php
blob: d1fe2f971306b38dcff5bd864bd0f7aabff30657 (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 SharpenTest extends \PHPUnit_Framework_TestCase
{
    private $manipulator;

    public function setUp()
    {
        $this->manipulator = new Sharpen();
    }

    public function tearDown()
    {
        Mockery::close();
    }

    public function testCreateInstance()
    {
        $this->assertInstanceOf('League\Glide\Manipulators\Sharpen', $this->manipulator);
    }

    public function testRun()
    {
        $image = Mockery::mock('Intervention\Image\Image', function ($mock) {
            $mock->shouldReceive('sharpen')->with('10')->once();
        });

        $this->assertInstanceOf(
            'Intervention\Image\Image',
            $this->manipulator->setParams(['sharp' => '10'])->run($image)
        );
    }

    public function testGetPixelate()
    {
        $this->assertSame(10, $this->manipulator->setParams(['sharp' => '10'])->getSharpen());
        $this->assertSame(50, $this->manipulator->setParams(['sharp' => 50.5])->getSharpen());
        $this->assertSame(null, $this->manipulator->setParams(['sharp' => null])->getSharpen());
        $this->assertSame(null, $this->manipulator->setParams(['sharp' => 'a'])->getSharpen());
        $this->assertSame(null, $this->manipulator->setParams(['sharp' => '-1'])->getSharpen());
        $this->assertSame(null, $this->manipulator->setParams(['sharp' => '101'])->getSharpen());
    }
}