protected function writeTopLevelMeta($fragment) { if ($this->metadataLevel == JsonLightMetadataLevel::NONE()) { return; } $this->_writer->writeName(ODataConstants::JSON_LIGHT_METADATA_STRING)->writeValue($this->baseUri . '/' . ODataConstants::URI_METADATA_SEGMENT . '#' . $fragment); }
public function registerWriters() { $registry = $this->getODataWriterRegistry(); $serviceVersion = $this->getConfiguration()->getMaxDataServiceVersion(); $serviceURI = $this->getHost()->getAbsoluteServiceUri()->getUrlAsString(); //We always register the v1 stuff $registry->register(new JsonODataV1Writer()); $registry->register(new AtomODataWriter($serviceURI)); if ($serviceVersion->compare(Version::v2()) > -1) { $registry->register(new JsonODataV2Writer()); } if ($serviceVersion->compare(Version::v3()) > -1) { $registry->register(new JsonLightODataWriter(JsonLightMetadataLevel::NONE(), $serviceURI)); $registry->register(new JsonLightODataWriter(JsonLightMetadataLevel::MINIMAL(), $serviceURI)); $registry->register(new JsonLightODataWriter(JsonLightMetadataLevel::FULL(), $serviceURI)); } }
/** * @dataProvider canHandleProvider */ public function testCanHandle($id, $version, $contentType, $expected) { $writer = new JsonLightODataWriter(JsonLightMetadataLevel::NONE(), $this->serviceBase); $actual = $writer->canHandle($version, $contentType); $this->assertEquals($expected, $actual, $id); }