public function setUp() { $this->setApplicationConfig(include __DIR__ . '/../../TestConfig.php.dist'); parent::setUp(); $json = json_decode(file_get_contents(__DIR__ . '/../../fixtures/document.json')); $this->document = \Prismic\Document::parse($json); }
public function testSlices() { $response = json_decode(file_get_contents(__DIR__ . '/../fixtures/slices.json')); $document = Document::parse($response->results[0]); $slices = $document->getSliceZone('article.blocks'); $this->assertEquals($slices->asText(), "C'est un bloc content"); $this->assertEquals($slices->asHtml(), '<div data-slicetype="features" class="slice"><div class="group-doc"><section data-field="illustration"><img src="https://wroomdev.s3.amazonaws.com/toto/db3775edb44f9818c54baa72bbfc8d3d6394b6ef_hsf_evilsquall.jpg" alt="" width="4285" height="709"></section><section data-field="title"><span class="text">c\'est un bloc features</span></section></div></div><div data-slicetype="text" class="slice"><p>C\'est un bloc content</p></div>'); }
protected function setUp() { $cache = new ApcCache(); $cache->clear(); $search = json_decode(file_get_contents(__DIR__ . '/../fixtures/search.json')); $this->document = Document::parse($search[0]); $this->micro_api = Api::get(self::$testRepository, null, null, $cache); $this->linkResolver = new FakeLinkResolver(); }
protected function setUp() { $search = json_decode(file_get_contents(__DIR__ . '/../fixtures/search.json')); $document = Document::parse($search[0]); $gallery = $document->get('product.gallery'); $views = array_values($gallery->getViews()); $views[] = $gallery->getMain(); foreach ($document->getStructuredText('product.linked_images')->getImages() as $image) { $views[] = $image->getView(); } $this->input = array(); $this->linkResolver = new FakeLinkResolver(); foreach ($views as $view) { $dom = new DOMDocument(); $this->input[] = array('view' => $view, 'parsed' => $dom->loadHTML($view->asHtml($this->linkResolver)), 'dom' => $dom); } }
public function testNestedSpans() { $json = json_decode(file_get_contents(__DIR__ . '/../fixtures/nested.json')); $document = Document::parse($json[0]); $structuredText = $document->getStructuredText('article.content'); $this->assertEquals('<p><em><strong>SOME Thingyy</strong></em><em>:</em> <em>12345678</em></p>', $structuredText->asHtml()); }
public function testGeoPoint() { $json = "{\"id\":\"abcd\",\"type\":\"article\",\"href\":\"\",\"slugs\":[],\"tags\":[],\"data\":{\"article\":{\"location\":{\"type\":\"GeoPoint\",\"value\":{\"latitude\":48.877108,\"longitude\":2.333879}}}}}"; $doc = Document::parse(json_decode($json)); // startgist:4a4024327fc8454bc809:prismic-geopoint.php // "near" predicate for GeoPoint fragments $near = Predicates::near("my.store.location", 48.8768767, 2.3338802, 10); // Accessing GeoPoint fragments $place = $doc->getGeoPoint("article.location"); $coordinates = ""; if ($place) { $coordinates = $place->getLatitude() . "," . $place->getLongitude(); } // endgist $this->assertEquals("48.877108,2.333879", $coordinates); }
public function getDocument() { $json = json_decode(file_get_contents(__DIR__ . '/../../../fixtures/document.json')); return \Prismic\Document::parse($json); }
protected function setUp() { $json = json_decode(file_get_contents(__DIR__ . '/../fixtures/group.json')); $this->document = Document::parse($json[0]); }
public function setUp() { $json = json_decode(file_get_contents(__DIR__ . '/../../../fixtures/document.json')); $this->document = \Prismic\Document::parse($json); }