@@ -351,3 +351,67 @@ Feature: Install WordPress core
351351 """
352352 Success: Switched to 'Rockfield' theme.
353353 """
354+
355+ Scenario: Core install should provide helpful error when upgrade.php is missing
356+ Given an empty directory
357+ And WP files
358+ And wp-config.php
359+ And a database
360+
361+ When I run `rm wp-admin/includes/upgrade.php`
362+ Then the return code should be 0
363+
364+ When I try `wp core install --url=example.org --title=Test --admin_user=testadmin --admin_email=testadmin@example.com --admin_password=testpass`
365+ Then STDERR should contain:
366+ """
367+ Error: WordPress installation is incomplete. The file
368+ """
369+ And STDERR should contain:
370+ """
371+ wp-admin/includes/upgrade.php' is missing.
372+ """
373+ And the return code should be 1
374+
375+ Scenario: Core install should provide helpful error when upgrade.php is not readable
376+ Given an empty directory
377+ And WP files
378+ And wp-config.php
379+ And a database
380+
381+ When I run `chmod 000 wp-admin/includes/upgrade.php`
382+ Then the return code should be 0
383+
384+ When I try `wp core install --url=example.org --title=Test --admin_user=testadmin --admin_email=testadmin@example.com --admin_password=testpass`
385+ Then STDERR should contain:
386+ """
387+ Error: Cannot read WordPress installation file
388+ """
389+ And STDERR should contain:
390+ """
391+ wp-admin/includes/upgrade.php'. Check file permissions.
392+ """
393+ And the return code should be 1
394+
395+ When I run `chmod 644 wp-admin/includes/upgrade.php`
396+ Then the return code should be 0
397+
398+ Scenario: Core install should provide helpful error when WordPress file has fatal error
399+ Given an empty directory
400+ And WP files
401+ And wp-config.php
402+ And a database
403+
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`
406+ Then the return code should be 0
407+
408+ When I try `wp core install --url=example.org --title=Test --admin_user=testadmin --admin_email=testadmin@example.com --admin_password=testpass`
409+ Then STDERR should contain:
410+ """
411+ Error: Failed to load WordPress files for WordPress installation
412+ """
413+ And STDERR should contain:
414+ """
415+ This often indicates a missing PHP extension or a corrupted WordPress installation
416+ """
417+ And the return code should be 1
0 commit comments