コード例 #1
0
 /**
  * @group legacy
  */
 public function testCreateNamedBuilderWithTypeInstanceWithParentTypeInstance()
 {
     $options = array('a' => '1', 'b' => '2');
     $resolvedOptions = array('a' => '2', 'b' => '3');
     $type = new LegacyFooSubTypeWithParentInstance();
     $resolvedType = $this->getMockResolvedType();
     $parentResolvedType = $this->getMockResolvedType();
     $this->resolvedTypeFactory->expects($this->at(0))->method('createResolvedType')->with($type->getParent())->will($this->returnValue($parentResolvedType));
     $this->resolvedTypeFactory->expects($this->at(1))->method('createResolvedType')->with($type, array(), $parentResolvedType)->will($this->returnValue($resolvedType));
     $resolvedType->expects($this->once())->method('createBuilder')->with($this->factory, 'name', $options)->will($this->returnValue($this->builder));
     $this->builder->expects($this->any())->method('getOptions')->will($this->returnValue($resolvedOptions));
     $resolvedType->expects($this->once())->method('buildForm')->with($this->builder, $resolvedOptions);
     $this->assertSame($this->builder, $this->factory->createNamedBuilder('name', $type, null, $options));
 }
コード例 #2
0
ファイル: FormRegistryTest.php プロジェクト: Kyra2778/AMR
 /**
  * @group legacy
  */
 public function testGetTypeConnectsParentIfGetParentReturnsInstance()
 {
     $type = new LegacyFooSubTypeWithParentInstance();
     $parentResolvedType = new ResolvedFormType($type->getParent());
     $resolvedType = new ResolvedFormType($type);
     $this->extension1->addType($type);
     $this->resolvedTypeFactory->expects($this->at(0))->method('createResolvedType')->with($type->getParent())->willReturn($parentResolvedType);
     $this->resolvedTypeFactory->expects($this->at(1))->method('createResolvedType')->with($type, array(), $parentResolvedType)->willReturn($resolvedType);
     $this->assertSame($resolvedType, $this->registry->getType('foo_sub_type_parent_instance'));
 }