Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic php-cli.js script to replace the PHP terminal command #114

Closed
wants to merge 29 commits into from

Conversation

adamziel
Copy link
Collaborator

🚧 Work in Progress 🚧

This PR explores a generic php-cli.js script that could eventually be ran as npx php and provide a viable replacement for the system-native PHP CLI package.

For now, it's hardwired to run phpunit from wordpress-develop and does a pretty good job:

$ node build-scripts/php-wasm/php-cli.js

Warning:       Your XML configuration validates against a deprecated schema.
Suggestion:    Migrate your XML configuration using "--migrate-configuration"!

............                                                      12 / 12 (100%)

Time: 00:00.301, Memory: 120.00 MB

OK (12 tests, 12 assertions)

@adamziel adamziel mentioned this pull request Jan 14, 2023
@adamziel
Copy link
Collaborator Author

adamziel commented Jan 14, 2023

@adamziel
Copy link
Collaborator Author

As of d431850 the CLI args are passed to PHP:

; node build-scripts/php-wasm/php-cli.js ./vendor/bin/phpunit -c ./phpunit.xml.dist --filter Tests_Formatting_Utf8UriEncode
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
Not running ajax tests. To execute these, use --group ajax.
Not running ms-files tests. To execute these, use --group ms-files.
Not running external-http tests. To execute these, use --group external-http.
<br />
<b>Warning</b>:  shell_exec(): Unable to execute 'stty size' in <b>/wordpress/vendor/sebastian/environment/src/Console.php</b> on line <b>136</b><br />
<br />
<b>Warning</b>:  shell_exec(): Unable to execute 'stty' in <b>/wordpress/vendor/sebastian/environment/src/Console.php</b> on line <b>142</b><br />
PHPUnit 9.5.20 #StandWithUkraine

Warning:       Your XML configuration validates against a deprecated schema.
Suggestion:    Migrate your XML configuration using &amp;quot;--migrate-configuration&amp;quot;!

............                                                      12 / 12 (100%)

Time: 00:00.314, Memory: 120.00 MB

OK (12 tests, 12 assertions)

@adamziel
Copy link
Collaborator Author

Relevant WordPress test config setting – otherwise the phpunit command won't work:

define( 'WP_PHP_BINARY', 'PHP=8.0 <path to php-cli.js>' );

This was referenced Jan 24, 2023
@adamziel
Copy link
Collaborator Author

#119 does everything this PR does and more. I'll close this one.

@adamziel adamziel closed this Jan 27, 2023
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.

1 participant