public function testGetContentDataWrongType()
 {
     $type = new ContactSelectionContentType($this->template, $this->contactManager->reveal(), $this->accountManager->reveal(), $this->serializer->reveal(), new CustomerIdConverter(), new IndexComparator());
     $this->property->getValue()->willReturn('blabla');
     $this->contactManager->getById(Argument::any(), Argument::any())->shouldNotBeCalled();
     $this->accountManager->getById(Argument::any(), Argument::any())->shouldNotBeCalled();
     $result = $type->getContentData($this->property->reveal());
     $this->assertCount(0, $result);
 }
Example #2
0
 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());
 }
 /**
  * @dataProvider provideGetReferencedUuids
  */
 public function testGetReferencedUuids($propertyValue, $expected)
 {
     $this->property->getValue()->willReturn($propertyValue);
     $uuids = $this->type->getReferencedUuids($this->property->reveal());
     $this->assertEquals($expected, $uuids);
 }