Skip to content

Commit

Permalink
Merge pull request #206 from wp-cli/fix/205-polyfills
Browse files Browse the repository at this point in the history
Support `yoast/phpunit-polyfills`
  • Loading branch information
swissspidy committed May 20, 2024
2 parents 3cab4c5 + 80ef437 commit 0c5c2e9
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ composer.lock
phpunit.xml
phpcs.xml
.phpcs.xml
.phpunit.result.cache
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"wp-cli/eval-command": "^1 || ^2",
"wp-cli/wp-cli": "^2.5.1",
"wp-coding-standards/wpcs": "^3",
"yoast/phpunit-polyfills": "^1.0.3"
"yoast/phpunit-polyfills": "^1.0.3 || ^2.0.1"
},
"require-dev": {
"roave/security-advisories": "dev-latest"
Expand Down
4 changes: 2 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
>
<testsuites>
<testsuite name="default">
<directory prefix="spec-" suffix=".php">tests/</directory>
<directory prefix="test-" suffix=".php">tests/</directory>
<directory prefix="Spec" suffix=".php">tests/</directory>
<directory prefix="Test" suffix=".php">tests/tests</directory>
</testsuite>
</testsuites>
</phpunit>
2 changes: 1 addition & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

require_once VENDOR_DIR . '/autoload.php';
require_once WP_CLI_ROOT . '/php/utils.php';
require_once __DIR__ . '/wp-cli-testcase.php';
require_once __DIR__ . '/includes/TestCase.php';

function wpcli_tests_include_config( array $config_filenames = [] ) {
$config_filename = false;
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions tests/test-behat-tags.php → tests/tests/TestBehatTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use WP_CLI\Tests\TestCase;
use WP_CLI\Utils;

class BehatTagsTest extends TestCase {
class TestBehatTags extends TestCase {

public $temp_dir;

Expand Down Expand Up @@ -39,7 +39,7 @@ public function test_behat_tags_wp_version_github_token( $env, $expected ) {
putenv( 'WP_VERSION' );
putenv( 'GITHUB_TOKEN' );

$behat_tags = dirname( __DIR__ ) . '/utils/behat-tags.php';
$behat_tags = dirname( dirname( __DIR__ ) ) . '/utils/behat-tags.php';

$contents = '@require-wp-4.6 @require-wp-4.8 @require-wp-4.9 @less-than-wp-4.6 @less-than-wp-4.8 @less-than-wp-4.9';
file_put_contents( $this->temp_dir . '/features/wp_version.feature', $contents );
Expand All @@ -64,7 +64,7 @@ public function test_behat_tags_wp_version_github_token( $env, $expected ) {
putenv( false === $env_github_token ? 'GITHUB_TOKEN' : "GITHUB_TOKEN=$env_github_token" );
}

public function data_behat_tags_wp_version_github_token() {
public static function data_behat_tags_wp_version_github_token() {
return array(
array( 'WP_VERSION=4.5', '~@require-wp-4.6&&~@require-wp-4.8&&~@require-wp-4.9&&~@github-api' ),
array( 'WP_VERSION=4.6', '~@require-wp-4.8&&~@require-wp-4.9&&~@less-than-wp-4.6&&~@github-api' ),
Expand All @@ -85,7 +85,7 @@ public function test_behat_tags_php_version() {

putenv( 'GITHUB_TOKEN' );

$behat_tags = dirname( __DIR__ ) . '/utils/behat-tags.php';
$behat_tags = dirname( dirname( __DIR__ ) ) . '/utils/behat-tags.php';

$php_version = substr( PHP_VERSION, 0, 3 );
$contents = '';
Expand Down Expand Up @@ -142,7 +142,7 @@ public function test_behat_tags_extension() {

putenv( 'GITHUB_TOKEN' );

$behat_tags = dirname( __DIR__ ) . '/utils/behat-tags.php';
$behat_tags = dirname( dirname( __DIR__ ) ) . '/utils/behat-tags.php';

file_put_contents( $this->temp_dir . '/features/extension.feature', '@require-extension-imagick @require-extension-curl' );

Expand Down

0 comments on commit 0c5c2e9

Please sign in to comment.