diff --git a/.gitignore b/.gitignore index 29ba421..283f98c 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ composer.lock /dist/ .idea tests-clover.xml -tests-junit.xml \ No newline at end of file +tests-junit.xml +.phpunit.result.cache diff --git a/phpunit.xml b/phpunit.xml index 4ea43f9..f6cdc73 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -12,6 +12,6 @@ - + diff --git a/test/statifyblacklist-test.php b/test/statifyblacklist-test.php index bd4d062..29a7b43 100644 --- a/test/statifyblacklist-test.php +++ b/test/statifyblacklist-test.php @@ -320,7 +320,15 @@ class StatifyBlacklist_Test extends PHPUnit\Framework\TestCase { $invalid = array( '12.34.56.789', '192.0.2.123/33', '192.0.2.123/-1' ); $result = invoke_static( StatifyBlacklist_Admin::class, 'sanitizeIPs', array( array_merge( $valid, $invalid ) ) ); $this->assertNotFalse( $result ); - $this->assertInternalType( 'array', $result ); + /* + * Unfortunately this is nencessary as long as we run PHP 5 tests, because "assertInternalType" is deprecated + * as of PHPUnit 8, but "assertIsArray" has been introduces in PHPUnit 7.5 which requires PHP >= 7.1. + */ + if ( method_exists( $this, 'assertIsArray' ) ) { + $this->assertIsArray( $result ); + } else { + $this->assertInternalType( 'array', $result ); + } $this->assertEquals( $valid, $result ); // IPv6 tests. @@ -339,7 +347,11 @@ class StatifyBlacklist_Test extends PHPUnit\Framework\TestCase { ); $result = invoke_static( StatifyBlacklist_Admin::class, 'sanitizeIPs', array( array_merge( $valid, $invalid ) ) ); $this->assertNotFalse( $result ); - $this->assertInternalType( 'array', $result ); + if ( method_exists( $this, 'assertIsArray' ) ) { + $this->assertIsArray( $result ); + } else { + $this->assertInternalType( 'array', $result ); + } $this->assertEquals( $valid, $result ); }