mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
refs #265 add a first test + consistency of parameters
This commit is contained in:
parent
b914229c11
commit
b826d8e132
@ -26,10 +26,11 @@ class ChillCustomFieldsExtension extends Extension
|
||||
$loader->load('services.yml');
|
||||
|
||||
//add at least a blank array at 'customizable_entities' options
|
||||
$customizable_entities = (isset($config['customizables_entities'])
|
||||
&& count($config['customizables_entities']) > 0)
|
||||
? $config['customizables_entities'] : array();
|
||||
//$customizable_entities = (isset($config['customizables_entities'])
|
||||
// && $config['customizables_entities'] !== FALSE)
|
||||
// ? $config['customizables_entities'] : array();
|
||||
|
||||
$container->setParameter('chill_custom_fields.customizable_entities', $customizable_entities);
|
||||
$container->setParameter('chill_custom_fields.customizables_entities',
|
||||
$config['customizables_entities']);
|
||||
}
|
||||
}
|
||||
|
@ -22,10 +22,13 @@ class Configuration implements ConfigurationInterface
|
||||
|
||||
$classInfo = "The class which may receive custom fields";
|
||||
$nameInfo = "The name which will appears in the user interface. May be translatable";
|
||||
$customizableEntitiesInfo = "A list of customizable entities";
|
||||
|
||||
$rootNode
|
||||
->children()
|
||||
->arrayNode('customizables_entities')
|
||||
->info($customizableEntitiesInfo)
|
||||
->defaultValue(array())
|
||||
->prototype('array')
|
||||
->children()
|
||||
->scalarNode('class')->isRequired()->info($classInfo)->end()
|
||||
|
@ -18,7 +18,7 @@ services:
|
||||
chill.custom_field.custom_fields_group_type:
|
||||
class: Chill\CustomFieldsBundle\Form\CustomFieldsGroupType
|
||||
arguments:
|
||||
- %chill_custom_fields.customizable_entities%
|
||||
- %chill_custom_fields.customizables_entities%
|
||||
- "@translator"
|
||||
tags:
|
||||
- { name: 'form.type', alias: 'custom_fields_group' }
|
||||
|
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Chill\CustomFieldsBundle\Tests\Config;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
|
||||
/**
|
||||
* Test the option Customizables_entities
|
||||
*
|
||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||
*/
|
||||
class ConfigCustomizablesEntitiesTest extends KernelTestCase
|
||||
{
|
||||
public function testEmptyConfig()
|
||||
{
|
||||
self::bootKernel(array('environment' => 'test'));
|
||||
$customizableEntities = static::$kernel->getContainer()
|
||||
->getParameter('chill_custom_fields.customizables_entities');
|
||||
|
||||
$this->assertInternalType('array', $customizableEntities);
|
||||
$this->assertCount(0, $customizableEntities);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user