Completed
Push — master ( f3b5aa...7b9b82 )
by Roberto
04:07 queued 11s
created

ReCaptchaConfigurationTest::testCurlTimeoutIsSet()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 2
rs 10
1
<?php
2
/**
3
 * Copyright (c) 2017 - present
4
 * LaravelGoogleRecaptcha - ReCaptchaConfigurationTest.php
5
 * author: Roberto Belotti - [email protected]
6
 * web : robertobelotti.com, github.com/biscolab
7
 * Initial version created on: 13/2/2019
8
 * MIT license: https://github.com/biscolab/laravel-recaptcha/blob/master/LICENSE
9
 */
10
11
namespace Biscolab\ReCaptcha\Tests;
12
13
use Biscolab\ReCaptcha\Controllers\ReCaptchaController;
14
use Biscolab\ReCaptcha\ReCaptchaBuilder;
15
use Biscolab\ReCaptcha\ReCaptchaBuilderV2;
16
use Biscolab\ReCaptcha\ReCaptchaBuilderV3;
17
use Illuminate\Support\Facades\App;
18
19
/**
20
 * Class ReCaptchaConfigurationTest
21
 * @package Biscolab\ReCaptcha\Tests
22
 */
23
class ReCaptchaConfigurationTest extends TestCase {
24
25
	/**
26
	 * @var ReCaptchaBuilder
27
	 */
28
	protected $recaptcha;
29
30
	/**
31
	 * @test
32
	 */
33
	public function testSkipIpWhiteListIsArray() {
34
35
		$ip_whitelist = $this->recaptcha->getIpWhitelist();
36
		$this->assertTrue(is_array($ip_whitelist));
37
		$this->assertCount(2, $ip_whitelist);
38
	}
39
40
	/**
41
	 * @test
42
	 */
43
	public function testCurlTimeoutIsSet() {
44
		$this->assertEquals(3, $this->recaptcha->getCurlTimeout());
45
	}
46
47
	/**
48
	 * Define environment setup.
49
	 *
50
	 * @param  \Illuminate\Foundation\Application $app
51
	 *
52
	 * @return void
53
	 */
54
	protected function getEnvironmentSetUp($app) {
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
	}
59
60
	/**
61
	 * Setup the test environment.
62
	 */
63
	protected function setUp(): void {
64
65
		parent::setUp(); // TODO: Change the autogenerated stub
66
67
		$this->recaptcha = new ReCaptchaBuilderV2('api_site_key', 'api_secret_key');
68
	}
69
}