Skip to content
This repository was archived by the owner on Jun 10, 2024. It is now read-only.

Commit 6da50b8

Browse files
committed
test improved for controller
1 parent 4add6c9 commit 6da50b8

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/ReCaptchaV3Test.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
namespace Biscolab\ReCaptcha\Tests;
1212

13+
use Biscolab\ReCaptcha\Controllers\ReCaptchaController;
1314
use Biscolab\ReCaptcha\ReCaptchaBuilderV3;
15+
use Illuminate\Support\Facades\App;
1416

1517
/**
1618
* Class ReCaptchaV3Test
@@ -73,6 +75,33 @@ public function testCustomValidationFunction() {
7375
$this->assertRegexp('/functionCustomValidation\(token\)/', $r);
7476
}
7577

78+
/**
79+
* @test
80+
*/
81+
public function testValidateController() {
82+
83+
$controller = App::make(ReCaptchaController::class);
84+
$return = $controller->validateV3();
85+
86+
$this->assertArrayHasKey("success", $return);
87+
$this->assertArrayHasKey("error-codes", $return);
88+
}
89+
90+
/**
91+
* Define environment setup.
92+
*
93+
* @param \Illuminate\Foundation\Application $app
94+
*
95+
* @return void
96+
*/
97+
protected function getEnvironmentSetUp($app) {
98+
99+
$app['config']->set('recaptcha.version', 'v3');
100+
}
101+
102+
/**
103+
* Setup the test environment.
104+
*/
76105
protected function setUp() {
77106

78107
parent::setUp(); // TODO: Change the autogenerated stub

0 commit comments

Comments
 (0)