/** * It should create a section property. * * @depends testCreateProperty */ public function testCreateSection($property) { $name = 'foo'; $parameters = ['foo', 'bar']; $colSpan = 6; $title = ['de' => 'Tite']; $description = ['de' => 'Description']; $this->section->getName()->willReturn($name); $this->section->getColSpan()->willReturn($colSpan); $this->section->getParameters()->willReturn($parameters); $this->section->title = $title; $this->section->description = $description; $this->section->getChildren()->willReturn([$property->reveal()]); $legacyProperty = $this->factory->createProperty($this->section->reveal()); $this->assertInstanceOf(SectionPropertyInterface::class, $legacyProperty); $this->assertEquals($name, $legacyProperty->getName()); $this->assertEquals($colSpan, $legacyProperty->getColspan()); $this->assertEquals($title['de'], $legacyProperty->getTitle('de')); $this->assertEquals($description['de'], $legacyProperty->getInfoText('de')); $this->assertCount(1, $legacyProperty->getChildProperties()); }
private function createSectionProperty(SectionMetadata $property, StructureInterface $structure = null) { $sectionProperty = new SectionProperty($property->getName(), ['title' => $property->title, 'info_text' => $property->description], $property->getColspan()); foreach ($property->getChildren() as $child) { $sectionProperty->addChild($this->createProperty($child, $structure)); } return $sectionProperty; }