public function testMergesDataPropertyCorrectly()
 {
     $loader = new ServiceDescriptionLoader();
     $description = $loader->load(array('operations' => array('foo' => array('parameters' => array('fooParam' => array('type' => 'string')), 'data' => array('links' => array('fooLink' => array('foo' => 'bar')))), 'bar' => array('extends' => 'foo', 'parameters' => array('barParam' => array('type' => 'string')), 'data' => array('links' => array('barLink' => array('bar' => 'baz')))))));
     $bar = $description->getOperation('bar');
     $links = $bar->getData('links');
     $this->assertArrayHasKey('fooLink', $links);
     $this->assertArrayHasKey('barLink', $links);
     $this->assertSame('bar', $links['fooLink']['foo']);
     $this->assertSame('baz', $links['barLink']['bar']);
 }
示例#2
0
 /**
  * Determines whether the desk.json service description is valid
  *
  * @return boolean
  */
 protected function canServiceDescriptionBeLoaded()
 {
     if (self::$serviceDescriptionCanBeLoaded === null) {
         self::$serviceDescriptionCanBeLoaded = false;
         $filename = DeskClient::getDescriptionFilename();
         $loader = new ServiceDescriptionLoader();
         // try {
         $description = $loader->load($filename);
         self::$serviceDescriptionCanBeLoaded = true;
         // } catch (RuntimeException $e) {
         //     // leave it as false
         // }
     }
     return self::$serviceDescriptionCanBeLoaded;
 }