/**
  * @param \Symfony\Component\Form\FormFactoryInterface $formFactory
  * @param \Symfony\Component\Form\Test\FormBuilderInterface $formBuilder
  * @param \FSi\Bundle\AdminBundle\Admin\ResourceRepository\GenericResourceElement $element
  * @param \FSi\Bundle\ResourceRepositoryBundle\Model\ResourceValueRepository $valueRepository
  * @param \FSi\Bundle\ResourceRepositoryBundle\Model\ResourceValue $resourceValue
  * @param \Symfony\Component\Form\FormInterface $form
  */
 function it_builds_form_for_resource_group($formFactory, $formBuilder, $element, $valueRepository, $resourceValue, $form)
 {
     $element->getKey()->willReturn('resources');
     $valueRepository->get('resources.resource_key')->willReturn($resourceValue);
     $formFactory->createBuilder('form', array('resources_resource_key' => $resourceValue), array('form_options'))->willReturn($formBuilder);
     $formBuilder->add('resources_resource_key', 'resource', array('resource_key' => 'resources.resource_key'))->shouldBeCalled();
     $formBuilder->getForm()->willReturn($form);
     $this->build($element)->shouldReturn($form);
 }
Esempio n. 2
0
 /**
  * @param GenericResourceElement $element
  * @param string $resourceKey
  * @return string
  */
 private function buildResourceName(GenericResourceElement $element, $resourceKey)
 {
     return sprintf("%s.%s", $element->getKey(), $resourceKey);
 }