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

IsEmbedImageTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 35
rs 10
wmc 3
lcom 0
cbo 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testSetMatchingConfigException() 0 5 1
A testMatch() 0 8 1
A viewParametersProvider() 0 8 1
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