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

ReCaptchaConfigurationTest::testGetApiSecretKey()   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\ReCaptchaBuilder;
14
use Biscolab\ReCaptcha\ReCaptchaBuilderV2;
15
16
/**
17
 * Class ReCaptchaConfigurationTest
18
 * @package Biscolab\ReCaptcha\Tests
19
 */
20
class ReCaptchaConfigurationTest extends TestCase
21
{
22
23
	/**
24
	 * @var ReCaptchaBuilder
25
	 */
26
	protected $recaptcha;
27
28
	/**
29
	 * @test
30
	 */
31
	public function testGetApiSiteKey() {
32
		$this->assertEquals("api_site_key", $this->recaptcha->getApiSiteKey());
33
	}
34
35
	/**
36
	 * @test
37
	 */
38
	public function testGetApiSecretKey() {
39
		$this->assertEquals("api_secret_key", $this->recaptcha->getApiSecretKey());
40
	}
41
42
	/**
43
	 * @test
44
	 */
45
	public function testSkipIpWhiteListIsArray()
46
	{
47
48
		$ip_whitelist = $this->recaptcha->getIpWhitelist();
49
		$this->assertTrue(is_array($ip_whitelist));
50
		$this->assertCount(2, $ip_whitelist);
51
	}
52
53
	/**
54
	 * @test
55
	 */
56
	public function testCurlTimeoutIsSet()
57
	{
58
59
		$this->assertEquals(3, $this->recaptcha->getCurlTimeout());
60
	}
61
62
	/**
63
	 * Define environment setup.
64
	 *
65
	 * @param  \Illuminate\Foundation\Application $app
66
	 *
67
	 * @return void
68
	 */
69
	protected function getEnvironmentSetUp($app)
70
	{
71
72
		$app['config']->set('recaptcha.skip_ip', '10.0.0.1,10.0.0.2');
73
		$app['config']->set('recaptcha.curl_timeout', 3);
74
	}
75
76
	/**
77
	 * Setup the test environment.
78
	 */
79
	protected function setUp(): void
80
	{
81
82
		parent::setUp(); // TODO: Change the autogenerated stub
83
84
		$this->recaptcha = new ReCaptchaBuilderV2('api_site_key', 'api_secret_key');
85
	}
86
}