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

ArrayFieldTest::testRender()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 2 Features 1
Metric Value
c 2
b 2
f 1
dl 0
loc 20
rs 9.4285
cc 1
eloc 14
nc 1
nop 0
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