/**
  * @dataProvider canHandleProvider
  */
 public function testCanHandle($id, $version, $contentType, $expected)
 {
     $writer = new JsonLightODataWriter(JsonLightMetadataLevel::FULL(), $this->serviceBase);
     $actual = $writer->canHandle($version, $contentType);
     $this->assertEquals($expected, $actual, $id);
 }
Exemplo n.º 2
0
 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));
     }
 }
Exemplo n.º 3
0
 protected function writeComplexPropertyMeta(ODataProperty $property)
 {
     if ($this->metadataLevel == JsonLightMetadataLevel::FULL()) {
         $this->_writer->writeName(ODataConstants::JSON_LIGHT_METADATA_TYPE_STRING)->writeValue($property->typeName);
     }
     return $this;
 }