Skip to content

Commit b452014

Browse files
authored
Merge pull request #187 from wp-cli/fix/debug-sqlite
2 parents b4e030a + 32e9f5e commit b452014

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

features/testing.feature

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@ Feature: Test that WP-CLI loads.
2626

2727
@require-sqlite
2828
Scenario: Uses SQLite
29-
Given a WP install
30-
When I run `wp eval 'echo DB_ENGINE;'`
31-
Then STDOUT should contain:
32-
"""
33-
sqlite
34-
"""
29+
Given a WP install
30+
When I run `wp eval 'echo DB_ENGINE;'`
31+
Then STDOUT should contain:
32+
"""
33+
sqlite
34+
"""
3535

3636
@require-mysql
3737
Scenario: Uses MySQL
38-
Given a WP install
39-
When I run `wp eval 'var_export( defined("DB_ENGINE") );'`
40-
Then STDOUT should be:
41-
"""
42-
false
43-
"""
38+
Given a WP install
39+
When I run `wp eval 'var_export( defined("DB_ENGINE") );'`
40+
Then STDOUT should be:
41+
"""
42+
false
43+
"""

src/Context/FeatureContext.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,6 @@ public function download_wp( $subdir = '' ) {
951951
if ( 'sqlite' === self::$db_type ) {
952952
self::copy_dir( self::$sqlite_cache_dir, $dest_dir . '/wp-content/plugins' );
953953
self::configure_sqlite( $dest_dir );
954-
955954
}
956955
}
957956

@@ -963,6 +962,11 @@ public function create_config( $subdir = '', $extra_php = false ) {
963962

964963
$params['skip-salts'] = true;
965964

965+
// Do not check database connection if running SQLite as the check would fail.
966+
if ( 'sqlite' === self::$db_type ) {
967+
$params['skip-check'] = true;
968+
}
969+
966970
if ( false !== $extra_php ) {
967971
$params['extra-php'] = $extra_php;
968972
}
@@ -1012,10 +1016,11 @@ public function install_wp( $subdir = '' ) {
10121016
'skip-email' => true,
10131017
];
10141018

1019+
$run_dir = '' !== $subdir ? ( $this->variables['RUN_DIR'] . "/$subdir" ) : $this->variables['RUN_DIR'];
10151020
$install_cache_path = '';
1021+
10161022
if ( self::$install_cache_dir ) {
10171023
$install_cache_path = self::$install_cache_dir . '/install_' . md5( implode( ':', $install_args ) . ':subdir=' . $subdir );
1018-
$run_dir = '' !== $subdir ? ( $this->variables['RUN_DIR'] . "/$subdir" ) : $this->variables['RUN_DIR'];
10191024
}
10201025

10211026
if ( $install_cache_path && file_exists( $install_cache_path ) ) {
@@ -1029,8 +1034,10 @@ public function install_wp( $subdir = '' ) {
10291034
}
10301035
} else {
10311036
$this->proc( 'wp core install', $install_args, $subdir )->run_check();
1037+
10321038
if ( $install_cache_path ) {
10331039
mkdir( $install_cache_path );
1040+
10341041
self::dir_diff_copy( $run_dir, self::$cache_dir, $install_cache_path );
10351042

10361043
if ( 'mysql' === self::$db_type ) {

0 commit comments

Comments
 (0)