| @@ 12-27 (lines=16) @@ | ||
| 9 | ||
| 10 | class ArrayFieldTest extends AdminTestBase |
|
| 11 | { |
|
| 12 | public function testRender() |
|
| 13 | { |
|
| 14 | $arrayField = new ArrayField('my-field'); |
|
| 15 | ||
| 16 | $this->setPrivateProperty($arrayField, 'options', [ |
|
| 17 | 'glue' => ', ', |
|
| 18 | ]); |
|
| 19 | ||
| 20 | $content = $arrayField->render([ |
|
| 21 | 'panda', |
|
| 22 | 'squirrel', |
|
| 23 | 'narwhal', |
|
| 24 | ]); |
|
| 25 | ||
| 26 | $this->assertEquals('panda, squirrel, narwhal', $content); |
|
| 27 | } |
|
| 28 | ||
| 29 | public function testRenderCollection() |
|
| 30 | { |
|
| @@ 29-45 (lines=17) @@ | ||
| 26 | $this->assertEquals('panda, squirrel, narwhal', $content); |
|
| 27 | } |
|
| 28 | ||
| 29 | public function testRenderCollection() |
|
| 30 | { |
|
| 31 | $arrayField = new ArrayField('my-field'); |
|
| 32 | ||
| 33 | $this->setPrivateProperty($arrayField, 'options', [ |
|
| 34 | 'glue' => ', ', |
|
| 35 | ]); |
|
| 36 | ||
| 37 | $collection = new ArrayCollection([ |
|
| 38 | 'panda', |
|
| 39 | 'squirrel', |
|
| 40 | 'narwhal', |
|
| 41 | ]); |
|
| 42 | $content = $arrayField->render($collection); |
|
| 43 | ||
| 44 | $this->assertEquals('panda, squirrel, narwhal', $content); |
|
| 45 | } |
|
| 46 | ||
| 47 | public function testRenderInvalidValue() |
|
| 48 | { |
|