Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#34277 closed defect (bug) (fixed)

factory not setup correctly in unit test in test_validate_date_values_should_process_array_value_for_year

Reported by: pbearne Owned by: SergeyBiryukov
Priority: normal Milestone: 4.4
Component: Build/Test Tools Version: 4.4
Severity: normal Keywords:
Cc: Focuses:

Description

In the unit test "test_validate_date_values_should_process_array_value_for_year"two posts are made inorder to do a query on them for the test but the post_date a set wrongly as "get_gmt_from_date()" needs the date passed to be in the format of 'Y-m-d H:i:s' inorder to mnatch the internal regex if the get_option( 'timezone_string' ); returns false

There are 2 ways to fix this pass the full date (as patched) or to set update_option( 'timezone_string', 'Europe/London' ); before calling the factory or change get_gmt_from_date() to work with incomplete dates

Attachments (1)

34277.patch​ (758 bytes ) - added by pbearne 11 years ago.
set dates for factory to full format

Download all attachments as: .zip

Change History (4)

@pbearne
11 years ago

set dates for factory to full format

#1 @SergeyBiryukov
11 years ago

  • Milestone Awaiting Review → 4.4
  • Owner set to SergeyBiryukov
  • Status new → accepted

In my testing, post_date was correct and the test passed, but a var_dump() of posts revealed that post_date_gmt and post_modified_gmt were 1970-01-01 00:00:00.

34277.patch​ looks good.

I've reviewed all the other instances of using the factory, and the date format is correct there.

#2 @SergeyBiryukov
11 years ago

  • Resolution → fixed
  • Status accepted → closed

In 35091:

Correct the post_date format in WP_Date_Query tests.

It should be 'Y-m-d H:i:s' in order to match the regex in get_gmt_from_date() if 'timezone_string' option is not set.

Props pbearne.
Fixes #34277.

Note: See TracTickets for help on using tickets.