/** * @dataProvider provideIndex */ public function testIndex($format, $expectedException) { if ($expectedException) { $this->setExpectedException($expectedException); } $this->media->setFormats([$format => 'myimage.jpg']); $testAdapter = $this->container->get('massive_search.adapter.test'); $document = $this->documentManager->create('page'); $document->setTitle('Hallo'); $document->setResourceSegment('/hallo/fo'); $document->setStructureType('images'); $document->setParent($this->webspaceDocument); $document->getStructure()->bind(['images' => $this->mediaSelectionContainer->reveal()], false); $this->documentManager->persist($document, 'de'); $this->documentManager->flush(); $documents = $testAdapter->getDocuments(); $this->assertCount(1, $documents); $document = current($documents); $this->assertInstanceOf('Massive\\Bundle\\SearchBundle\\Search\\Document', $document); $this->assertEquals('myimage.jpg', $document->getImageUrl()); }
/** * {@inheritDoc} */ public function getContentData(PropertyInterface $property) { $data = $property->getValue(); $params = $this->getParams($property->getParams()); $types = $params['types']->getValue(); $container = new MediaSelectionContainer(isset($data['config']) ? $data['config'] : [], isset($data['displayOption']) ? $data['displayOption'] : '', isset($data['ids']) ? $data['ids'] : [], $property->getStructure()->getLanguageCode(), $types, $this->mediaManager); return $container->getData(); }