Ejemplo n.º 1
1
        };
        break;
    case 'get_pincode_invalid':
        $callback = function () {
            return new PinCodeResponse(null);
        };
        break;
    case 'user_search_invalid':
        $callback = function () {
            $user = new User();
            return new UserResponse($user);
        };
        break;
    case 'user_search_success':
        $callback = function () {
            $user = new User();
            $user->setId('USER_ID');
            $user->setEmail('*****@*****.**');
            $user->setName('User Name');
            $user->setPhone('123456789');
            $user->setPublicId('PUBLIC_ID');
            return new UserResponse($user);
        };
        break;
    default:
        $callback = function () {
        };
}
$server = WebhookServer::create($callback, ServerTest::PROJECT_SECRET_KEY);
$isAuthenticateClientIp = 'invalid_ip' === $testCase;
$server->start(null, $isAuthenticateClientIp);
Ejemplo n.º 2
0
 /**
  * @param User $user
  */
 public function __construct(User $user)
 {
     $this->validateStringParameter('User id', $user->getId());
     parent::__construct(200, $user->toJson());
 }
 public function testFullResponseFormat()
 {
     $user = new User();
     $response = new UserResponse($user->setId('user_id')->setEmail('user_email')->setPhone('user_phone')->setName('user_name')->setPublicId('user_public_id'));
     $this->assertJsonStringEqualsJsonString('{"user":{"id":"user_id","email":"user_email","phone":"user_phone","name":"user_name","public_id":"user_public_id"}}', $response->getSymfonyResponse()->getContent());
 }