Completed
Push — master ( f3b5aa...7b9b82 )
by Roberto
04:07 queued 11s
created
tests/ReCaptchaConfigurationTest.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -22,48 +22,48 @@
 block discarded – undo
22 22
  */
23 23
 class ReCaptchaConfigurationTest extends TestCase {
24 24
 
25
-	/**
26
-	 * @var ReCaptchaBuilder
27
-	 */
28
-	protected $recaptcha;
25
+    /**
26
+     * @var ReCaptchaBuilder
27
+     */
28
+    protected $recaptcha;
29 29
 
30
-	/**
31
-	 * @test
32
-	 */
33
-	public function testSkipIpWhiteListIsArray() {
30
+    /**
31
+     * @test
32
+     */
33
+    public function testSkipIpWhiteListIsArray() {
34 34
 
35
-		$ip_whitelist = $this->recaptcha->getIpWhitelist();
36
-		$this->assertTrue(is_array($ip_whitelist));
37
-		$this->assertCount(2, $ip_whitelist);
38
-	}
35
+        $ip_whitelist = $this->recaptcha->getIpWhitelist();
36
+        $this->assertTrue(is_array($ip_whitelist));
37
+        $this->assertCount(2, $ip_whitelist);
38
+    }
39 39
 
40
-	/**
41
-	 * @test
42
-	 */
43
-	public function testCurlTimeoutIsSet() {
44
-		$this->assertEquals(3, $this->recaptcha->getCurlTimeout());
45
-	}
40
+    /**
41
+     * @test
42
+     */
43
+    public function testCurlTimeoutIsSet() {
44
+        $this->assertEquals(3, $this->recaptcha->getCurlTimeout());
45
+    }
46 46
 
47
-	/**
48
-	 * Define environment setup.
49
-	 *
50
-	 * @param  \Illuminate\Foundation\Application $app
51
-	 *
52
-	 * @return void
53
-	 */
54
-	protected function getEnvironmentSetUp($app) {
47
+    /**
48
+     * Define environment setup.
49
+     *
50
+     * @param  \Illuminate\Foundation\Application $app
51
+     *
52
+     * @return void
53
+     */
54
+    protected function getEnvironmentSetUp($app) {
55 55
 
56
-		$app['config']->set('recaptcha.skip_ip', '10.0.0.1,10.0.0.2');
57
-		$app['config']->set('recaptcha.curl_timeout', 3);
58
-	}
56
+        $app['config']->set('recaptcha.skip_ip', '10.0.0.1,10.0.0.2');
57
+        $app['config']->set('recaptcha.curl_timeout', 3);
58
+    }
59 59
 
60
-	/**
61
-	 * Setup the test environment.
62
-	 */
63
-	protected function setUp(): void {
60
+    /**
61
+     * Setup the test environment.
62
+     */
63
+    protected function setUp(): void {
64 64
 
65
-		parent::setUp(); // TODO: Change the autogenerated stub
65
+        parent::setUp(); // TODO: Change the autogenerated stub
66 66
 
67
-		$this->recaptcha = new ReCaptchaBuilderV2('api_site_key', 'api_secret_key');
68
-	}
67
+        $this->recaptcha = new ReCaptchaBuilderV2('api_site_key', 'api_secret_key');
68
+    }
69 69
 }
70 70
\ No newline at end of file
Please login to merge, or discard this patch.
tests/ReCaptchaTest.php 1 patch
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -22,97 +22,97 @@
 block discarded – undo
22 22
  */
23 23
 class ReCaptchaTest extends TestCase {
24 24
 
25
-	/**
26
-	 * @var ReCaptchaBuilderInvisible
27
-	 */
28
-	protected $recaptcha_invisible = null;
29
-
30
-	/**
31
-	 * @var ReCaptchaBuilderV2
32
-	 */
33
-	protected $recaptcha_v2 = null;
34
-
35
-	/**
36
-	 * @var ReCaptchaBuilderV3
37
-	 */
38
-	protected $recaptcha_v3 = null;
39
-
40
-	/**
41
-	 * @tests
42
-	 */
43
-	public function testHtmlScriptTagJsApiGetHtmlScriptTag() {
44
-
45
-		$r = ReCaptcha::htmlScriptTagJsApi();
46
-		$this->assertEquals('<script src="https://www.google.com/recaptcha/api.js" async defer></script>', $r);
47
-	}
48
-
49
-	/**
50
-	 * @test
51
-	 */
52
-	public function testReCaptchaInvisibleHtmlFormButtonDefault() {
53
-
54
-		$recaptcha = $this->recaptcha_invisible;
55
-		$html_button = $recaptcha->htmlFormButton();
56
-		$this->assertEquals('<button class="g-recaptcha" data-sitekey="api_site_key" data-callback="biscolabLaravelReCaptcha">Submit</button>',
57
-			$html_button);
58
-	}
59
-
60
-	/**
61
-	 * @test
62
-	 */
63
-	public function testReCaptchaInvisibleHtmlFormButtonCustom() {
64
-
65
-		$recaptcha = $this->recaptcha_invisible;
66
-		$html_button = $recaptcha->htmlFormButton('Custom Text');
67
-		$this->assertEquals('<button class="g-recaptcha" data-sitekey="api_site_key" data-callback="biscolabLaravelReCaptcha">Custom Text</button>',
68
-			$html_button);
69
-	}
70
-
71
-	/**
72
-	 * @test
73
-	 */
74
-	public function testReCaptchaV2HtmlFormSnippet() {
75
-
76
-		$recaptcha = $this->recaptcha_v2;
77
-		$html_snippet = $recaptcha->htmlFormSnippet();
78
-		$this->assertEquals('<div class="g-recaptcha" data-sitekey="api_site_key"></div>', $html_snippet);
79
-	}
80
-
81
-	/**
82
-	 * @test
83
-	 * @expectedException     \Error
84
-	 */
85
-	public function testReCaptchaInvisibleHtmlFormSnippetShouldThrowError() {
86
-
87
-		$this->recaptcha_invisible->htmlFormSnippet();
88
-	}
89
-
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
-
100
-	/**
101
-	 * @test
102
-	 * @expectedException     \Error
103
-	 */
104
-	public function testReCaptchaV2htmlFormButtonShouldThrowError() {
105
-
106
-		$this->recaptcha_v2->htmlFormButton();
107
-	}
108
-
109
-	protected function setUp(): void {
110
-
111
-		parent::setUp(); // TODO: Change the autogenerated stub
112
-
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');
116
-
117
-	}
25
+    /**
26
+     * @var ReCaptchaBuilderInvisible
27
+     */
28
+    protected $recaptcha_invisible = null;
29
+
30
+    /**
31
+     * @var ReCaptchaBuilderV2
32
+     */
33
+    protected $recaptcha_v2 = null;
34
+
35
+    /**
36
+     * @var ReCaptchaBuilderV3
37
+     */
38
+    protected $recaptcha_v3 = null;
39
+
40
+    /**
41
+     * @tests
42
+     */
43
+    public function testHtmlScriptTagJsApiGetHtmlScriptTag() {
44
+
45
+        $r = ReCaptcha::htmlScriptTagJsApi();
46
+        $this->assertEquals('<script src="https://www.google.com/recaptcha/api.js" async defer></script>', $r);
47
+    }
48
+
49
+    /**
50
+     * @test
51
+     */
52
+    public function testReCaptchaInvisibleHtmlFormButtonDefault() {
53
+
54
+        $recaptcha = $this->recaptcha_invisible;
55
+        $html_button = $recaptcha->htmlFormButton();
56
+        $this->assertEquals('<button class="g-recaptcha" data-sitekey="api_site_key" data-callback="biscolabLaravelReCaptcha">Submit</button>',
57
+            $html_button);
58
+    }
59
+
60
+    /**
61
+     * @test
62
+     */
63
+    public function testReCaptchaInvisibleHtmlFormButtonCustom() {
64
+
65
+        $recaptcha = $this->recaptcha_invisible;
66
+        $html_button = $recaptcha->htmlFormButton('Custom Text');
67
+        $this->assertEquals('<button class="g-recaptcha" data-sitekey="api_site_key" data-callback="biscolabLaravelReCaptcha">Custom Text</button>',
68
+            $html_button);
69
+    }
70
+
71
+    /**
72
+     * @test
73
+     */
74
+    public function testReCaptchaV2HtmlFormSnippet() {
75
+
76
+        $recaptcha = $this->recaptcha_v2;
77
+        $html_snippet = $recaptcha->htmlFormSnippet();
78
+        $this->assertEquals('<div class="g-recaptcha" data-sitekey="api_site_key"></div>', $html_snippet);
79
+    }
80
+
81
+    /**
82
+     * @test
83
+     * @expectedException     \Error
84
+     */
85
+    public function testReCaptchaInvisibleHtmlFormSnippetShouldThrowError() {
86
+
87
+        $this->recaptcha_invisible->htmlFormSnippet();
88
+    }
89
+
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
+
100
+    /**
101
+     * @test
102
+     * @expectedException     \Error
103
+     */
104
+    public function testReCaptchaV2htmlFormButtonShouldThrowError() {
105
+
106
+        $this->recaptcha_v2->htmlFormButton();
107
+    }
108
+
109
+    protected function setUp(): void {
110
+
111
+        parent::setUp(); // TODO: Change the autogenerated stub
112
+
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');
116
+
117
+    }
118 118
 }
119 119
\ No newline at end of file
Please login to merge, or discard this patch.
tests/ReCaptchaV3Test.php 1 patch
Indentation   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -20,101 +20,101 @@
 block discarded – undo
20 20
  */
21 21
 class ReCaptchaV3Test extends TestCase {
22 22
 
23
-	protected $recaptcha_v3 = null;
24
-
25
-	/**
26
-	 * @test
27
-	 */
28
-	public function testGetApiVersion() {
29
-
30
-		$this->assertEquals($this->recaptcha_v3->getVersion(), 'v3');
31
-	}
32
-
33
-	/**
34
-	 * @test
35
-	 */
36
-	public function testHtmlScriptTagJsApiV3GetHtmlScriptTag() {
37
-
38
-		$r = $this->recaptcha_v3->htmlScriptTagJsApiV3();
39
-		$this->assertRegexp('/csrfToken/', $r);
40
-	}
41
-
42
-	/**
43
-	 * @test
44
-	 */
45
-	public function testAction() {
46
-
47
-		$r = $this->recaptcha_v3->htmlScriptTagJsApiV3(['action' => 'someAction']);
48
-		$this->assertRegexp('/someAction/', $r);
49
-	}
50
-
51
-	/**
52
-	 * @test
53
-	 */
54
-	public function testFetchCallbackFunction() {
55
-
56
-		$r = $this->recaptcha_v3->htmlScriptTagJsApiV3(['callback_then' => 'functionCallbackThen']);
57
-		$this->assertRegexp('/functionCallbackThen\(response\)/', $r);
58
-	}
59
-
60
-	/**
61
-	 * @test
62
-	 */
63
-	public function testcCatchCallbackFunction() {
64
-
65
-		$r = $this->recaptcha_v3->htmlScriptTagJsApiV3(['callback_catch' => 'functionCallbackCatch']);
66
-		$this->assertRegexp('/functionCallbackCatch\(err\)/', $r);
67
-	}
68
-
69
-	/**
70
-	 * @test
71
-	 */
72
-	public function testCustomValidationFunction() {
73
-
74
-		$r = $this->recaptcha_v3->htmlScriptTagJsApiV3(['custom_validation' => 'functionCustomValidation']);
75
-		$this->assertRegexp('/functionCustomValidation\(token\)/', $r);
76
-	}
77
-
78
-	/**
79
-	 * @test
80
-	 */
81
-	public function testValidateController() {
82
-
83
-		$controller = App::make(ReCaptchaController::class);
84
-		$return = $controller->validateV3();
85
-
86
-		$this->assertArrayHasKey("success", $return);
87
-		$this->assertArrayHasKey("error-codes", $return);
88
-	}
89
-
90
-	/**
91
-	 * @test
92
-	 */
93
-	public function testCurlTimeoutIsSet() {
94
-		$this->assertEquals($this->recaptcha_v3->getCurlTimeout(), 3);
95
-	}
96
-
97
-	/**
98
-	 * Define environment setup.
99
-	 *
100
-	 * @param  \Illuminate\Foundation\Application $app
101
-	 *
102
-	 * @return void
103
-	 */
104
-	protected function getEnvironmentSetUp($app) {
105
-
106
-		$app['config']->set('recaptcha.version', 'v3');
107
-		$app['config']->set('recaptcha.curl_timeout', 3);
108
-	}
109
-
110
-	/**
111
-	 * Setup the test environment.
112
-	 */
113
-	protected function setUp(): void {
114
-
115
-		parent::setUp(); // TODO: Change the autogenerated stub
116
-
117
-		$this->recaptcha_v3 = new ReCaptchaBuilderV3('api_site_key', 'api_secret_key');
118
-
119
-	}
23
+    protected $recaptcha_v3 = null;
24
+
25
+    /**
26
+     * @test
27
+     */
28
+    public function testGetApiVersion() {
29
+
30
+        $this->assertEquals($this->recaptcha_v3->getVersion(), 'v3');
31
+    }
32
+
33
+    /**
34
+     * @test
35
+     */
36
+    public function testHtmlScriptTagJsApiV3GetHtmlScriptTag() {
37
+
38
+        $r = $this->recaptcha_v3->htmlScriptTagJsApiV3();
39
+        $this->assertRegexp('/csrfToken/', $r);
40
+    }
41
+
42
+    /**
43
+     * @test
44
+     */
45
+    public function testAction() {
46
+
47
+        $r = $this->recaptcha_v3->htmlScriptTagJsApiV3(['action' => 'someAction']);
48
+        $this->assertRegexp('/someAction/', $r);
49
+    }
50
+
51
+    /**
52
+     * @test
53
+     */
54
+    public function testFetchCallbackFunction() {
55
+
56
+        $r = $this->recaptcha_v3->htmlScriptTagJsApiV3(['callback_then' => 'functionCallbackThen']);
57
+        $this->assertRegexp('/functionCallbackThen\(response\)/', $r);
58
+    }
59
+
60
+    /**
61
+     * @test
62
+     */
63
+    public function testcCatchCallbackFunction() {
64
+
65
+        $r = $this->recaptcha_v3->htmlScriptTagJsApiV3(['callback_catch' => 'functionCallbackCatch']);
66
+        $this->assertRegexp('/functionCallbackCatch\(err\)/', $r);
67
+    }
68
+
69
+    /**
70
+     * @test
71
+     */
72
+    public function testCustomValidationFunction() {
73
+
74
+        $r = $this->recaptcha_v3->htmlScriptTagJsApiV3(['custom_validation' => 'functionCustomValidation']);
75
+        $this->assertRegexp('/functionCustomValidation\(token\)/', $r);
76
+    }
77
+
78
+    /**
79
+     * @test
80
+     */
81
+    public function testValidateController() {
82
+
83
+        $controller = App::make(ReCaptchaController::class);
84
+        $return = $controller->validateV3();
85
+
86
+        $this->assertArrayHasKey("success", $return);
87
+        $this->assertArrayHasKey("error-codes", $return);
88
+    }
89
+
90
+    /**
91
+     * @test
92
+     */
93
+    public function testCurlTimeoutIsSet() {
94
+        $this->assertEquals($this->recaptcha_v3->getCurlTimeout(), 3);
95
+    }
96
+
97
+    /**
98
+     * Define environment setup.
99
+     *
100
+     * @param  \Illuminate\Foundation\Application $app
101
+     *
102
+     * @return void
103
+     */
104
+    protected function getEnvironmentSetUp($app) {
105
+
106
+        $app['config']->set('recaptcha.version', 'v3');
107
+        $app['config']->set('recaptcha.curl_timeout', 3);
108
+    }
109
+
110
+    /**
111
+     * Setup the test environment.
112
+     */
113
+    protected function setUp(): void {
114
+
115
+        parent::setUp(); // TODO: Change the autogenerated stub
116
+
117
+        $this->recaptcha_v3 = new ReCaptchaBuilderV3('api_site_key', 'api_secret_key');
118
+
119
+    }
120 120
 }
121 121
\ No newline at end of file
Please login to merge, or discard this patch.