public function testSimpleDescriptor()
    {
        $d = $this->createServiceDescription();
        $response = new ServiceDescriptionResponse($d, 'REMOTE');
        $this->expectOutputString(<<<'OUT'
var REMOTE = {"type":"remoting","url":"https:\/\/example.com\/router","namespace":"Ext.global","actions":{"action1":[{"name":"method1","len":0}]}};
OUT
);
        $response->sendContent();
    }
Ejemplo n.º 2
0
 /**
  * @param string $url
  * @param string $format
  * @return ServiceDescriptionResponse
  */
 public function createServiceDescription($url, $format = 'js')
 {
     $serviceDescription = $this->descriptionFactory->createServiceDescription($url);
     if ($format == 'json') {
         $response = JsonResponse::create($serviceDescription);
     } else {
         $response = new ServiceDescriptionResponse($serviceDescription, $this->getDescriptor());
     }
     if ($this->debug) {
         $response->setEncodingOptions(JSON_PRETTY_PRINT);
     }
     return $response;
 }