Completed
Pull Request — master (#732)
by 12345
03:41
created

testLoad()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 9

Duplication

Lines 15
Ratio 100 %
Metric Value
dl 15
loc 15
rs 9.4285
cc 1
eloc 9
nc 1
nop 0
1
<?php
2
3
namespace Liip\ImagineBundle\Tests\Filter;
4
5
use Imagine\Gd\Imagine;
6
use Liip\ImagineBundle\Imagine\Filter\Loader\UpscaleFilterLoader;
7
use Liip\ImagineBundle\Tests\AbstractTest;
8
9
/**
10
 * @covers Liip\ImagineBundle\Imagine\Filter\Loader\UpscaleFilterLoader
11
 *
12
 * Due to int casting in Imagine\Image\Box which can lead to wrong pixel
13
 * numbers ( e.g. float(201) casted to int(200) ). Solved by round the
14
 * floating number before passing to the Box constructor.
15
 */
16 View Code Duplication
class FloatToIntCastByRoundUpscaleFilterLoaderTest extends AbstractTest
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
{
18
    public function testLoad()
19
    {
20
        $loader = new UpscaleFilterLoader();
21
        $imagine = new Imagine();
22
        $image = $imagine->open(__DIR__.'/../../../Fixtures/assets/square-50x50.png');
23
24
        $options = array(
25
            'min' => array(201, 201),
26
        );
27
28
        $image = $loader->load($image, $options);
29
        $size = $image->getSize();
30
31
        $this->assertEquals($options['min'], array($size->getWidth(), $size->getHeight()));
32
    }
33
}
34