Completed
Push — master ( 906add...e6fdb6 )
by
unknown
18:20 queued 11s
created

ImagineCompatibleResizerTraitTest::getModes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\MediaBundle\Tests\Resizer;
15
16
use Imagine\Image\ImageInterface;
17
use PHPUnit\Framework\TestCase;
18
use Sonata\MediaBundle\Resizer\ImagineCompatibleResizerTrait;
19
20
class ImagineCompatibleResizerTraitTest extends TestCase
21
{
22
    /**
23
     * @dataProvider getModes
24
     */
25
    public function testModeConversion($mode, $result): void
26
    {
27
        $objectWithTrait = $this->getObjectForTrait(ImagineCompatibleResizerTrait::class);
28
        $reflection = new \ReflectionObject($objectWithTrait);
29
        $method = $reflection->getMethod('convertMode');
30
        $method->setAccessible(true);
31
32
        $convertedMode = $method->invokeArgs($objectWithTrait, [$mode]);
33
34
        $this->assertSame($result, $convertedMode);
35
    }
36
37
    public static function getModes()
38
    {
39
        return [
40
            ['inset', ImageInterface::THUMBNAIL_INSET],
41
            ['outbound', ImageInterface::THUMBNAIL_OUTBOUND],
42
        ];
43
    }
44
}
45