コード例 #1
0
 function it_renders_field_with_data_via_appriopriate_field_type(GridView $gridView, Field $field, ServiceRegistryInterface $fieldsRegistry, FieldTypeInterface $fieldType)
 {
     $field->getType()->willReturn('string');
     $fieldsRegistry->get('string')->willReturn($fieldType);
     $fieldType->render($field, 'Value')->willReturn('<strong>Value</strong>');
     $this->renderField($gridView, $field, 'Value')->shouldReturn('<strong>Value</strong>');
 }
コード例 #2
0
ファイル: TwigGridRenderer.php プロジェクト: okwinza/Sylius
 /**
  * @param Field $field
  * @param $data
  */
 public function renderField(GridView $gridView, Field $field, $data)
 {
     $fieldType = $this->fieldsRegistry->get($field->getType());
     $resolver = new OptionsResolver();
     $fieldType->configureOptions($resolver);
     $options = $resolver->resolve($field->getOptions());
     return $fieldType->render($field, $data, $options);
 }
コード例 #3
0
 function it_renders_field_with_data_via_appropriate_field_type(GridView $gridView, Field $field, ServiceRegistryInterface $fieldsRegistry, FieldTypeInterface $fieldType)
 {
     $field->getType()->willReturn('string');
     $fieldsRegistry->get('string')->willReturn($fieldType);
     $fieldType->configureOptions(Argument::type(OptionsResolver::class))->will(function ($args) {
         $args[0]->setRequired('foo');
     });
     $field->getOptions()->willReturn(['foo' => 'bar']);
     $fieldType->render($field, 'Value', ['foo' => 'bar'])->willReturn('<strong>Value</strong>');
     $this->renderField($gridView, $field, 'Value')->shouldReturn('<strong>Value</strong>');
 }