Completed
Push — refonte ( 64e01a...7173e3 )
by Arnaud
03:31
created

ActionTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testRender() 0 39 1
1
<?php
2
3
namespace LAG\AdminBundle\Tests\AdminBundle\Field;
4
5
use LAG\AdminBundle\Field\Field\Action;
6
use LAG\AdminBundle\Tests\AdminTestBase;
7
8
class ActionTest extends AdminTestBase
9
{
10
    public function testRender()
11
    {
12
        $twig = $this->getMockWithoutConstructor(\Twig_Environment::class);
13
        $twig
14
            ->expects($this->once())
15
            ->method('render')
16
            ->with('test.html.twig', [
17
                'text' => 'Some Title',
18
                'parameters' => [],
19
                'options' => [
20
                    'length' => null,
21
                    'parameters' => [],
22
                    'replace' => null,
23
                    'template' => 'test.html.twig',
24
                    'text' => null,
25
                    'translation' => false,
26
                    'title' => 'Some Title',
27
                ],
28
            ])
29
            ->willReturn('html content')
30
        ;
31
        
32
        $linkField = new Action('my-field');
33
        $linkField->setTwig($twig);
34
        
35
        $this->setPrivateProperty($linkField, 'options', [
36
            'length' => null,
37
            'parameters' => [],
38
            'replace' => null,
39
            'template' => 'test.html.twig',
40
            'text' => null,
41
            'translation' => false,
42
            'title' => 'Some Title',
43
        ]);
44
    
45
        $content = $linkField->render('a value');
46
        
47
        $this->assertEquals('html content', $content);
48
    }
49
}
50