Skip to content

Fix php since wp-env changed#37

Merged
johnstonphilip merged 1 commit intomainfrom
fix/phpunit
May 22, 2023
Merged

Fix php since wp-env changed#37
johnstonphilip merged 1 commit intomainfrom
fix/phpunit

Conversation

@johnstonphilip
Copy link
Copy Markdown
Member

@johnstonphilip johnstonphilip commented May 19, 2023

In the wp-env project (inside Gutenberg repo), the PHPUnit and Composer packages were removed.

This resulted in PHPunit tests failing to run using wpp-scripts with the message:
The 'phpunit' container has been removed. Please use 'wp-env run tests-cli --env-cwd=wp-content/path/to/plugin phpunit' instead.

Note:

This PR changes that over. I haven't had a chance to figure out how to get multisite to work yet, so I have removed that for now.

This may require changes to a few things in your tests suite. See companion PR in pattern-manager for more details on changes required there.

@kienstra
Copy link
Copy Markdown
Collaborator

I haven't had a chance to figure out how to get multisite to work yet, so I have removed that for now.

It's probably fine if we don't support multisite, and just add it when we need it.

Copy link
Copy Markdown
Collaborator

@kienstra kienstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @johnstonphilip,
Thanks a lot for fixing this.

Now, npm run test:phpunit is passing in my local.

/phpcs.xml
/.wp-env.json
/.wp-env.json.bak
.phpunit.result.cache
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea

else
npx -p @wordpress/env wp-env run phpunit "phpunit -c /var/www/html/wp-content/wpps-scripts/phpunit.xml.dist /var/www/html/wp-content/plugins/$plugindirname"
fi
npx -p @wordpress/env wp-env run --env-cwd=\"wp-content/wpps-scripts\" tests-wordpress phpunit -c ./phpunit.xml.dist /var/www/html/wp-content/plugins/$plugindirname
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice simplification, we don't run multisite tests anyway

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants