Exemplo n.º 1
0
 public function testUrl()
 {
     try {
         $version1 = new Version(1, 0);
         $version2 = new Version(1, 0);
         $this->assertEquals($version1->compare($version2), 0);
         $version1 = new Version(1, 0);
         $version2 = new Version(1, 1);
         $this->assertEquals($version1->compare($version2), -1);
         $version1 = new Version(1, 0);
         $version2 = new Version(2, 0);
         $this->assertEquals($version1->compare($version2), -1);
         $version1 = new Version(2, 0);
         $version2 = new Version(1, 1);
         $this->assertEquals($version1->compare($version2), 1);
         $version1 = new Version(2, 0);
         $version1->raiseVersion(1, 5);
         $this->assertEquals($version1->getMajor(), 2);
         $this->assertEquals($version1->getMinor(), 0);
         $version1->raiseVersion(3, 0);
         $this->assertEquals($version1->getMajor(), 3);
         $this->assertEquals($version1->getMinor(), 0);
         $version1->raiseVersion(3, 1);
         $this->assertEquals($version1->getMajor(), 3);
         $this->assertEquals($version1->getMinor(), 1);
     } catch (\Exception $exception) {
         $this->fail('An expected Exception has not been raised' . $exception->getMessage());
     }
 }
Exemplo n.º 2
0
 /**
  * Get appropriate data service and edm schema version
  * 
  * @param Version &$dsVersion        On return, this parmater will contain 
  *                                   data service version for the metadata
  * @param string  &$edmSchemaVersion On return, this parmater will contain 
  *                                   edm schema version for the metadata
  * 
  * @return void 
  */
 public function getDataServiceAndEdmSchemaVersions(Version &$dsVersion, &$edmSchemaVersion)
 {
     if ($this->_metadataResourceTypeSet->hasNamedStreams()) {
         $dsVersion->raiseVersion(3, 0);
         if ($edmSchemaVersion < MetadataEdmSchemaVersion::VERSION_2_DOT_0) {
             $edmSchemaVersion = MetadataEdmSchemaVersion::VERSION_2_DOT_0;
         }
     }
     if ($this->_metadataResourceTypeSet->hasBagProperty()) {
         $dsVersion->raiseVersion(3, 0);
         if ($edmSchemaVersion < MetadataEdmSchemaVersion::VERSION_2_DOT_2) {
             $edmSchemaVersion = MetadataEdmSchemaVersion::VERSION_2_DOT_2;
         }
     }
 }
Exemplo n.º 3
0
 /**
  * Raise the response version for this request and perform 
  * capability negotiation.
  * 
  * @param int         $major       The major segment of the version
  * @param int         $minor       The minor segment of the version
  * @param DataService $dataService The data service instance
  * 
  * @return void
  * 
  * @throws ODataException If capability negotiation fails.
  */
 public function raiseResponseVersion($major, $minor, DataService $dataService)
 {
     $this->_responseDataServiceVersion->raiseVersion($major, $minor);
     self::checkVersion($this, $dataService);
 }