Skip to content

Commit 6978176

Browse files
committed
Require native parser during WordPress PHPUnit job
1 parent 4f5c4a2 commit 6978176

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

.github/workflows/wp-tests-phpunit-run.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ const { execSync } = require( 'child_process' );
1010
const fs = require( 'fs' );
1111
const path = require( 'path' );
1212

13+
const requiresNativeParserExtension = process.env.WP_SQLITE_REQUIRE_NATIVE_PARSER_EXTENSION === '1';
14+
1315
const expectedErrors = [
1416
'Tests_DB_Charset::test_invalid_characters_in_query',
1517
'Tests_DB_Charset::test_set_charset_changes_the_connection_collation',
@@ -90,10 +92,31 @@ const expectedFailures = [
9092
];
9193

9294
console.log( 'Running WordPress PHPUnit tests with expected failures tracking...' );
95+
if ( requiresNativeParserExtension ) {
96+
console.log( 'Native parser extension is required for this PHPUnit run.' );
97+
}
9398
console.log( 'Expected errors:', expectedErrors );
9499
console.log( 'Expected failures:', expectedFailures );
95100

101+
function verifyNativeParserExtension() {
102+
const verifier = path.join( __dirname, '..', '..', 'wordpress', 'native-verify-extension.php' );
103+
if ( ! fs.existsSync( verifier ) ) {
104+
console.error( `Error: Native parser verifier not found at ${ verifier }.` );
105+
process.exit( 1 );
106+
}
107+
108+
execSync( 'composer run wp-test-ensure-env', { stdio: 'inherit' } );
109+
execSync(
110+
'cd wordpress && node tools/local-env/scripts/docker.js run --rm php php /var/www/native-verify-extension.php',
111+
{ stdio: 'inherit' }
112+
);
113+
}
114+
96115
try {
116+
if ( requiresNativeParserExtension ) {
117+
verifyNativeParserExtension();
118+
}
119+
97120
try {
98121
execSync(
99122
`composer run wp-test-php -- --log-junit=phpunit-results.xml --verbose`,

.github/workflows/wp-tests-phpunit.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ jobs:
5555
run: bash .github/workflows/wp-tests-phpunit-native-extension-setup.sh
5656

5757
- name: Run WordPress PHPUnit tests with parser extension
58+
env:
59+
WP_SQLITE_REQUIRE_NATIVE_PARSER_EXTENSION: '1'
5860
run: node .github/workflows/wp-tests-phpunit-run.js
5961

6062
- name: Stop Docker containers

0 commit comments

Comments
 (0)