function it_builds_a_form($taxonomyRepository, $taxonRepository, FormBuilderInterface $builder, DataTransformerInterface $dataTransformer, Taxonomy $taxonomy, Taxon $taxon)
 {
     $taxonomyRepository->findAll()->shouldBeCalled()->willReturn(array($taxonomy));
     $taxonRepository->getTaxonsAsList($taxonomy)->shouldBeCalled()->willReturn(array($taxon));
     $taxonomy->getId()->shouldBeCalled()->willreturn(12);
     $taxonomy->getName()->shouldBeCalled()->willReturn('taxonomy name');
     $taxon->__toString()->shouldBeCalled()->willReturn('taxon name');
     $builder->addModelTransformer(Argument::any())->shouldBeCalled();
     $builder->add(12, 'choice', Argument::withKey('choice_list'))->shouldBeCalled();
     $this->buildForm($builder, array('model_transformer' => array('class' => $dataTransformer, 'save_objects' => false), 'multiple' => true));
 }
Beispiel #2
0
 public function __construct()
 {
     parent::__construct();
     $this->createdAt = new \DateTime();
     $this->products = new ArrayCollection();
     $this->images = new ArrayCollection();
 }
Beispiel #3
0
 function it_also_sets_name_on_the_root_taxon(Taxon $taxon)
 {
     $taxon->setName('Category')->shouldBeCalled();
     $taxon->setTaxonomy($this)->shouldBeCalled();
     $taxon->setCurrentLocale('en_US')->shouldBeCalled();
     $taxon->setFallbackLocale('en_US')->shouldBeCalled();
     $this->setRoot($taxon);
     $this->setName('Category');
 }
Beispiel #4
0
 function it_also_sets_translation_on_root_taxon(Taxon $taxon, TaxonomyTranslation $translation)
 {
     $translation->getName()->willReturn('New');
     $translation->getLocale()->shouldBeCalled();
     $translation->setTranslatable($this)->shouldBeCalled();
     $taxon->setName('New')->shouldBeCalled();
     $taxon->setTaxonomy($this)->shouldBeCalled();
     $taxon->setCurrentLocale(Argument::any())->shouldBeCalled();
     $taxon->setFallbackLocale(Argument::any())->shouldBeCalled();
     $this->setRoot($taxon);
     $this->addTranslation($translation);
 }