Completed
Push — dev ( 5c06f5...dcd39b )
by Arnaud
09:19
created

ArrayFieldTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testRender() 0 20 1
1
<?php
2
3
namespace AdminBundle\Admin\Field;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use LAG\AdminBundle\Field\Field\ArrayField;
7
use LAG\AdminBundle\Tests\Base;
8
9
class ArrayFieldTest extends Base
10
{
11
    public function testRender()
12
    {
13
        $arrayField = new ArrayField ();
14
        $arrayField->setOptions([
15
            'glue' => ', '
16
        ]);
17
        // test simple string array
18
        $value = [
19
            'test',
20
            'lol',
21
            'panda'
22
        ];
23
        $this->assertEquals('test, lol, panda', $arrayField->render($value));
24
        // test with array collection
25
        $value = new ArrayCollection();
26
        $value->add('test');
27
        $value->add('lol');
28
        $value->add('panda');
29
        $this->assertEquals('test, lol, panda', $arrayField->render($value));
30
    }
31
}
32