Skip to content

Commit ccf9ae7

Browse files
fix: use gmdate for future post dates in permalink tests
1 parent f63783f commit ccf9ae7

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

tests/phpunit/tests/link.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public function test_wp_force_plain_post_permalink_statuses_filter_future_posts_
195195
$post_id = self::factory()->post->create(
196196
array(
197197
'post_status' => 'future',
198-
'post_date' => date( 'Y-m-d H:i:s', strtotime( '+1 day' ) ),
198+
'post_date' => gmdate( 'Y-m-d H:i:s', strtotime( '+1 day' ) ),
199199
'post_name' => 'future-post',
200200
)
201201
);
@@ -213,15 +213,15 @@ public function test_wp_force_plain_post_permalink_statuses_filter_allows_custom
213213
// Add filter to allow future posts to use pretty permalinks.
214214
add_filter(
215215
'wp_force_plain_post_permalink_statuses',
216-
function( $statuses ) {
216+
function ( $statuses ) {
217217
return array_diff( $statuses, array( 'future' ) );
218218
}
219219
);
220220

221221
$post_id = self::factory()->post->create(
222222
array(
223223
'post_status' => 'future',
224-
'post_date' => date( 'Y-m-d H:i:s', strtotime( '+1 day' ) ),
224+
'post_date' => gmdate( 'Y-m-d H:i:s', strtotime( '+1 day' ) ),
225225
'post_name' => 'future-post',
226226
)
227227
);
@@ -242,15 +242,15 @@ public function test_wp_force_plain_post_permalink_statuses_filter_selective_by_
242242
// Add filter to allow only future posts to use pretty permalinks.
243243
add_filter(
244244
'wp_force_plain_post_permalink_statuses',
245-
function( $statuses ) {
245+
function ( $statuses ) {
246246
return array_diff( $statuses, array( 'future' ) );
247247
}
248248
);
249249

250250
$future_post_id = self::factory()->post->create(
251251
array(
252252
'post_status' => 'future',
253-
'post_date' => date( 'Y-m-d H:i:s', strtotime( '+1 day' ) ),
253+
'post_date' => gmdate( 'Y-m-d H:i:s', strtotime( '+1 day' ) ),
254254
'post_name' => 'future-post',
255255
)
256256
);
@@ -282,7 +282,7 @@ public function test_wp_force_plain_post_permalink_statuses_filter_selective_by_
282282
// Add filter to allow future posts pretty permalinks only for 'post' type.
283283
add_filter(
284284
'wp_force_plain_post_permalink_statuses',
285-
function( $statuses, $post ) {
285+
function ( $statuses, $post ) {
286286
if ( 'future' === $post->post_status && 'post' === $post->post_type ) {
287287
return array_diff( $statuses, array( 'future' ) );
288288
}
@@ -296,7 +296,7 @@ function( $statuses, $post ) {
296296
$post_id = self::factory()->post->create(
297297
array(
298298
'post_status' => 'future',
299-
'post_date' => date( 'Y-m-d H:i:s', strtotime( '+1 day' ) ),
299+
'post_date' => gmdate( 'Y-m-d H:i:s', strtotime( '+1 day' ) ),
300300
'post_name' => 'future-post',
301301
)
302302
);
@@ -306,7 +306,7 @@ function( $statuses, $post ) {
306306
array(
307307
'post_type' => 'page',
308308
'post_status' => 'future',
309-
'post_date' => date( 'Y-m-d H:i:s', strtotime( '+1 day' ) ),
309+
'post_date' => gmdate( 'Y-m-d H:i:s', strtotime( '+1 day' ) ),
310310
'post_name' => 'future-page',
311311
)
312312
);
@@ -340,5 +340,4 @@ public function test_wp_force_plain_post_permalink_statuses_filter_published_pos
340340
// Should return false (allow pretty permalink) for published posts.
341341
$this->assertFalse( wp_force_plain_post_permalink( $post ) );
342342
}
343-
344343
}

0 commit comments

Comments
 (0)