getType() public method

public getType ( )
 /**
  * It should create standard properties from "new" properties.
  */
 public function testCreateProperty()
 {
     $name = 'foo';
     $title = ['de' => 'Tite'];
     $description = ['de' => 'Description'];
     $placeholder = ['de' => 'Placehodler'];
     $type = 'type';
     $required = true;
     $localized = true;
     $maxOccurs = 1;
     $minOccurs = 1;
     $parameters = [['name' => 'prop', 'type' => 'type', 'value' => 'value', 'meta' => []], ['name' => 'propfoo', 'type' => 'type', 'value' => 'value', 'meta' => []]];
     $colSpan = 6;
     $this->property1->getType()->willReturn($type);
     $this->property1->getName()->willReturn($name);
     $this->property1->isRequired()->willReturn($required);
     $this->property1->isLocalized()->willReturn($required);
     $this->property1->getMaxOccurs()->willReturn($maxOccurs);
     $this->property1->getMinOccurs()->willReturn($minOccurs);
     $this->property1->getColSpan()->willReturn($colSpan);
     $this->property1->getParameters()->willReturn($parameters);
     $this->property1->title = $title;
     $this->property1->description = $description;
     $this->property1->placeholder = $placeholder;
     $legacyProperty = $this->factory->createProperty($this->property1->reveal());
     $this->assertInstanceOf(LegacyPropertyInterface::class, $legacyProperty);
     $this->assertEquals($legacyProperty->getContentTypeName(), $type);
     $this->assertEquals($legacyProperty->getName(), $name);
     $this->assertEquals($legacyProperty->getMandatory(), $required);
     $this->assertEquals($legacyProperty->getMultilingual(), $localized);
     $this->assertEquals($legacyProperty->getMaxOccurs(), $maxOccurs);
     $this->assertEquals($legacyProperty->getMinOccurs(), $minOccurs);
     $this->assertEquals($legacyProperty->getColspan(), $colSpan);
     $this->assertContainsOnlyInstancesOf(PropertyParameter::class, $legacyProperty->getParams());
     $this->assertArrayHasKey('prop', $legacyProperty->getParams());
     $this->assertArrayHasKey('propfoo', $legacyProperty->getParams());
     $this->assertEquals($title['de'], $legacyProperty->getTitle('de'));
     $this->assertEquals($description['de'], $legacyProperty->getInfoText('de'));
     $this->assertEquals($placeholder['de'], $legacyProperty->getPlaceholder('de'));
     return $this->property1;
 }
 private function doGetProperty($name, $contentTypeName, $locale)
 {
     $this->propertyMetadata->getType()->willReturn($contentTypeName);
     $this->structureMetadata->getProperty($name)->willReturn($this->propertyMetadata);
     $this->contentTypeManager->get($contentTypeName)->willReturn($this->contentType->reveal());
     if ($locale) {
         $this->propertyFactory->createTranslatedProperty($this->propertyMetadata->reveal(), $locale, Argument::type(StructureBridge::class))->willReturn($this->legacyProperty->reveal());
     } else {
         $this->propertyFactory->createProperty($this->propertyMetadata->reveal(), $locale)->willReturn($this->legacyProperty->reveal());
     }
     $this->contentType->read($this->node->reveal(), $this->legacyProperty->reveal(), null, null, null)->shouldBeCalledTimes(1);
     $property = $this->structure->getProperty($name);
     $this->assertInstanceOf(PropertyValue::class, $property);
     $this->assertEquals($name, $property->getName());
 }
Beispiel #3
0
 /**
  * Creates and returns a property-array.
  *
  * @param PropertyMetadata $property
  * @param PropertyValue $propertyValue
  * @param string $format
  *
  * @return array
  */
 protected function getPropertyData(PropertyMetadata $property, $propertyValue, $format)
 {
     return $this->createProperty($property->getName(), $this->contentExportManager->export($property->getType(), $propertyValue), $this->contentExportManager->getOptions($property->getType(), $format), $property->getType());
 }