コード例 #1
0
 public function test_definition_enforcement()
 {
     $client = ClientTestService2::getInstance()->client();
     // Validate param type
     try {
         // Client calls with bad params throw exceptions here
         $response = $client->reverse(false, 'should not be string');
     } catch (\Exception $e) {
         $this->assertObjectHasAttribute('errors', $e);
         // Make sure there are 2 errors about param types
         $this->assertCount(2, $e->errors);
         $this->assertEquals('"input" should be one of: string', $e->errors[0]);
         $this->assertEquals('"times" should be one of: int32, null', $e->errors[1]);
     }
     // Need to make sure response is null, and exception was thrown
 }
コード例 #2
0
<?php

include '../setup.client-test.php';
$server = ClientTestService2::getInstance()->server();
$server->run();