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
|
|
|
* Define environment setup. |
42
|
|
|
* |
43
|
|
|
* @param \Illuminate\Foundation\Application $app |
44
|
|
|
* |
45
|
|
|
* @return void |
46
|
|
|
*/ |
47
|
|
|
protected function getEnvironmentSetUp($app) |
48
|
|
|
{ |
49
|
|
|
|
50
|
|
|
$app['config']->set('recaptcha.default_language', 'it'); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Setup the test environment. |
55
|
|
|
*/ |
56
|
|
|
protected function setUp(): void |
57
|
|
|
{ |
58
|
|
|
|
59
|
|
|
parent::setUp(); // TODO: Change the autogenerated stub |
60
|
|
|
|
61
|
|
|
$this->recaptcha_invisible = new ReCaptchaBuilderInvisible('api_site_key', 'api_secret_key'); |
62
|
|
|
$this->recaptcha_v2 = new ReCaptchaBuilderV2('api_site_key', 'api_secret_key'); |
63
|
|
|
|
64
|
|
|
} |
65
|
|
|
} |