1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Copyright (c) 2017 - present |
4
|
|
|
* LaravelGoogleRecaptcha - ReCaptchaHelpersInvisibleTest.phpp |
5
|
|
|
* author: Roberto Belotti - [email protected] |
6
|
|
|
* web : robertobelotti.com, github.com/biscolab |
7
|
|
|
* Initial version created on: 8/8/2019 |
8
|
|
|
* MIT license: https://github.com/biscolab/laravel-recaptcha/blob/master/LICENSE |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
|
12
|
|
|
namespace Biscolab\ReCaptcha\Tests; |
13
|
|
|
|
14
|
|
|
use Biscolab\ReCaptcha\Facades\ReCaptcha; |
15
|
|
|
use Biscolab\ReCaptcha\ReCaptchaServiceProvider; |
16
|
|
|
|
17
|
|
|
class ReCaptchaHelpersInvisibleTest extends TestCase |
18
|
|
|
{ |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @test |
22
|
|
|
*/ |
23
|
|
|
public function testHtmlScriptTagJsApiCalledByFacade() |
24
|
|
|
{ |
25
|
|
|
ReCaptcha::shouldReceive('htmlScriptTagJsApi') |
26
|
|
|
->once() |
27
|
|
|
->with("key"); |
28
|
|
|
|
29
|
|
|
htmlScriptTagJsApi("key"); |
30
|
|
|
|
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @test |
35
|
|
|
*/ |
36
|
|
|
public function testHtmlScriptTagJsApiV3CalledByFacade() |
37
|
|
|
{ |
38
|
|
|
ReCaptcha::shouldReceive('htmlScriptTagJsApiV3') |
39
|
|
|
->once() |
40
|
|
|
->with([]); |
41
|
|
|
|
42
|
|
|
htmlScriptTagJsApiV3([]); |
43
|
|
|
|
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @test |
48
|
|
|
*/ |
49
|
|
|
public function testHtmlFormButtonCalledByFacade() |
50
|
|
|
{ |
51
|
|
|
ReCaptcha::shouldReceive('htmlFormButton') |
52
|
|
|
->once() |
53
|
|
|
->with("key"); |
54
|
|
|
|
55
|
|
|
htmlFormButton("key"); |
56
|
|
|
|
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @test |
61
|
|
|
* @expectedException \TypeError |
62
|
|
|
*/ |
63
|
|
|
public function testHtmlFormSnippetCalledByFacade() |
64
|
|
|
{ |
65
|
|
|
ReCaptcha::shouldReceive('htmlFormSnippet') |
66
|
|
|
->once(); |
67
|
|
|
|
68
|
|
|
htmlFormSnippet(); |
69
|
|
|
|
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Define environment setup. |
75
|
|
|
* |
76
|
|
|
* @param \Illuminate\Foundation\Application $app |
77
|
|
|
* |
78
|
|
|
* @return void |
79
|
|
|
*/ |
80
|
|
|
protected function getEnvironmentSetUp($app) |
81
|
|
|
{ |
82
|
|
|
|
83
|
|
|
$app['config']->set('recaptcha.api_site_key', 'api_site_key'); |
84
|
|
|
$app['config']->set('recaptcha.api_site_key', 'api_site_key'); |
85
|
|
|
$app['config']->set('recaptcha.version', 'invisible'); |
86
|
|
|
} |
87
|
|
|
} |