Skip to content

Commit afcc087

Browse files
Copilotswissspidy
andcommitted
Update test to simulate missing mysqli extension scenario
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
1 parent 62c21f6 commit afcc087

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

features/core-install.feature

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,14 +395,26 @@ Feature: Install WordPress core
395395
When I run `chmod 644 wp-admin/includes/upgrade.php`
396396
Then the return code should be 0
397397
398-
Scenario: Core install should provide helpful error when WordPress file has fatal error
398+
Scenario: Core install should provide helpful error when WordPress file has fatal error from missing extension
399399
Given an empty directory
400400
And WP files
401401
And wp-config.php
402402
And a database
403403
404-
# Inject a fatal error into a WordPress core file that will be loaded during install
405-
When I run `echo "<?php trigger_error('Simulated fatal error', E_USER_ERROR);" > wp-admin/includes/upgrade.php`
404+
# Simulate a missing mysqli extension by injecting a fatal error that mimics
405+
# what happens when mysqli_connect is called but the extension is not available
406+
# This reproduces the original bug report scenario
407+
When I run `echo "<?php trigger_error('Call to undefined function mysqli_connect()', E_USER_ERROR);" > wp-includes/mysqli-check.php`
408+
Then the return code should be 0
409+
410+
# Inject this check at the beginning of upgrade.php to trigger the error during install
411+
When I run `echo "<?php require_once ABSPATH . 'wp-includes/mysqli-check.php';" > wp-admin/includes/upgrade-new.php`
412+
Then the return code should be 0
413+
414+
When I run `cat wp-admin/includes/upgrade.php >> wp-admin/includes/upgrade-new.php`
415+
Then the return code should be 0
416+
417+
When I run `mv wp-admin/includes/upgrade-new.php wp-admin/includes/upgrade.php`
406418
Then the return code should be 0
407419

408420
When I try `wp core install --url=example.org --title=Test --admin_user=testadmin --admin_email=testadmin@example.com --admin_password=testpass`
@@ -414,4 +426,8 @@ Feature: Install WordPress core
414426
"""
415427
This often indicates a missing PHP extension or a corrupted WordPress installation
416428
"""
429+
And STDERR should contain:
430+
"""
431+
Call to undefined function mysqli_connect()
432+
"""
417433
And the return code should be 1

0 commit comments

Comments
 (0)