コード例 #1
0
 public function testSimpleRPC()
 {
     //Create the test controller and service
     $controller = new TestController();
     $this->container->set('some.controller.service', $controller);
     //Create a URI mapping
     $reflectController = new \ReflectionClass($controller);
     $reflectMethod = $reflectController->getMethod('echoRPC');
     $rpcAnnotation = new Register(["value" => "test.uri"]);
     $mapping = new URIClassMapping('some.controller.service', $reflectMethod, $rpcAnnotation);
     $args = [3, "test", "test2"];
     $argsKw = new \stdClass();
     $details = new \stdClass();
     $result = $this->wampkernel->handleRPC($args, $argsKw, $details, $mapping);
     $this->assertEquals($args, $result);
 }
コード例 #2
0
 /**
  * @test
  */
 public function rpc_test_with_mixed_types_and_default_value()
 {
     //Create the test controller and service
     $controller = new TestController();
     $this->container->set('some.controller.service', $controller);
     //Create a URI mapping
     $reflectController = new \ReflectionClass($controller);
     $reflectMethod = $reflectController->getMethod('RPCTestWithMixedTypesAndDefault');
     $rpcAnnotation = new Register(["value" => "test.uri"]);
     $mapping = new URIClassMapping('some.controller.service', $reflectMethod, $rpcAnnotation);
     $args = [["name" => "dave"], "matt"];
     $argsKw = new \stdClass();
     $details = new \stdClass();
     $result = $this->wampkernel->handleRPC($args, $argsKw, $details, $mapping);
     $this->assertEquals([new Person("dave"), "matt", "test"], $result);
 }
コード例 #3
0
 /**
  * @test
  *
  */
 public function rpc_test_fatal_error()
 {
     //Create the test controller and service
     $controller = new TestController();
     $this->container->set('some.controller.service', $controller);
     //Create a URI mapping
     $reflectController = new \ReflectionClass($controller);
     $reflectMethod = $reflectController->getMethod('RPCTestUndefinedVar');
     $rpcAnnotation = new Register(["value" => "test.uri"]);
     $mapping = new URIClassMapping('some.controller.service', $reflectMethod, $rpcAnnotation);
     $args = null;
     $argsKw = new \stdClass();
     $details = new \stdClass();
     try {
         $this->wampkernel->handleRPC($args, $argsKw, $details, $mapping);
     } catch (\Exception $e) {
         $this->assertEquals("Unable to make the call: test.uri \n Message:  Undefined variable: b", $e->getMessage());
     }
 }