@@ -74,6 +74,16 @@ public function testCustomValidationFunction()
7474 $ this ->assertMatchesRegularExpression ('/functionCustomValidation\(token\)/ ' , $ r );
7575 }
7676
77+ /**
78+ * @test
79+ */
80+ public function testCustomValidationUrl ()
81+ {
82+
83+ $ r = $ this ->recaptcha_v3 ->htmlScriptTagJsApi ();
84+ $ this ->assertMatchesRegularExpression ('/http:\/\/localhost\/my-custom-url\?my-custom-token-name/ ' , $ r );
85+ }
86+
7787 /**
7888 * @test
7989 */
@@ -109,6 +119,30 @@ public function testHtmlScriptTagJsApiCalledByFacade()
109119 htmlScriptTagJsApi ([]);
110120 }
111121
122+ /**
123+ * @test
124+ */
125+ public function testValidationUrlShouldBeMyCustomUrl ()
126+ {
127+ $ this ->assertEquals ($ this ->recaptcha_v3 ->getValidationUrl (), "http://localhost/my-custom-url " );
128+ }
129+
130+ /**
131+ * @test
132+ */
133+ public function testTokenParamNameShouldBeMyCustomTokenParamName ()
134+ {
135+ $ this ->assertEquals ($ this ->recaptcha_v3 ->getTokenParameterName (), "my-custom-token-name " );
136+ }
137+
138+ /**
139+ * @test
140+ */
141+ public function testValidationUrlShouldBeMyCustomValidationUrl ()
142+ {
143+ $ this ->assertEquals ($ this ->recaptcha_v3 ->getValidationUrlWithToken (), "http://localhost/my-custom-url?my-custom-token-name " );
144+ }
145+
112146 /**
113147 * Define environment setup.
114148 *
@@ -121,6 +155,9 @@ protected function getEnvironmentSetUp($app)
121155
122156 $ app ['config ' ]->set ('recaptcha.version ' , 'v3 ' );
123157 $ app ['config ' ]->set ('recaptcha.curl_timeout ' , 3 );
158+
159+ $ app ['config ' ]->set ('recaptcha.default_validation_route ' , "my-custom-url " );
160+ $ app ['config ' ]->set ('recaptcha.default_token_parameter_name ' , "my-custom-token-name " );
124161 }
125162
126163 /**
@@ -130,7 +167,6 @@ protected function setUp(): void
130167 {
131168
132169 parent ::setUp (); // TODO: Change the autogenerated stub
133-
134170 $ this ->recaptcha_v3 = new ReCaptchaBuilderV3 ('api_site_key ' , 'api_secret_key ' );
135171 }
136172}
0 commit comments