protected function getExtensions()
 {
     $extensions = parent::getExtensions();
     if (!version_compare(Kernel::VERSION, '2.8.0', '>=')) {
         $guesser = $this->getMock('Symfony\\Component\\Form\\FormTypeGuesserInterface');
         $extension = new TestExtension($guesser);
         $extension->addType(new CollectionType());
         $extensions[] = $extension;
     }
     return $extensions;
 }
 protected function getExtensions()
 {
     $extensions = parent::getExtensions();
     $guesser = $this->getMock('Symfony\\Component\\Form\\FormTypeGuesserInterface');
     $extension = new TestExtension($guesser);
     if (!method_exists('Symfony\\Component\\Form\\AbstractType', 'getBlockPrefix')) {
         $extension->addType(new CollectionType());
     }
     $extension->addTypeExtension(new FormTypeFieldExtension(array(), array('form_type' => 'vertical')));
     $extensions[] = $extension;
     return $extensions;
 }
Ejemplo n.º 3
0
 public function testHasTypeAfterLoadingFromExtension()
 {
     $type = new FooType();
     $this->assertFalse($this->registry->hasType('foo'));
     $this->extension2->addType($type);
     $this->assertTrue($this->registry->hasType('foo'));
 }
Ejemplo n.º 4
0
 public function testLegacyHasTypeAfterLoadingFromExtension()
 {
     $type = new LegacyFooType();
     $resolvedType = new ResolvedFormType($type);
     $this->resolvedTypeFactory->expects($this->once())->method('createResolvedType')->with($type)->willReturn($resolvedType);
     $this->extension2->addType($type);
     $this->assertTrue($this->registry->hasType('foo'));
 }
Ejemplo n.º 5
0
 public function testHasTypeAfterLoadingFromExtension()
 {
     $type = new FooType();
     $resolvedType = $this->getMock('Symfony\\Component\\Form\\ResolvedFormTypeInterface');
     $this->resolvedTypeFactory->expects($this->once())->method('createResolvedType')->with($type)->will($this->returnValue($resolvedType));
     $resolvedType->expects($this->any())->method('getName')->will($this->returnValue('foo'));
     $this->assertFalse($this->registry->hasType('foo'));
     $this->extension2->addType($type);
     $this->assertTrue($this->registry->hasType('foo'));
 }
 protected function getExtensions()
 {
     $mock = $this->getMockBuilder('Symfony\\Component\\Translation\\TranslatorInterface')->getMock();
     $mock->expects($this->exactly(3))->method('trans')->will($this->returnCallback(function ($arg) {
         return $arg;
     }));
     $extensions = parent::getExtensions();
     $guesser = $this->getMock('Symfony\\Component\\Form\\FormTypeGuesserInterface');
     $extension = new TestExtension($guesser);
     $type = new ChoiceType($mock);
     $extension->addType($type);
     if (!$extension->hasType($this->getParentClass())) {
         $reflection = new \ReflectionClass($extension);
         $property = $reflection->getProperty('types');
         $property->setAccessible(true);
         $property->setValue($extension, array(get_class($type) => current($property->getValue($extension))));
     }
     $extensions[] = $extension;
     return $extensions;
 }