/** * addFunction() test * * Call as method call * * Expects: * - function: * - namespace: Optional; has default; * * Returns: void */ public function testAddFunction() { try { $this->_server->addFunction('Zend_Amf_Server_testFunction', 'test'); } catch (Exception $e) { $this->fail('Attachment should have worked'); } $methods = $this->_server->listMethods(); $this->assertTrue(in_array('test.Zend_Amf_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 Server(); try { $server->addFunction(array('Zend_Amf_Server_testFunction', 'Zend_Amf_Server_testFunction2'), 'zsr'); } catch (Exception $e) { $this->fail('Error attaching array of functions: ' . $e->getMessage()); } $methods = $server->listMethods(); $this->assertTrue(in_array('zsr.Zend_Amf_Server_testFunction', $methods)); $this->assertTrue(in_array('zsr.Zend_Amf_Server_testFunction2', $methods)); }