From bb61355085e2d7c1f1fd4794556209124b7f4fe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Fri, 14 Aug 2026 15:01:12 +0200 Subject: [PATCH 1/4] [PHP] Run Blueprint tests with SQLite integration 3.0 --- .../Blueprints/Tests/Unit/Steps/DefineConstantsStepTest.php | 6 ++++++ components/Blueprints/Tests/Unit/Steps/RunSQLStepTest.php | 2 +- components/Blueprints/Tests/Unit/Steps/StepTestCase.php | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/components/Blueprints/Tests/Unit/Steps/DefineConstantsStepTest.php b/components/Blueprints/Tests/Unit/Steps/DefineConstantsStepTest.php index b61d36ce7..54b325ce9 100644 --- a/components/Blueprints/Tests/Unit/Steps/DefineConstantsStepTest.php +++ b/components/Blueprints/Tests/Unit/Steps/DefineConstantsStepTest.php @@ -60,6 +60,7 @@ public function testAddNewConstantsToWpConfigWithEditingComment() { execution_context->put_contents( 'test.sql', $sql ); $step = new RunSqlStep( DataReference::create( './test.sql', [ diff --git a/components/Blueprints/Tests/Unit/Steps/StepTestCase.php b/components/Blueprints/Tests/Unit/Steps/StepTestCase.php index 9875880b2..f77e86dcf 100644 --- a/components/Blueprints/Tests/Unit/Steps/StepTestCase.php +++ b/components/Blueprints/Tests/Unit/Steps/StepTestCase.php @@ -79,7 +79,7 @@ public function setUp(): void { ->set_blueprint( new AbsoluteLocalPath( wp_join_unix_paths( $this->execution_context_path, 'blueprint.json' ) ) ) ->set_database_engine( 'sqlite' ) ->set_sqlite_integration_plugin( - DataReference::create( 'https://downloads.wordpress.org/plugin/sqlite-database-integration.2.2.23.zip' ) + DataReference::create( 'https://downloads.wordpress.org/plugin/sqlite-database-integration.3.0.0.zip' ) ) ->set_target_site_url( 'http://127.0.0.1:2456' ); From e566a3bdba0b29848a85af99ef9b9af648c01b2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Fri, 14 Aug 2026 16:22:20 +0200 Subject: [PATCH 2/4] [PHP] Follow the current SQLite release in Blueprint tests --- components/Blueprints/Tests/Unit/Steps/StepTestCase.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/components/Blueprints/Tests/Unit/Steps/StepTestCase.php b/components/Blueprints/Tests/Unit/Steps/StepTestCase.php index f77e86dcf..d4a78da39 100644 --- a/components/Blueprints/Tests/Unit/Steps/StepTestCase.php +++ b/components/Blueprints/Tests/Unit/Steps/StepTestCase.php @@ -4,7 +4,6 @@ use PHPUnit\Framework\TestCase; use WordPress\Blueprints\DataReference\AbsoluteLocalPath; -use WordPress\Blueprints\DataReference\DataReference; use WordPress\Blueprints\Runner; use WordPress\Blueprints\RunnerConfiguration; use WordPress\Blueprints\Runtime; @@ -78,9 +77,6 @@ public function setUp(): void { $config ->set_blueprint( new AbsoluteLocalPath( wp_join_unix_paths( $this->execution_context_path, 'blueprint.json' ) ) ) ->set_database_engine( 'sqlite' ) - ->set_sqlite_integration_plugin( - DataReference::create( 'https://downloads.wordpress.org/plugin/sqlite-database-integration.3.0.0.zip' ) - ) ->set_target_site_url( 'http://127.0.0.1:2456' ); $runner = new Runner( $config ); From c3bfb18b3bf2ec5793c942c2804672879a2eb66f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Fri, 14 Aug 2026 16:42:34 +0200 Subject: [PATCH 3/4] [PHP] Apply Blueprint constants before SQLite installation --- .../SiteResolver/class-newsiteresolver.php | 12 ++++++++---- .../Blueprints/Tests/Unit/Steps/StepTestCase.php | 8 +++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/components/Blueprints/SiteResolver/class-newsiteresolver.php b/components/Blueprints/SiteResolver/class-newsiteresolver.php index 4ace812aa..7b2ce2b05 100644 --- a/components/Blueprints/SiteResolver/class-newsiteresolver.php +++ b/components/Blueprints/SiteResolver/class-newsiteresolver.php @@ -7,6 +7,7 @@ use WordPress\Blueprints\Exception\BlueprintExecutionException; use WordPress\Blueprints\Progress\Tracker; use WordPress\Blueprints\Runtime; +use WordPress\Blueprints\Steps\DefineConstantsStep; use WordPress\Blueprints\VersionStrings\VersionConstraint; use WordPress\HttpClient\Client; use WordPress\HttpClient\Request; @@ -71,10 +72,6 @@ public static function resolve( Runtime $runtime, Tracker $progress, ?VersionCon // If SQLite integration zip provided, unzip into appropriate folder. if ( 'sqlite' === $runtime->get_configuration()->get_database_engine() ) { - /* - * @TODO: Ensure DB_NAME gets defined in wp-config.php before installing the SQLite plugin. - */ - $progress['resolve_assets']->setCaption( 'Downloading SQLite integration plugin' ); $resolved = $runtime->resolve( $assets['sqlite-integration'] ); if ( ! $resolved instanceof File ) { @@ -116,6 +113,13 @@ public static function resolve( Runtime $runtime, Tracker $progress, ?VersionCon } } + // Database configuration constants must be available when core installation opens its connection. + $blueprint = $runtime->get_blueprint(); + if ( ! empty( $blueprint['constants'] ) && is_array( $blueprint['constants'] ) ) { + $define_constants_step = new DefineConstantsStep( $blueprint['constants'] ); + $define_constants_step->run( $runtime, $progress['install_wordpress'] ); + } + // Perform installation using WP-CLI. // @TODO (low priority): Remove the WP-CLI dependency to lower the download size for blueprints.phar. $progress['install_wordpress']->set( 0.7, 'Installing WordPress' ); diff --git a/components/Blueprints/Tests/Unit/Steps/StepTestCase.php b/components/Blueprints/Tests/Unit/Steps/StepTestCase.php index d4a78da39..a9d7ed97b 100644 --- a/components/Blueprints/Tests/Unit/Steps/StepTestCase.php +++ b/components/Blueprints/Tests/Unit/Steps/StepTestCase.php @@ -64,7 +64,13 @@ public function setUp(): void { ; } - $blueprint = array( 'version' => 2 ); + $blueprint = array( + 'version' => 2, + 'constants' => array( + 'SQLITE_JOURNAL_MODE' => 'DELETE', + 'WP_SQLITE_UNSAFE_ENABLE_UNSUPPORTED_VERSIONS' => true, + ), + ); if ( PHP_VERSION_ID < 70400 ) { $blueprint['wordpressVersion'] = '6.6.2'; } From ef038500af9d8470ef27ee5f57030c0b7f458282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Fri, 14 Aug 2026 16:56:49 +0200 Subject: [PATCH 4/4] [PHP] Keep SQLite settings in replacement wp-config fixtures --- .../Tests/Unit/Steps/DefineConstantsStepTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/components/Blueprints/Tests/Unit/Steps/DefineConstantsStepTest.php b/components/Blueprints/Tests/Unit/Steps/DefineConstantsStepTest.php index 54b325ce9..b22cc4686 100644 --- a/components/Blueprints/Tests/Unit/Steps/DefineConstantsStepTest.php +++ b/components/Blueprints/Tests/Unit/Steps/DefineConstantsStepTest.php @@ -61,6 +61,8 @@ public function testAddNewConstantsToWpConfigWithEditingComment() { $table_prefix = 'wp_'; define( 'DB_NAME', 'database_name_here' ); +define( 'SQLITE_JOURNAL_MODE', 'DELETE' ); +define( 'WP_SQLITE_UNSAFE_ENABLE_UNSUPPORTED_VERSIONS', true ); define( 'WP_DEBUG', true ); /* That's all, stop editing! */ @@ -83,6 +85,8 @@ public function testAddNewConstantsToWpConfigWithEditingComment() { $table_prefix = 'wp_'; define( 'DB_NAME', 'database_name_here' ); +define( 'SQLITE_JOURNAL_MODE', 'DELETE' ); +define( 'WP_SQLITE_UNSAFE_ENABLE_UNSUPPORTED_VERSIONS', true ); define( 'WP_DEBUG', true ); @@ -107,6 +111,8 @@ public function testAddNewConstantsToWpConfigWithSetupWpSettingsComment() { $table_prefix = 'wp_'; define( 'DB_NAME', 'database_name_here' ); +define( 'SQLITE_JOURNAL_MODE', 'DELETE' ); +define( 'WP_SQLITE_UNSAFE_ENABLE_UNSUPPORTED_VERSIONS', true ); define( 'WP_DEBUG', true ); /** Sets up WordPress vars and included files. */ @@ -127,6 +133,8 @@ public function testAddNewConstantsToWpConfigWithSetupWpSettingsComment() { $table_prefix = 'wp_'; define( 'DB_NAME', 'database_name_here' ); +define( 'SQLITE_JOURNAL_MODE', 'DELETE' ); +define( 'WP_SQLITE_UNSAFE_ENABLE_UNSUPPORTED_VERSIONS', true ); define( 'WP_DEBUG', true ); @@ -148,6 +156,8 @@ public function testAddNewConstantsToWpConfigWithRequireWpSettings() {