Skip to content

Commit 40c7fc5

Browse files
Copilotswissspidy
andcommitted
Remove custom old_files test and improve checksums unavailable test with HTTP mocking
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
1 parent 253a873 commit 40c7fc5

File tree

1 file changed

+18
-72
lines changed

1 file changed

+18
-72
lines changed

features/core-update.feature

Lines changed: 18 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ Feature: Update WordPress core
432432
And the wp-includes/SimplePie/src/Decode directory should not exist
433433

434434
@require-php-7.2
435-
Scenario: Custom old_files list is used for cleanup
435+
Scenario: Old files cleanup works when checksums unavailable
436436
Given a WP install
437437

438438
When I run `wp core download --version=6.8 --force`
@@ -441,89 +441,35 @@ Feature: Update WordPress core
441441
Success: WordPress downloaded.
442442
"""
443443

444-
# Create test files that we'll add to custom old_files list
445-
Given a wp-includes/test-old-file-1.php file:
446-
"""
447-
<?php
448-
// Test old file 1
449-
"""
450-
And a wp-includes/test-old-file-2.php file:
444+
# Create files that exist in the $_old_files list from WordPress 6.9
445+
Given a wp-includes/blocks/post-author/editor.css file:
451446
"""
452-
<?php
453-
// Test old file 2
447+
/* Old CSS file */
454448
"""
455-
And an empty wp-includes/test-old-dir directory
456-
And a wp-includes/test-old-dir/test-file.php file:
449+
And a wp-includes/blocks/post-author/editor.min.css file:
457450
"""
458-
<?php
459-
// Test file in old directory
451+
/* Old minified CSS */
460452
"""
461453

462-
# Modify update-core.php to include our test files in old_files list
463-
And a wp-admin/includes/update-core-custom.php file:
454+
# Mock checksum API to return empty response so checksums are unavailable
455+
Given that HTTP requests to https://api.wordpress.org/core/checksums/1.0/ will respond with:
464456
"""
465-
<?php
466-
global $_old_files;
467-
require_once ABSPATH . 'wp-admin/includes/update-core.php';
468-
$_old_files[] = 'wp-includes/test-old-file-1.php';
469-
$_old_files[] = 'wp-includes/test-old-file-2.php';
470-
$_old_files[] = 'wp-includes/test-old-dir';
471-
"""
472-
473-
# Backup original and replace with custom version
474-
When I run `mv wp-admin/includes/update-core.php wp-admin/includes/update-core-backup.php`
475-
And I run `mv wp-admin/includes/update-core-custom.php wp-admin/includes/update-core.php`
457+
HTTP/1.1 200
458+
Content-Type: application/json
476459
477-
And I run `wp core update --version=6.9 --force`
478-
Then STDOUT should contain:
479-
"""
480-
Success: WordPress updated successfully.
460+
{}
481461
"""
482462

483-
# Restore original update-core.php
484-
When I run `mv wp-admin/includes/update-core-backup.php wp-admin/includes/update-core.php`
485-
486-
# Verify custom old files were removed
487-
Then the wp-includes/test-old-file-1.php file should not exist
488-
And the wp-includes/test-old-file-2.php file should not exist
489-
And the wp-includes/test-old-dir directory should not exist
490-
491-
@require-php-7.2
492-
Scenario: Old files cleanup works when checksums unavailable
493-
Given a WP install
494-
495-
When I run `wp core download --version=6.8 --force`
463+
When I try `wp core update --version=6.9 --force`
496464
Then STDOUT should contain:
497465
"""
498-
Success: WordPress downloaded.
499-
"""
500-
501-
# Create files that should be removed
502-
Given a wp-includes/test-cleanup-file.php file:
503-
"""
504-
<?php
505-
// Test cleanup file
506-
"""
507-
508-
# Modify update-core.php to include our test file
509-
And a wp-admin/includes/update-core-custom.php file:
510-
"""
511-
<?php
512-
global $_old_files;
513-
require_once ABSPATH . 'wp-admin/includes/update-core.php';
514-
$_old_files[] = 'wp-includes/test-cleanup-file.php';
466+
Cleaning up files...
515467
"""
516-
517-
When I run `mv wp-admin/includes/update-core.php wp-admin/includes/update-core-backup.php`
518-
And I run `mv wp-admin/includes/update-core-custom.php wp-admin/includes/update-core.php`
519-
520-
# Update to a version where checksums might not be available
521-
And I try `wp core update --version=nightly --force`
522-
Then STDOUT should contain:
468+
And STDOUT should contain:
523469
"""
524-
Cleaning up files...
470+
Success: WordPress updated successfully.
525471
"""
526472

527-
When I run `mv wp-admin/includes/update-core-backup.php wp-admin/includes/update-core.php`
528-
529-
Then the wp-includes/test-cleanup-file.php file should not exist
473+
# Verify files from $_old_files were removed
474+
Then the wp-includes/blocks/post-author/editor.css file should not exist
475+
And the wp-includes/blocks/post-author/editor.min.css file should not exist

0 commit comments

Comments
 (0)