@@ -111,23 +111,29 @@ add_volume_to_service cli "$EXTENSION_RUNTIME_VOLUME"
111111add_volume_to_service php " $EXTENSION_INI_VOLUME "
112112add_volume_to_service cli " $EXTENSION_INI_VOLUME "
113113
114- node tools/local-env/scripts/docker.js run --rm php php -m | grep -qx ' wp_mysql_parser'
115- node tools/local-env/scripts/docker.js run --rm php php -r '
116- require "/var/www/src/wp-content/plugins/sqlite-database-integration/wp-includes/database/load.php";
117- $lexer = new WP_MySQL_Lexer( "SELECT 1" );
118- if ( ! method_exists( $lexer, "native_token_stream" ) ) {
114+ cat > " $WP_DIR /native-verify-extension.php" << 'EOF '
115+ <?php
116+ require '/var/www/src/wp-content/plugins/sqlite-database-integration/wp-includes/database/load.php';
117+
118+ $lexer = new WP_MySQL_Lexer( 'SELECT 1' );
119+ if ( ! method_exists( $lexer, 'native_token_stream' ) ) {
119120 fwrite( STDERR, "Native token stream is not available in the WordPress PHP test container.\n" );
120121 exit( 1 );
121122}
122- $driver = new WP_PDO_MySQL_On_SQLite( "mysql-on-sqlite:path=:memory:;dbname=wp;" );
123- $parser = $driver->create_parser( "SELECT 1" );
123+
124+ $driver = new WP_PDO_MySQL_On_SQLite( 'mysql-on-sqlite:path=:memory:;dbname=wp;' );
125+ $parser = $driver->create_parser( 'SELECT 1' );
124126$parser->next_query();
125127$ast = $parser->get_query_ast();
126- $property = ( new ReflectionClass( $ast ) )->getProperty( " native_ast" );
128+ $property = ( new ReflectionClass( $ast ) )->getProperty( ' native_ast' );
127129$property->setAccessible( true );
128130$native_ast = $property->getValue( $ast );
129- if ( ! is_object( $native_ast ) || "WP_MySQL_Native_Ast" !== get_class( $native_ast ) ) {
131+
132+ if ( ! is_object( $native_ast ) || 'WP_MySQL_Native_Ast' !== get_class( $native_ast ) ) {
130133 fwrite( STDERR, "WordPress PHP test container did not select the native-backed AST.\n" );
131134 exit( 1 );
132135}
133- '
136+ EOF
137+
138+ node tools/local-env/scripts/docker.js run --rm php php -m | grep -qx ' wp_mysql_parser'
139+ node tools/local-env/scripts/docker.js run --rm php php /var/www/native-verify-extension.php
0 commit comments