@@ -10,6 +10,8 @@ const { execSync } = require( 'child_process' );
1010const fs = require ( 'fs' ) ;
1111const path = require ( 'path' ) ;
1212
13+ const requiresNativeParserExtension = process . env . WP_SQLITE_REQUIRE_NATIVE_PARSER_EXTENSION === '1' ;
14+
1315const 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
9294console . 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+ }
9398console . log ( 'Expected errors:' , expectedErrors ) ;
9499console . 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+
96115try {
116+ if ( requiresNativeParserExtension ) {
117+ verifyNativeParserExtension ( ) ;
118+ }
119+
97120 try {
98121 execSync (
99122 `composer run wp-test-php -- --log-junit=phpunit-results.xml --verbose` ,
0 commit comments