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

Commit 67ae3dd

Browse files
committed
Merge branch 'feature/improve_testing_v3' into develop
2 parents df3a28c + e7c0bdf commit 67ae3dd

File tree

7 files changed

+72
-13
lines changed

7 files changed

+72
-13
lines changed

.editorconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[*]
2+
charset=utf-8
3+
end_of_line=lf
4+
insert_final_newline=false
5+
indent_style=space
6+
indent_size=4
7+
8+
[{*.hphp,*.phtml,*.module,*.php,*.php5,*.php4,*.inc}]
9+
indent_style=tab
10+
tab_width=4
11+
12+
[{*.yml,*.yaml}]
13+
indent_style=space
14+
indent_size=2

.gitattributes

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/tests export-ignore
2+
/.gitattributes export-ignore
3+
/.gitignore export-ignore
4+
/.scrutinizer.yml export-ignore
5+
/.travis.yml export-ignore
6+
/phpunit.xml export-ignore
7+
/changelog.md export-ignore
8+
/readme.md export-ignore

.gitignore

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
11
vendor/
2-
node_modules/
32
/.idea
43

5-
# Laravel 4 specific
6-
bootstrap/compiled.php
7-
app/storage/
8-
9-
# Laravel 5 & Lumen specific
10-
bootstrap/cache/
11-
.env.*.php
12-
.env.php
13-
.env
14-
154
# Rocketeer PHP task runner and deployment package. https://github.com/rocketeers/rocketeer
165
.rocketeer/
176

187
# composer
198
/composer.lock
209
/composer.local.*
2110
/composer.phar
22-
/coverage.clover
11+
12+
# coverage reports
13+
/coverage.clover
14+
coverage.xml
15+
clover.xml
16+
report/

.scrutinizer.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
build:
2+
nodes:
3+
coverage:
4+
tests:
5+
override:
6+
- command: vendor/bin/phpunit --coverage-clover=clover.xml
7+
coverage:
8+
file: clover.xml
9+
format: clover

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ language: php
33
php:
44
- 7.1
55
- 7.2
6+
- 7.3
67
- hhvm
78

89
before_script:

phpunit.xml.dist

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
</testsuites>
1616
<filter>
1717
<whitelist processUncoveredFilesFromWhitelist="true">
18-
<directory suffix=".php">./app</directory>
18+
<directory suffix=".php">./src</directory>
19+
<exclude>
20+
<directory suffix=".php">./vendor</directory>
21+
<directory suffix=".php">./config</directory>
22+
</exclude>
1923
</whitelist>
2024
</filter>
2125
</phpunit>

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)