File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
tests/ReCaptcha/RequestMethod Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -161,6 +161,27 @@ public function testSubmit(): void
161161 $ this ->assertTrue (SocketPostGlobalState::$ fcloseCalled );
162162 }
163163
164+ public function testOverrideSiteVerifyUrl (): void
165+ {
166+ SocketPostGlobalState::$ fgetsResponses = [
167+ "HTTP/1.0 200 OK \r\n" ,
168+ "Content-Type: application/json \r\n" ,
169+ "\r\n" ,
170+ 'RESPONSEBODY ' ,
171+ ];
172+
173+ $ url = 'https://custom.recaptcha.net/recaptcha/api/siteverify ' ;
174+ $ sp = new SocketPost ($ url );
175+ $ response = $ sp ->submit (new RequestParameters ('secret ' , 'response ' ));
176+
177+ $ this ->assertEquals ('ssl://custom.recaptcha.net ' , SocketPostGlobalState::$ fsockopenHostname );
178+ $ this ->assertStringContainsString ('POST /recaptcha/api/siteverify HTTP/1.0 ' , SocketPostGlobalState::$ fwriteData );
179+ $ this ->assertStringContainsString ('secret=secret ' , SocketPostGlobalState::$ fwriteData );
180+ $ this ->assertStringContainsString ('response=response ' , SocketPostGlobalState::$ fwriteData );
181+ $ this ->assertEquals ('RESPONSEBODY ' , $ response );
182+ $ this ->assertTrue (SocketPostGlobalState::$ fcloseCalled );
183+ }
184+
164185 public function testStreamTimeoutFailureReturnsError (): void
165186 {
166187 SocketPostGlobalState::$ streamSetTimeoutSuccess = false ;
You can’t perform that action at this time.
0 commit comments