Exemple #1
0
 /**
  * addFunction() test
  *
  * Call as method call
  *
  * Expects:
  * - function:
  * - namespace: Optional; has default;
  *
  * Returns: void
  */
 public function testAddFunction()
 {
     try {
         $this->_server->addFunction('ZendTest\\Amf\\TestAsset\\Server\\testFunction', 'test');
     } catch (\Exception $e) {
         $this->fail('Attachment should have worked');
     }
     $methods = $this->_server->listMethods();
     $this->assertTrue(in_array('test.ZendTest\\Amf\\TestAsset\\Server\\testFunction', $methods), var_export($methods, 1));
     try {
         $this->_server->addFunction('nosuchfunction');
         $this->fail('nosuchfunction() should not exist and should throw an exception');
     } catch (\Exception $e) {
         // do nothing
     }
     $server = new Amf\Server();
     try {
         $server->addFunction(array('ZendTest\\Amf\\TestAsset\\Server\\testFunction', 'ZendTest\\Amf\\TestAsset\\Server\\testFunction2'), 'zsr');
     } catch (\Exception $e) {
         $this->fail('Error attaching array of functions: ' . $e->getMessage());
     }
     $methods = $server->listMethods();
     $this->assertTrue(in_array('zsr.ZendTest\\Amf\\TestAsset\\Server\\testFunction', $methods));
     $this->assertTrue(in_array('zsr.ZendTest\\Amf\\TestAsset\\Server\\testFunction2', $methods));
 }
Exemple #2
0
 /**
  * addFunction() test
  *
  * Call as method call
  *
  * Expects:
  * - function:
  * - namespace: Optional; has default;
  *
  * Returns: void
  */
 public function testAddFunction()
 {
     $this->_server->addFunction('ZendTest\\Amf\\TestAsset\\Server\\testFunction', 'test');
     $methods = $this->_server->listMethods();
     $this->assertTrue(in_array('test.ZendTest\\Amf\\TestAsset\\Server\\testFunction', $methods), var_export($methods, 1));
     try {
         $this->_server->addFunction('nosuchfunction');
         $this->fail('nosuchfunction() should not exist and should throw an exception');
     } catch (\Exception $e) {
     }
     $server = new Amf\Server();
     $server->addFunction(array('ZendTest\\Amf\\TestAsset\\Server\\testFunction', 'ZendTest\\Amf\\TestAsset\\Server\\testFunction2'), 'zsr');
     $methods = $server->listMethods();
     $this->assertTrue(in_array('zsr.ZendTest\\Amf\\TestAsset\\Server\\testFunction', $methods));
     $this->assertTrue(in_array('zsr.ZendTest\\Amf\\TestAsset\\Server\\testFunction2', $methods));
 }