Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ phpunit.xml
phpcs.xml
.phpcs.xml
.phpunit.result.cache
.phpunit.cache
build/logs
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"wp-cli/eval-command": "^1 || ^2",
"wp-cli/wp-cli": "^2.12",
"wp-coding-standards/wpcs": "^3",
"yoast/phpunit-polyfills": "^1.0.3 || ^2.0.1"
"yoast/phpunit-polyfills": "^4.0.0"
},
"require-dev": {
"roave/security-advisories": "dev-latest"
Expand Down
3 changes: 3 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<?xml version="1.0" ?>
<phpunit
bootstrap="tests/bootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertWarningsToExceptions="true"
convertNoticesToExceptions="true"
convertDeprecationsToExceptions="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.5/phpunit.xsd"
>
<testsuites>
<testsuite name="default">
Expand Down
31 changes: 12 additions & 19 deletions tests/tests/TestBehatTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use WP_CLI\Tests\TestCase;
use WP_CLI\Utils;
use PHPUnit\Framework\Attributes\DataProvider;

class TestBehatTags extends TestCase {

Expand Down Expand Up @@ -37,6 +38,7 @@ protected function tear_down(): void {
* @param string $env
* @param string $expected
*/
#[DataProvider( 'data_behat_tags_wp_version_github_token' )] // phpcs:ignore PHPCompatibility.Attributes.NewAttributes.PHPUnitAttributeFound
public function test_behat_tags_wp_version_github_token( $env, $expected ): void {
$env_wp_version = getenv( 'WP_VERSION' );
$env_github_token = getenv( 'GITHUB_TOKEN' );
Expand Down Expand Up @@ -110,25 +112,7 @@ public function test_behat_tags_php_version(): void {
$contents = '';
$expected = '';

if ( '5.3' === $php_version ) {
$contents = '@require-php-5.2 @require-php-5.3 @require-php-5.4 @less-than-php-5.2 @less-than-php-5.3 @less-than-php-5.4';
$expected = '[email protected]&&[email protected]&&[email protected]';
} elseif ( '5.4' === $php_version ) {
$contents = '@require-php-5.3 @require-php-5.4 @require-php-5.5 @less-than-php-5.3 @less-than-php-5.4 @less-than-php-5.5';
$expected = '[email protected]&&[email protected]&&[email protected]';
} elseif ( '5.5' === $php_version ) {
$contents = '@require-php-5.4 @require-php-5.5 @require-php-5.6 @less-than-php-5.4 @less-than-php-5.5 @less-than-php-5.6';
$expected = '[email protected]&&[email protected]&&[email protected]';
} elseif ( '5.6' === $php_version ) {
$contents = '@require-php-5.5 @require-php-5.6 @require-php-7.0 @less-than-php-5.5 @less-than-php-5.6 @less-than-php-7.0';
$expected = '[email protected]&&[email protected]&&[email protected]';
} elseif ( '7.0' === $php_version ) {
$contents = '@require-php-5.6 @require-php-7.0 @require-php-7.1 @less-than-php-5.6 @less-than-php-7.0 @less-than-php-7.1';
$expected = '[email protected]&&[email protected]&&[email protected]';
} elseif ( '7.1' === $php_version ) {
$contents = '@require-php-7.0 @require-php-7.1 @require-php-7.2 @less-than-php-7.0 @less-than-php-7.1 @less-than-php-7.2';
$expected = '[email protected]&&[email protected]&&[email protected]';
} elseif ( '7.2' === $php_version ) {
if ( '7.2' === $php_version ) {
$contents = '@require-php-7.1 @require-php-7.2 @require-php-7.3 @less-than-php-7.1 @less-than-php-7.2 @less-than-php-7.3';
$expected = '[email protected]&&[email protected]&&[email protected]';
} elseif ( '7.3' === $php_version ) {
Expand All @@ -143,6 +127,15 @@ public function test_behat_tags_php_version(): void {
} elseif ( '8.1' === $php_version ) {
$contents = '@require-php-8.0 @require-php-8.1 @require-php-8.2 @less-than-php-8.0 @less-than-php-8.1 @less-than-php-8.2';
$expected = '[email protected]&&[email protected]&&[email protected]';
} elseif ( '8.2' === $php_version ) {
$contents = '@require-php-8.0 @require-php-8.1 @require-php-8.2 @require-php-8.3 @less-than-php-8.0 @less-than-php-8.1 @less-than-php-8.2 @less-than-php-8.3 @less-than-php-8.4';
$expected = '[email protected]&&[email protected]&&[email protected]&&[email protected]';
} elseif ( '8.3' === $php_version ) {
$contents = '@require-php-8.1 @require-php-8.2 @require-php-8.3 @require-php-8.4 @less-than-php-8.0 @less-than-php-8.1 @less-than-php-8.2 @less-than-php-8.3 @less-than-php-8.4';
$expected = '[email protected]&&[email protected]&&[email protected]&&[email protected]&&[email protected]';
} elseif ( '8.4' === $php_version ) {
$contents = '@require-php-8.2 @require-php-8.3 @require-php-8.4 @require-php-8.5 @less-than-php-8.0 @less-than-php-8.1 @less-than-php-8.2 @less-than-php-8.3 @less-than-php-8.4 @less-than-php-8.5';
$expected = '[email protected]&&[email protected]&&[email protected]&&[email protected]&&[email protected]&&[email protected]';
} else {
$this->markTestSkipped( "No test for PHP_VERSION $php_version." );
}
Expand Down