Prepare content data for the template.
public getContentData ( Sulu\Component\Content\Compat\PropertyInterface $property ) : array | ||
$property | Sulu\Component\Content\Compat\PropertyInterface | |
Résultat | array |
public function testResolve() { $this->contentTypeManager->get('content_type')->willReturn($this->contentType); $this->contentType->getViewData(Argument::any())->willReturn('view'); $this->contentType->getContentData(Argument::any())->willReturn('content'); $excerptExtension = $this->prophesize('Sulu\\Component\\Content\\Extension\\ExtensionInterface'); $excerptExtension->getContentData(['test1' => 'test1'])->willReturn(['test1' => 'test1']); $this->structureManager->getExtension('test', 'excerpt')->willReturn($excerptExtension); $property = $this->prophesize('Sulu\\Component\\Content\\Compat\\PropertyInterface'); $property->getName()->willReturn('property'); $property->getContentTypeName()->willReturn('content_type'); $structure = $this->prophesize('Sulu\\Component\\Content\\Compat\\Structure\\PageBridge'); $structure->getKey()->willReturn('test'); $structure->getExt()->willReturn(new ExtensionContainer(['excerpt' => ['test1' => 'test1']])); $structure->getUuid()->willReturn('some-uuid'); $structure->getProperties(true)->willReturn([$property->reveal()]); $structure->getCreator()->willReturn(1); $structure->getChanger()->willReturn(1); $structure->getCreated()->willReturn('date'); $structure->getChanged()->willReturn('date'); $structure->getPublished()->willReturn('date'); $structure->getPath()->willReturn('test-path'); $structure->getUrls()->willReturn(['en' => '/description', 'de' => '/beschreibung', 'es' => null]); $structure->getShadowBaseLanguage()->willReturn('en'); $expected = ['extension' => ['excerpt' => ['test1' => 'test1']], 'uuid' => 'some-uuid', 'view' => ['property' => 'view'], 'content' => ['property' => 'content'], 'creator' => 1, 'changer' => 1, 'created' => 'date', 'changed' => 'date', 'published' => 'date', 'template' => 'test', 'urls' => ['en' => '/description', 'de' => '/beschreibung', 'es' => null], 'path' => 'test-path', 'shadowBaseLocale' => 'en']; $this->assertEquals($expected, $this->structureResolver->resolve($structure->reveal())); }
public function testGetContentDataShadow() { $pageNode = $this->session->getNode('/cmf/sulu_io/contents/hotels'); $pageStructure = $this->contentMapper->loadByNode($pageNode, 'en', 'sulu_io', true, false, false); $property = $pageStructure->getProperty('hotels'); $data = $this->contentType->getContentData($property); $this->assertCount(2, $data); $hotel1 = reset($data); $this->assertEquals('Le grande budapest (en)', $hotel1['title']); $hotel2 = next($data); $this->assertEquals('L\'Hôtel New Hampshire', $hotel2['title']); }