From 425d63de4ee9efcf5ab8c3b6f66c7b86935af930 Mon Sep 17 00:00:00 2001 From: Aki Hamano Date: Fri, 7 Nov 2025 10:38:53 +0900 Subject: [PATCH] Fix failing unit tests --- tests/phpunit/tests/post.php | 42 +++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/tests/phpunit/tests/post.php b/tests/phpunit/tests/post.php index 385abe66d4766..e5779946da066 100644 --- a/tests/phpunit/tests/post.php +++ b/tests/phpunit/tests/post.php @@ -826,7 +826,7 @@ public function test_use_block_editor_for_post() { */ public function test_wp_insert_post_handle_malformed_post_date( $input, $expected ) { $post = array( - 'post_author' => self::$editor_id, + 'post_author' => self::$user_ids['editor'], 'post_status' => 'publish', 'post_content' => 'content', 'post_title' => 'title', @@ -893,37 +893,38 @@ public function data_wp_insert_post_handle_malformed_post_date() { '2012-01-01 00:60:00', true, ), - // Failures. + // Dates without leading zeros (valid but malformed format). array( - '2012-08-0z', - false, + '2012-08-1', + true, ), array( - '2012-08-1', - false, + '2012-1-08 00:00:00', + true, ), array( - '201-01-08 00:00:00', - false, + '2012-01-8 00:00:00', + true, ), + // Failures. array( - '201-01-08 00:60:00', + '2012-08-0z', false, ), array( - '201a-01-08 00:00:00', + '201-01-08 00:00:00', false, ), array( - '2012-1-08 00:00:00', + '201-01-08 00:60:00', false, ), array( - '2012-31-08 00:00:00', + '201a-01-08 00:00:00', false, ), array( - '2012-01-8 00:00:00', + '2012-31-08 00:00:00', false, ), array( @@ -1016,24 +1017,25 @@ public function data_wp_resolve_post_date_regex() { '2012-01-01 00:00:60', '2012-01-01 00:00:60', ), + // Dates without leading zeros (valid but malformed format). array( - '201-01-08', - false, + '2012-1-08', + '2012-1-08', ), array( - '201a-01-08', - false, + '2012-01-8', + '2012-01-8', ), array( - '2012-1-08', + '201-01-08', false, ), array( - '2012-31-08', + '201a-01-08', false, ), array( - '2012-01-8', + '2012-31-08', false, ), array(