コード例 #1
0
 /**
  * @return Symfony\Component\Config\Definition\Builder\TreeBuilder
  */
 public function getConfigTreeBuilder()
 {
     $treeBuilder = new TreeBuilder();
     $rootNode = $treeBuilder->root('codes');
     $rootNode->children()->scalarNode('offset')->end()->scalarNode('limit')->end()->arrayNode('coder')->prototype('scalar')->end()->validate()->always(function ($v) {
         if (empty($v['class'])) {
             $v['class'] = CodesConfiguration::getDefaultCoderClass();
         }
         return $v;
     })->end()->end();
     return $treeBuilder;
 }
コード例 #2
0
 public function testSetDefaultCoder()
 {
     CodesConfiguration::setDefaultCoderClass('MyClass');
     $config = $this->processConfiguration(array('coder' => array()));
     $this->assertEquals('MyClass', $config['coder']['class']);
 }