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

Commit 933da69

Browse files
committed
Merge branch 'feature/php8' into develop
2 parents 998da06 + c2b72ce commit 933da69

10 files changed

+54
-61
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,8 @@ vendor/
1313
/coverage.clover
1414
coverage.xml
1515
clover.xml
16-
report/
16+
report/
17+
18+
# testing
19+
.phpunit.result.cache
20+
phpunit.xml.dist.bak

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
language: php
22

33
php:
4-
- 7.1
5-
- 7.2
64
- 7.3
75
- 7.4
86

97
before_script:
108
- travis_retry composer self-update
119
- travis_retry composer install --prefer-source --no-interaction
1210

13-
fast_finish: true
11+
fast_finish: true

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Laravel ReCAPTCHA v3, checkbox and invisible
22

3-
Simple and painless Google reCAPTCHA package for Laravel 5.5 or greater
3+
Simple and painless Google reCAPTCHA package for Laravel framework
44

55
Available reCAPTCHA versions:
66

@@ -14,17 +14,18 @@ Available reCAPTCHA versions:
1414

1515
## System requirements
1616

17-
| Package | reCAPTCHA | PHP | Laravel | Docs |
18-
| ---------------- | ----------------------------- | --------------------- | ---------------------------- | ---------------------------------------------------------------------- |
19-
| 4.2.x or greater | v3, v2 Invisible, v2 Checkbox | 7.1 or greater | 5.5 or greater, 6, 7, 8 | [latest](https://laravel-recaptcha-docs.biscolab.com) |
20-
| 4.1.x | v3, v2 Invisible, v2 Checkbox | 7.1 or greater | 5.5 or greater, 6, 7 | [v4.1.x](https://laravel-recaptcha-docs.biscolab.com/docs/4.1.x/intro) |
21-
| 4.0.x | v3, v2 Invisible, v2 Checkbox | 7.1 or greater | 5.5 or greater, 6 | [v4.0.x](https://laravel-recaptcha-docs.biscolab.com/docs/4.0.x/intro) |
22-
| 3.x | v3, v2 Invisible, v2 Checkbox | 7.1 or greater | 5.5 or greater, 6 ready (\*) | [v3.6.1](https://laravel-recaptcha-docs.biscolab.com/docs/3.6.1/intro) |
23-
| 2.x | v2 Invisible, v2 Checkbox | 5.5.9, 7.0 or greater | 5.0 or greater | [v2.0.4](https://laravel-recaptcha-docs.biscolab.com/docs/2.0.4/intro) |
17+
| Package | reCAPTCHA | PHP | Laravel | Docs |
18+
| -------------- | ----------------------------- | --------------------- | ---------------------------- | ---------------------------------------------------------------------- |
19+
| 5.x | v3, v2 Invisible, v2 Checkbox | 7.3 or greater | 7, 8 | [latest](https://laravel-recaptcha-docs.biscolab.com) |
20+
| 4.2.x to 4.4.x | v3, v2 Invisible, v2 Checkbox | 7.1 or greater | 5.5 or greater, 6, 7, 8 | [v4.4.x](https://laravel-recaptcha-docs.biscolab.com/docs/4.4.x/intro) |
21+
| 4.1.x | v3, v2 Invisible, v2 Checkbox | 7.1 or greater | 5.5 or greater, 6, 7 | [v4.1.x](https://laravel-recaptcha-docs.biscolab.com/docs/4.1.x/intro) |
22+
| 4.0.x | v3, v2 Invisible, v2 Checkbox | 7.1 or greater | 5.5 or greater, 6 | [v4.0.x](https://laravel-recaptcha-docs.biscolab.com/docs/4.0.x/intro) |
23+
| 3.x | v3, v2 Invisible, v2 Checkbox | 7.1 or greater | 5.5 or greater, 6 ready (\*) | [v3.6.1](https://laravel-recaptcha-docs.biscolab.com/docs/3.6.1/intro) |
24+
| 2.x | v2 Invisible, v2 Checkbox | 5.5.9, 7.0 or greater | 5.0 or greater | [v2.0.4](https://laravel-recaptcha-docs.biscolab.com/docs/2.0.4/intro) |
2425

2526
> (\*) Latest version (3.6.1) is Laravel 6 ready
2627
27-
> If you are migrating from either v2.x or v3.x to the latest package version, please, take a look about migration to v4.x in [What's new in v4.x](https://laravel-recaptcha-docs.biscolab.com/docs/whats-new) before any changes
28+
> If you are migrating to latest version, please take a look at [What's new](https://laravel-recaptcha-docs.biscolab.com/docs/whats-new) before any changes
2829
2930
## Documentation
3031

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "biscolab/laravel-recaptcha",
3-
"description": "Simple and painless Google reCAPTCHA package for Laravel 5.5 or greater",
4-
"version": "4.4.0",
3+
"description": "Simple and painless Google reCAPTCHA package for Laravel framework",
4+
"version": "5.0.0",
55
"license": "MIT",
66
"type": "library",
77
"keywords": [
@@ -20,12 +20,12 @@
2020
}
2121
],
2222
"require": {
23-
"php": "^7.1",
24-
"laravel/framework": "^5.5|^6.0|^7.0|^8.0"
23+
"php": "^7.3|^8.0",
24+
"laravel/framework": "^7.0|^8.0"
2525
},
2626
"require-dev": {
27-
"orchestra/testbench": "~3.0",
28-
"phpunit/phpunit": "6.*|7.*"
27+
"orchestra/testbench": "5.*|6.*",
28+
"phpunit/phpunit": "^9.1"
2929
},
3030
"autoload": {
3131
"psr-4": {

phpunit.xml.dist

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,17 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit backupGlobals="false"
3-
backupStaticAttributes="false"
4-
bootstrap="vendor/autoload.php"
5-
colors="true"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
9-
processIsolation="false"
10-
stopOnFailure="false">
11-
<testsuites>
12-
<testsuite name="Unit">
13-
<directory>./tests</directory>
14-
</testsuite>
15-
</testsuites>
16-
<filter>
17-
<whitelist processUncoveredFilesFromWhitelist="true">
18-
<directory suffix=".php">./src</directory>
19-
<exclude>
20-
<directory suffix=".php">./vendor</directory>
21-
<directory suffix=".php">./config</directory>
22-
</exclude>
23-
</whitelist>
24-
</filter>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage processUncoveredFiles="true">
4+
<include>
5+
<directory suffix=".php">./src</directory>
6+
</include>
7+
<exclude>
8+
<directory suffix=".php">./vendor</directory>
9+
<directory suffix=".php">./config</directory>
10+
</exclude>
11+
</coverage>
12+
<testsuites>
13+
<testsuite name="Unit">
14+
<directory>./tests</directory>
15+
</testsuite>
16+
</testsuites>
2517
</phpunit>

tests/ReCaptchaCustomApiDomainTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ public function testRecaptchaApiDomainChangesByConfig()
4949
*/
5050
public function testRecaptchaApiDomainChangesByConfigInHtmlScriptTagJsApi()
5151
{
52-
$this->assertContains("https://www.recaptcha.net/recaptcha/api.js", $this->recaptcha_v2->htmlScriptTagJsApi());
53-
$this->assertContains("https://www.recaptcha.net/recaptcha/api.js", $this->recaptcha_invisible->htmlScriptTagJsApi());
54-
$this->assertContains("https://www.recaptcha.net/recaptcha/api.js", $this->recaptcha_v3->htmlScriptTagJsApi());
52+
$this->assertStringContainsString("https://www.recaptcha.net/recaptcha/api.js", $this->recaptcha_v2->htmlScriptTagJsApi());
53+
$this->assertStringContainsString("https://www.recaptcha.net/recaptcha/api.js", $this->recaptcha_invisible->htmlScriptTagJsApi());
54+
$this->assertStringContainsString("https://www.recaptcha.net/recaptcha/api.js", $this->recaptcha_v3->htmlScriptTagJsApi());
5555
}
5656

5757
/**

tests/ReCaptchaHelpersInvisibleTest.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Copyright (c) 2017 - present
45
* LaravelGoogleRecaptcha - ReCaptchaHelpersInvisibleTest.phpp
@@ -26,7 +27,6 @@ public function testHtmlScriptTagJsApiCalledByFacade()
2627
->with(["form_id" => "test-form"]);
2728

2829
htmlScriptTagJsApi(["form_id" => "test-form"]);
29-
3030
}
3131

3232
/**
@@ -40,7 +40,6 @@ public function testHtmlFormButtonCalledByFacade()
4040
->with("Inner text", ['id' => 'button_id']);
4141

4242
htmlFormButton("Inner text", ['id' => 'button_id']);
43-
4443
}
4544

4645
/**
@@ -53,10 +52,10 @@ public function testGetFormIdCalledByFacade()
5352
->once();
5453

5554
getFormId();
56-
5755
}
5856

59-
public function testHtmlFormButtonConfiguration() {
57+
public function testHtmlFormButtonConfiguration()
58+
{
6059
$button_html = htmlFormButton("Inner text", ['id' => 'button_id', 'class' => 'button_class', 'data-sitekey' => 'custom-data-sitekey', 'data-callback' => 'myCallback']);
6160

6261
$this->assertEquals('<button class="button_class g-recaptcha" data-callback="biscolabLaravelReCaptcha" data-sitekey="api_site_key" id="button_id">Inner text</button>', $button_html);
@@ -69,11 +68,11 @@ public function testHtmlFormButtonConfiguration() {
6968
public function testHtmlFormSnippetCalledByFacade()
7069
{
7170

71+
$this->expectException('\TypeError');
7272
ReCaptcha::shouldReceive('htmlFormSnippet')
7373
->once();
7474

7575
htmlFormSnippet();
76-
7776
}
7877

7978
public function testGetFormIdReturnDefaultFormIdValue()
@@ -95,4 +94,4 @@ protected function getEnvironmentSetUp($app)
9594
$app['config']->set('recaptcha.api_site_key', 'api_site_key');
9695
$app['config']->set('recaptcha.version', 'invisible');
9796
}
98-
}
97+
}

tests/ReCaptchaHelpersV2Test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function testExpectReCaptchaInstanceOfReCaptchaBuilderV2()
8383
*/
8484
public function testExpectExceptionWhenGetFormIdFunctionIsCalled()
8585
{
86-
86+
$this->expectException('\Error');
8787
getFormId();
8888
}
8989

tests/ReCaptchaTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function testReCaptchaV2HtmlFormSnippet()
9494
*/
9595
public function testReCaptchaInvisibleHtmlFormSnippetShouldThrowError()
9696
{
97-
97+
$this->expectException('\Error');
9898
$this->recaptcha_invisible->htmlFormSnippet();
9999
}
100100

@@ -157,7 +157,7 @@ public function testDefaultCurlTimeout()
157157
*/
158158
public function testReCaptchaV2htmlFormButtonShouldThrowError()
159159
{
160-
160+
$this->expectException('\Error');
161161
$this->recaptcha_v2->htmlFormButton();
162162
}
163163

tests/ReCaptchaV3Test.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Copyright (c) 2017 - present
45
* LaravelGoogleRecaptcha - ReCaptchaV3Test.php
@@ -40,7 +41,7 @@ public function testAction()
4041
{
4142

4243
$r = $this->recaptcha_v3->htmlScriptTagJsApi(['action' => 'someAction']);
43-
$this->assertRegexp('/someAction/', $r);
44+
$this->assertMatchesRegularExpression('/someAction/', $r);
4445
}
4546

4647
/**
@@ -50,7 +51,7 @@ public function testFetchCallbackFunction()
5051
{
5152

5253
$r = $this->recaptcha_v3->htmlScriptTagJsApi(['callback_then' => 'functionCallbackThen']);
53-
$this->assertRegexp('/functionCallbackThen\(response\)/', $r);
54+
$this->assertMatchesRegularExpression('/functionCallbackThen\(response\)/', $r);
5455
}
5556

5657
/**
@@ -60,7 +61,7 @@ public function testcCatchCallbackFunction()
6061
{
6162

6263
$r = $this->recaptcha_v3->htmlScriptTagJsApi(['callback_catch' => 'functionCallbackCatch']);
63-
$this->assertRegexp('/functionCallbackCatch\(err\)/', $r);
64+
$this->assertMatchesRegularExpression('/functionCallbackCatch\(err\)/', $r);
6465
}
6566

6667
/**
@@ -70,7 +71,7 @@ public function testCustomValidationFunction()
7071
{
7172

7273
$r = $this->recaptcha_v3->htmlScriptTagJsApi(['custom_validation' => 'functionCustomValidation']);
73-
$this->assertRegexp('/functionCustomValidation\(token\)/', $r);
74+
$this->assertMatchesRegularExpression('/functionCustomValidation\(token\)/', $r);
7475
}
7576

7677
/**
@@ -106,7 +107,6 @@ public function testHtmlScriptTagJsApiCalledByFacade()
106107
->with([]);
107108

108109
htmlScriptTagJsApi([]);
109-
110110
}
111111

112112
/**
@@ -132,6 +132,5 @@ protected function setUp(): void
132132
parent::setUp(); // TODO: Change the autogenerated stub
133133

134134
$this->recaptcha_v3 = new ReCaptchaBuilderV3('api_site_key', 'api_secret_key');
135-
136135
}
137-
}
136+
}

0 commit comments

Comments
 (0)