Completed
Push — ezp25875-richtext_image_embed_... ( 664516...e4c65d )
by
unknown
23:19
created

IsEmbedImageTest::viewParametersProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 5
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 8
rs 9.4285
1
<?php
2
/**
3
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
4
 * @license For full copyright and license information view LICENSE file distributed with this source code.
5
 */
6
namespace eZ\Publish\Core\MVC\Symfony\Matcher\Tests;
7
8
use eZ\Publish\Core\MVC\Symfony\Matcher\IsEmbedImage;
9
use eZ\Publish\Core\MVC\Symfony\View\ContentView;
10
use PHPUnit_Framework_TestCase;
11
12
/**
13
 * @covers \eZ\Publish\Core\MVC\Symfony\Matcher\IsEmbedImage
14
 */
15
class IsEmbedImageTest extends PHPUnit_Framework_TestCase
16
{
17
    /**
18
     * @expectedException \InvalidArgumentException
19
     * @expectedExceptionMessage The IsEmbedImage matcher expects a boolean value
20
     */
21
    public function testSetMatchingConfigException()
22
    {
23
        $matcher = new IsEmbedImage();
24
        $matcher->setMatchingConfig('some value');
25
    }
26
27
    /**
28
     * @dataProvider viewParametersProvider
29
     * @param array $objectParameters
30
     * @param bool $expectedResult
31
     */
32
    public function testMatch($objectParameters, $expectedResult)
33
    {
34
        $matcher = new IsEmbedImage();
35
        $matcher->setMatchingConfig(true);
36
        $view = new ContentView(null, $objectParameters);
37
38
        self::assertEquals($expectedResult, $matcher->match($view));
39
    }
40
41
    public function viewParametersProvider()
42
    {
43
        return [
44
            'no_objectParameters_parameter' => [[], false],
45
            'no_isImage_key' => [['objectParameters' => []], false],
46
            'is_embed_image' => [['objectParameters' => ['isImage' => true]], true],
47
        ];
48
    }
49
}
50