@@ -908,15 +908,12 @@ private static function find_wp_root( $dir ): ?string {
908908 }
909909
910910 /**
911- * We cache the results of `wp core download` to improve test performance.
912- * Ideally, we'd cache at the HTTP layer for more reliable tests.
911+ * We cache the SQLite plugins so that they only need to be downloaded once per machine.
913912 *
914- * @param string $version
913+ * Every code path that installs WordPress has to call this before using the cache directories,
914+ * as any of them can be the first step of a scenario.
915915 */
916- private static function cache_wp_files ( $ version = '' ): void {
917- $ core_zip = $ version ? null : self ::get_core_zip ();
918- $ wp_version = $ version ?: getenv ( 'WP_VERSION ' );
919- $ cache_dir = self ::get_core_cache_dir ( $ version );
916+ private static function cache_sqlite_plugins (): void {
920917 self ::$ sqlite_cache_dir = sys_get_temp_dir () . '/wp-cli-test-sqlite-integration-cache ' ;
921918
922919 if ( 'sqlite ' === getenv ( 'WP_CLI_TEST_DBTYPE ' ) ) {
@@ -931,6 +928,20 @@ private static function cache_wp_files( $version = '' ): void {
931928 self ::download_sqlite_object_cache_plugin ( self ::$ sqlite_object_cache_dir );
932929 }
933930 }
931+ }
932+
933+ /**
934+ * We cache the results of `wp core download` to improve test performance.
935+ * Ideally, we'd cache at the HTTP layer for more reliable tests.
936+ *
937+ * @param string $version
938+ */
939+ private static function cache_wp_files ( $ version = '' ): void {
940+ $ core_zip = $ version ? null : self ::get_core_zip ();
941+ $ wp_version = $ version ?: getenv ( 'WP_VERSION ' );
942+ $ cache_dir = self ::get_core_cache_dir ( $ version );
943+
944+ self ::cache_sqlite_plugins ();
934945
935946 if ( is_readable ( $ cache_dir . '/wp-includes/version.php ' ) ) {
936947 self ::$ cache_dir = $ cache_dir ;
@@ -2035,6 +2046,10 @@ public function install_wp_with_composer( $vendor_directory = 'vendor' ): void {
20352046 $ this ->create_run_dir ();
20362047 $ this ->create_db ();
20372048
2049+ // Unlike download_wp(), this path never goes through cache_wp_files(),
2050+ // so the SQLite plugins have to be cached here.
2051+ self ::cache_sqlite_plugins ();
2052+
20382053 $ yml_path = $ this ->variables ['RUN_DIR ' ] . '/wp-cli.yml ' ;
20392054 file_put_contents ( $ yml_path , 'path: WordPress ' );
20402055
@@ -2044,7 +2059,10 @@ public function install_wp_with_composer( $vendor_directory = 'vendor' ): void {
20442059
20452060 // Allow for all Composer plugins to run to avoid warnings.
20462061 $ this ->composer_command ( 'config --no-plugins allow-plugins true ' );
2047- $ this ->composer_command ( 'require johnpbloch/wordpress-core-installer johnpbloch/wordpress-core --optimize-autoloader ' );
2062+ // The roots packages link directly to the official WordPress.org release zips,
2063+ // so they are published immediately and cannot suffer from repackaging issues.
2064+ // The "-full" variant ships the default themes and plugins, roots/wordpress does not.
2065+ $ this ->composer_command ( 'require roots/wordpress-core-installer roots/wordpress-full --optimize-autoloader ' );
20482066
20492067 // Disable WP Cron by default to avoid bogus HTTP requests in CLI context.
20502068 $ config_extra_php = "if ( defined( 'DISABLE_WP_CRON' ) === false ) { define( 'DISABLE_WP_CRON', true ); } \n" ;
0 commit comments