예제 #1
0
 public function testSetDefaultOptionsCustomAddLabel()
 {
     $resolver = $this->getOptionsResolver();
     $this->type->setDefaultOptions($resolver);
     $options = ['type' => 'test_type', 'add_label' => 'Test Label'];
     $resolvedOptions = $resolver->resolve($options);
     $this->assertEquals(['type' => 'test_type', 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false, 'prototype' => true, 'prototype_name' => '__name__', 'extra_fields_message' => 'This form should not contain extra fields: "{{ extra_fields }}"', 'handle_primary' => true, 'show_form_when_empty' => true, 'add_label' => 'Test Label', 'allow_add_after' => false, 'row_count_add' => 1, 'row_count_initial' => 1], $resolvedOptions);
 }
예제 #2
0
 public function testSetDefaultOptionsDisableShowFormWhenEmpty()
 {
     $resolver = $this->getOptionsResolver();
     $this->type->setDefaultOptions($resolver);
     $options = ['type' => 'test_type', 'show_form_when_empty' => false];
     $resolvedOptions = $resolver->resolve($options);
     $this->assertEquals(['type' => 'test_type', 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false, 'prototype' => true, 'prototype_name' => '__name__', 'extra_fields_message' => 'This form should not contain extra fields: "{{ extra_fields }}"', 'handle_primary' => true, 'show_form_when_empty' => false], $resolvedOptions);
 }
 public function testSetDefaultOptions()
 {
     $resolver = $this->getMock('Symfony\\Component\\OptionsResolver\\OptionsResolverInterface');
     $resolver->expects($this->once())->method('setDefaults')->with($this->isType('array'));
     $this->type->setDefaultOptions($resolver);
 }