@@ -74,6 +74,16 @@ public function testCustomValidationFunction()
74
74
$ this ->assertMatchesRegularExpression ('/functionCustomValidation\(token\)/ ' , $ r );
75
75
}
76
76
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
+
77
87
/**
78
88
* @test
79
89
*/
@@ -109,6 +119,30 @@ public function testHtmlScriptTagJsApiCalledByFacade()
109
119
htmlScriptTagJsApi ([]);
110
120
}
111
121
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
+
112
146
/**
113
147
* Define environment setup.
114
148
*
@@ -121,6 +155,9 @@ protected function getEnvironmentSetUp($app)
121
155
122
156
$ app ['config ' ]->set ('recaptcha.version ' , 'v3 ' );
123
157
$ 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 " );
124
161
}
125
162
126
163
/**
@@ -130,7 +167,6 @@ protected function setUp(): void
130
167
{
131
168
132
169
parent ::setUp (); // TODO: Change the autogenerated stub
133
-
134
170
$ this ->recaptcha_v3 = new ReCaptchaBuilderV3 ('api_site_key ' , 'api_secret_key ' );
135
171
}
136
172
}
0 commit comments