예제 #1
0
 public function testToArrayOverrideInvalidClientResponse()
 {
     $request = $this->getMockBuilder('\\Zumba\\VanillaJsConnect\\Request')->disableOriginalConstructor()->getMock();
     $expectedResult = json_encode(['error' => 'invalid_client', 'message' => 'Unknown client Agent Smith.']);
     $errorResponse = new Response\InvalidClientID($request);
     $errorResponse->setClientID('Agent Smith');
     $this->assertEquals($expectedResult, (string) $errorResponse);
 }
 public function validate(Vanilla\Request $request, Vanilla\User $user = null, Vanilla\Config $config = null)
 {
     if ($request->getClientID() !== $config->getClientID()) {
         $clientID = $request->getClientID();
         $clientResponse = new Response\InvalidClientID($request);
         $clientResponse->setClientID($clientID);
         return $clientResponse;
     }
 }