Completed
Push — master ( c75806...3e990f )
by Roberto
04:28 queued 10s
created

testHtmlScriptTagJsApiGetHtmlScriptOverridingHlParam()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 2
c 1
b 1
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
1
<?php
2
/**
3
 * Copyright (c) 2017 - present
4
 * LaravelGoogleRecaptcha - ReCaptchaLangTest.php
5
 * author: Roberto Belotti - [email protected]
6
 * web : robertobelotti.com, github.com/biscolab
7
 * Initial version created on: 7/8/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\Facades\ReCaptcha;
14
use Biscolab\ReCaptcha\ReCaptchaBuilderInvisible;
15
use Biscolab\ReCaptcha\ReCaptchaBuilderV2;
16
17
class ReCaptchaLangTest extends TestCase
18
{
19
20
	/**
21
	 * @var ReCaptchaBuilderInvisible
22
	 */
23
	protected $recaptcha_invisible;
24
25
	/**
26
	 * @var ReCaptchaBuilderV2
27
	 */
28
	protected $recaptcha_v2;
29
30
	/**
31
	 * @tests
32
	 */
33
	public function testHtmlScriptTagJsApiGetHtmlScriptWithHlParam()
34
	{
35
36
		$r = ReCaptcha::htmlScriptTagJsApi();
37
		$this->assertEquals('<script src="https://www.google.com/recaptcha/api.js?hl=it" async defer></script>', $r);
38
	}
39
40
	/**
41
	 * @tests
42
	 */
43
	public function testHtmlScriptTagJsApiGetHtmlScriptOverridingHlParam()
44
	{
45
46
		$r = ReCaptcha::htmlScriptTagJsApi(['lang' => 'en']);
47
		$this->assertEquals('<script src="https://www.google.com/recaptcha/api.js?hl=en" async defer></script>', $r);
48
	}
49
50
	/**
51
	 * Define environment setup.
52
	 *
53
	 * @param  \Illuminate\Foundation\Application $app
54
	 *
55
	 * @return void
56
	 */
57
	protected function getEnvironmentSetUp($app)
58
	{
59
60
		$app['config']->set('recaptcha.default_language', 'it');
61
	}
62
63
	/**
64
	 * Setup the test environment.
65
	 */
66
	protected function setUp(): void
67
	{
68
69
		parent::setUp(); // TODO: Change the autogenerated stub
70
71
		$this->recaptcha_invisible = new ReCaptchaBuilderInvisible('api_site_key', 'api_secret_key');
72
		$this->recaptcha_v2 = new ReCaptchaBuilderV2('api_site_key', 'api_secret_key');
73
74
	}
75
}