Skip to content

Commit

Permalink
[FEATURE] PHP8.1 support.
Browse files Browse the repository at this point in the history
Minor changes required for PHP 8.1 support.
  • Loading branch information
Ian Jenkins committed Mar 3, 2022
1 parent a4d98ee commit 2746cdf
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
language: php

dist: bionic

php:
- 7.4
- 8.0
- nightly
- 8.1.0

matrix:
allow_failures:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ These are run offline at the developers request. The purpose of these tests is t

> Update details accordingly
`tests/create-test-db.sh`
`tests/Integration/create-test-db.sh`

### Running the tests

Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
}
},
"require": {
"php": "^7.4 || ^8.0",
"php": "^7.4 || ^8.0 || ^8.1",
"cache/array-adapter": "^1.1",
"doctrine/annotations": "^1.13"
},
"require-dev": {
"phpunit/phpunit": "^7 || ^9",
"roots/wordpress": "^5.8",
"symfony/dotenv": "^5.3",
"symfony/dotenv": "^5.3 || ^6.0",
"wp-phpunit/wp-phpunit": "^5.8",
"yoast/phpunit-polyfills": "^1.0"
},
Expand All @@ -38,7 +38,8 @@
"test:coverage": "php -dxdebug.mode=coverage bin/phpunit --coverage-clover='./clover.xml'",
"test:integration": "vendor/bin/phpunit --testsuite integration",
"php-cs-fixer:test": "tools/php-cs-fixer/vendor/bin/php-cs-fixer fix -v --diff --dry-run",
"php-cs-fixer:fix": "tools/php-cs-fixer/vendor/bin/php-cs-fixer fix -v --diff"
"php-cs-fixer:fix": "tools/php-cs-fixer/vendor/bin/php-cs-fixer fix -v --diff",
"install-tools": "@composer install --working-dir=tools/php-cs-fixer"
},
"extra": {
"wordpress-install-dir": "tests/integration/wp"
Expand Down
5 changes: 4 additions & 1 deletion tests/Integration/HooksIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@

declare(strict_types=1);

namespace BoxUk\WpHookAttributes\Tests\Integration;

use BoxUk\WpHookAttributes\WordPressHookAttributes;
use WP_UnitTestCase;

/**
* @group integration
*/
class HooksIntegrationTest extends WP_UnitTestCase
{
public function setUp()
public function setUp(): void
{
// Makes the tests much faster.
tests_add_filter('wp_hook_attributes_registered_namespaces', function () {
Expand Down
3 changes: 2 additions & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

if ($is_integration) {
if (is_readable(__DIR__ . '/integration/.env')) {
$dotenv = new Dotenv(true);
$dotenv = new Dotenv();
$dotenv->usePutenv(true);
$dotenv->load(__DIR__ . '/integration/.env');
}

Expand Down

0 comments on commit 2746cdf

Please sign in to comment.