1111namespace Biscolab \ReCaptcha \Tests ;
1212
1313use Biscolab \ReCaptcha \Facades \ReCaptcha ;
14+ use Biscolab \ReCaptcha \ReCaptchaBuilder ;
1415use Biscolab \ReCaptcha \ReCaptchaBuilderInvisible ;
1516use Biscolab \ReCaptcha \ReCaptchaBuilderV2 ;
17+ use Biscolab \ReCaptcha \ReCaptchaBuilderV3 ;
1618
1719/**
1820 * Class ReCaptchaTest
1921 * @package Biscolab\ReCaptcha\Tests
2022 */
2123class ReCaptchaTest extends TestCase {
2224
25+ /**
26+ * @var ReCaptchaBuilderInvisible
27+ */
2328 protected $ recaptcha_invisible = null ;
2429
25- protected $ recaptcha_v2 = null ;
30+ /**
31+ * @var ReCaptchaBuilderV2
32+ */
33+ protected $ recaptcha_v2 = null ;
34+
35+ /**
36+ * @var ReCaptchaBuilderV3
37+ */
38+ protected $ recaptcha_v3 = null ;
2639
2740 /**
2841 * @tests
@@ -40,7 +53,8 @@ public function testReCaptchaInvisibleHtmlFormButtonDefault() {
4053
4154 $ recaptcha = $ this ->recaptcha_invisible ;
4255 $ html_button = $ recaptcha ->htmlFormButton ();
43- $ this ->assertEquals ('<button class="g-recaptcha" data-sitekey="api_site_key" data-callback="biscolabLaravelReCaptcha">Submit</button> ' , $ html_button );
56+ $ this ->assertEquals ('<button class="g-recaptcha" data-sitekey="api_site_key" data-callback="biscolabLaravelReCaptcha">Submit</button> ' ,
57+ $ html_button );
4458 }
4559
4660 /**
@@ -50,7 +64,8 @@ public function testReCaptchaInvisibleHtmlFormButtonCustom() {
5064
5165 $ recaptcha = $ this ->recaptcha_invisible ;
5266 $ html_button = $ recaptcha ->htmlFormButton ('Custom Text ' );
53- $ this ->assertEquals ('<button class="g-recaptcha" data-sitekey="api_site_key" data-callback="biscolabLaravelReCaptcha">Custom Text</button> ' , $ html_button );
67+ $ this ->assertEquals ('<button class="g-recaptcha" data-sitekey="api_site_key" data-callback="biscolabLaravelReCaptcha">Custom Text</button> ' ,
68+ $ html_button );
5469 }
5570
5671 /**
@@ -72,6 +87,16 @@ public function testReCaptchaInvisibleHtmlFormSnippetShouldThrowError() {
7287 $ this ->recaptcha_invisible ->htmlFormSnippet ();
7388 }
7489
90+ /**
91+ * @test
92+ */
93+ public function testDefaultCurlTimeout () {
94+
95+ $ this ->assertEquals ($ this ->recaptcha_invisible ->getCurlTimeout (), ReCaptchaBuilder::DEFAULT_CURL_TIMEOUT );
96+ $ this ->assertEquals ($ this ->recaptcha_v2 ->getCurlTimeout (), ReCaptchaBuilder::DEFAULT_CURL_TIMEOUT );
97+ $ this ->assertEquals ($ this ->recaptcha_v3 ->getCurlTimeout (), ReCaptchaBuilder::DEFAULT_CURL_TIMEOUT );
98+ }
99+
75100 /**
76101 * @test
77102 * @expectedException \Error
@@ -85,8 +110,9 @@ protected function setUp(): void {
85110
86111 parent ::setUp (); // TODO: Change the autogenerated stub
87112
88- $ this ->recaptcha_invisible = new ReCaptchaBuilderInvisible ('api_site_key ' , 'api_secret_key ' , 3 );
89- $ this ->recaptcha_v2 = new ReCaptchaBuilderV2 ('api_site_key ' , 'api_secret_key ' , 3 );
113+ $ this ->recaptcha_invisible = new ReCaptchaBuilderInvisible ('api_site_key ' , 'api_secret_key ' );
114+ $ this ->recaptcha_v2 = new ReCaptchaBuilderV2 ('api_site_key ' , 'api_secret_key ' );
115+ $ this ->recaptcha_v3 = new ReCaptchaBuilderV3 ('api_site_key ' , 'api_secret_key ' );
90116
91117 }
92118}
0 commit comments