Changeset 51587
- Timestamp:
- 08/09/2021 07:08:09 PM (3 years ago)
- Location:
- trunk/tests/phpunit/tests
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/canonical/postStatus.php
r51568 r51587 35 35 $post_date = ''; 36 36 if ( 'future' === $post_status ) { 37 $post_date = strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 year' ));37 $post_date = date_format( date_create( '+1 year' ), 'Y-m-d H:i:s' ); 38 38 } 39 39 -
trunk/tests/phpunit/tests/comment.php
r51568 r51587 858 858 update_option( 'close_comments_days_old', 1 ); 859 859 860 $old_date = strtotime( '-25 hours' );861 $old_post_id = self::factory()->post->create( array( 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', $old_date) ) );860 $old_date = date_create( '-25 hours' ); 861 $old_post_id = self::factory()->post->create( array( 'post_date' => date_format( $old_date, 'Y-m-d H:i:s' ) ) ); 862 862 863 863 $old_post_comment_status = _close_comments_for_old_post( true, $old_post_id ); -
trunk/tests/phpunit/tests/link.php
r50132 r51587 109 109 array( 110 110 'post_status' => 'publish', 111 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' )),111 'post_date' => date_format( date_create( '+1 day' ), 'Y-m-d H:i:s' ), 112 112 ) 113 113 ); … … 132 132 'post_status' => 'future', 133 133 'post_type' => 'wptests_pt', 134 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' )),134 'post_date' => date_format( date_create( '+1 day' ), 'Y-m-d H:i:s' ), 135 135 ) 136 136 ); -
trunk/tests/phpunit/tests/media.php
r51568 r51587 22 22 $date = ''; 23 23 if ( 'future' === $post_status ) { 24 strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 year' ));24 date_format( date_create( '+1 year' ), 'Y-m-d H:i:s' ); 25 25 } 26 26 -
trunk/tests/phpunit/tests/multisite/ms-files-rewriting.php
r51568 r51587 36 36 37 37 $site = get_current_site(); 38 $date = date_format( date_create( 'now' ), 'Y/m' ); 38 39 39 40 $user_id = self::factory()->user->create( array( 'role' => 'administrator' ) ); 40 41 $blog_id2 = self::factory()->blog->create( array( 'user_id' => $user_id ) ); 41 42 $info = wp_upload_dir(); 42 $this->assertSame( 'http://' . $site->domain . '/wp-content/uploads/' . gmstrftime( '%Y/%m' ), $info['url'] );43 $this->assertSame( ABSPATH . 'wp-content/uploads/' . gmstrftime( '%Y/%m' ), $info['path'] );44 $this->assertSame( gmstrftime( '/%Y/%m' ), $info['subdir'] );43 $this->assertSame( 'http://' . $site->domain . '/wp-content/uploads/' . $date, $info['url'] ); 44 $this->assertSame( ABSPATH . 'wp-content/uploads/' . $date, $info['path'] ); 45 $this->assertSame( '/' . $date, $info['subdir'] ); 45 46 $this->assertFalse( $info['error'] ); 46 47 … … 48 49 $info2 = wp_upload_dir(); 49 50 $this->assertNotEquals( $info, $info2 ); 50 $this->assertSame( get_option( 'siteurl' ) . '/wp-content/blogs.dir/' . get_current_blog_id() . '/files/' . gmstrftime( '%Y/%m' ), $info2['url'] );51 $this->assertSame( ABSPATH . 'wp-content/blogs.dir/' . get_current_blog_id() . '/files/' . gmstrftime( '%Y/%m' ), $info2['path'] );52 $this->assertSame( gmstrftime( '/%Y/%m' ), $info2['subdir'] );51 $this->assertSame( get_option( 'siteurl' ) . '/wp-content/blogs.dir/' . get_current_blog_id() . '/files/' . $date, $info2['url'] ); 52 $this->assertSame( ABSPATH . 'wp-content/blogs.dir/' . get_current_blog_id() . '/files/' . $date, $info2['path'] ); 53 $this->assertSame( '/' . $date, $info2['subdir'] ); 53 54 $this->assertFalse( $info2['error'] ); 54 55 restore_current_blog(); -
trunk/tests/phpunit/tests/multisite/site.php
r51568 r51587 839 839 840 840 $site = get_current_site(); 841 $date = date_format( date_create( 'now' ), 'Y/m' ); 841 842 842 843 $info = wp_upload_dir(); 843 $this->assertSame( 'http://' . $site->domain . '/wp-content/uploads/' . gmstrftime( '%Y/%m' ), $info['url'] );844 $this->assertSame( ABSPATH . 'wp-content/uploads/' . gmstrftime( '%Y/%m' ), $info['path'] );845 $this->assertSame( gmstrftime( '/%Y/%m' ), $info['subdir'] );844 $this->assertSame( 'http://' . $site->domain . '/wp-content/uploads/' . $date, $info['url'] ); 845 $this->assertSame( ABSPATH . 'wp-content/uploads/' . $date, $info['path'] ); 846 $this->assertSame( '/' . $date, $info['subdir'] ); 846 847 $this->assertFalse( $info['error'] ); 847 848 … … 850 851 switch_to_blog( $blog_id ); 851 852 $info = wp_upload_dir(); 852 $this->assertSame( 'http://' . $site->domain . '/wp-content/uploads/sites/' . get_current_blog_id() . '/' . gmstrftime( '%Y/%m' ), $info['url'] );853 $this->assertSame( ABSPATH . 'wp-content/uploads/sites/' . get_current_blog_id() . '/' . gmstrftime( '%Y/%m' ), $info['path'] );854 $this->assertSame( gmstrftime( '/%Y/%m' ), $info['subdir'] );853 $this->assertSame( 'http://' . $site->domain . '/wp-content/uploads/sites/' . get_current_blog_id() . '/' . $date, $info['url'] ); 854 $this->assertSame( ABSPATH . 'wp-content/uploads/sites/' . get_current_blog_id() . '/' . $date, $info['path'] ); 855 $this->assertSame( '/' . $date, $info['subdir'] ); 855 856 $this->assertFalse( $info['error'] ); 856 857 restore_current_blog(); 857 858 858 859 $info = wp_upload_dir(); 859 $this->assertSame( 'http://' . $site->domain . '/wp-content/uploads/' . gmstrftime( '%Y/%m' ), $info['url'] );860 $this->assertSame( ABSPATH . 'wp-content/uploads/' . gmstrftime( '%Y/%m' ), $info['path'] );861 $this->assertSame( gmstrftime( '/%Y/%m' ), $info['subdir'] );860 $this->assertSame( 'http://' . $site->domain . '/wp-content/uploads/' . $date, $info['url'] ); 861 $this->assertSame( ABSPATH . 'wp-content/uploads/' . $date, $info['path'] ); 862 $this->assertSame( '/' . $date, $info['subdir'] ); 862 863 $this->assertFalse( $info['error'] ); 863 864 } -
trunk/tests/phpunit/tests/oembed/getResponseData.php
r51568 r51587 120 120 array( 121 121 'post_status' => 'future', 122 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' )),122 'post_date' => date_format( date_create( '+1 day' ), 'Y-m-d H:i:s' ), 123 123 ) 124 124 ); -
trunk/tests/phpunit/tests/oembed/template.php
r51462 r51587 144 144 'post_excerpt' => 'Bar Baz', 145 145 'post_status' => 'future', 146 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' )),146 'post_date' => date_format( date_create( '+1 day' ), 'Y-m-d H:i:s' ), 147 147 ) 148 148 ); -
trunk/tests/phpunit/tests/post.php
r51568 r51587 129 129 'post_content' => rand_str(), 130 130 'post_title' => rand_str(), 131 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', $future_date),131 'post_date' => date_format( date_create( "@{$future_date}" ), 'Y-m-d H:i:s' ), 132 132 ); 133 133 … … 165 165 'post_content' => rand_str(), 166 166 'post_title' => rand_str(), 167 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', $future_date_1),167 'post_date' => date_format( date_create( "@{$future_date_1}" ), 'Y-m-d H:i:s' ), 168 168 ); 169 169 … … 183 183 184 184 $post['ID'] = $id; 185 $post['post_date'] = strftime( '%Y-%m-%d %H:%M:%S', $future_date_2);185 $post['post_date'] = date_format( date_create( "@{$future_date_2}" ), 'Y-m-d H:i:s' ); 186 186 $post['post_date_gmt'] = null; 187 187 wp_update_post( $post ); … … 210 210 'post_content' => rand_str(), 211 211 'post_title' => rand_str(), 212 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', $future_date_1),212 'post_date' => date_format( date_create( "@{$future_date_1}" ), 'Y-m-d H:i:s' ), 213 213 ); 214 214 … … 228 228 229 229 $post['ID'] = $id; 230 $post['post_date'] = strftime( '%Y-%m-%d %H:%M:%S', $future_date_2);230 $post['post_date'] = date_format( date_create( "@{$future_date_2}" ), 'Y-m-d H:i:s' ); 231 231 $post['post_date_gmt'] = null; 232 232 wp_update_post( $post ); … … 252 252 'post_content' => rand_str(), 253 253 'post_title' => rand_str(), 254 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', $future_date),254 'post_date' => date_format( date_create( "@{$future_date}" ), 'Y-m-d H:i:s' ), 255 255 ); 256 256 … … 287 287 'post_content' => rand_str(), 288 288 'post_title' => rand_str(), 289 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', $future_date_1),289 'post_date' => date_format( date_create( "@{$future_date_1}" ), 'Y-m-d H:i:s' ), 290 290 ); 291 291 … … 331 331 'post_content' => rand_str(), 332 332 'post_title' => rand_str(), 333 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', $future_date_1),333 'post_date' => date_format( date_create( "@{$future_date_1}" ), 'Y-m-d H:i:s' ), 334 334 ); 335 335 … … 373 373 'post_content' => rand_str(), 374 374 'post_title' => rand_str(), 375 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', $future_date),375 'post_date' => date_format( date_create( "@{$future_date}" ), 'Y-m-d H:i:s' ), 376 376 ); 377 377 … … 430 430 'post_content' => rand_str(), 431 431 'post_title' => rand_str(), 432 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', $future_date_1),432 'post_date' => date_format( date_create( "@{$future_date_1}" ), 'Y-m-d H:i:s' ), 433 433 ); 434 434 … … 536 536 'post_content' => rand_str(), 537 537 'post_title' => rand_str(), 538 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', $future_date),538 'post_date' => date_format( date_create( "@{$future_date}" ), 'Y-m-d H:i:s' ), 539 539 ); 540 540 -
trunk/tests/phpunit/tests/post/getPostStatus.php
r49985 r51587 22 22 $actual_status = $post_status; 23 23 if ( 'future' === $post_status ) { 24 $date = strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 year' ));24 $date = date_format( date_create( '+1 year' ), 'Y-m-d H:i:s' ); 25 25 } elseif ( in_array( $post_status, array( 'trash', 'delete' ), true ) ) { 26 26 $actual_status = 'publish'; -
trunk/tests/phpunit/tests/post/isPostPubliclyViewable.php
r50130 r51587 19 19 $actual_status = $post_status; 20 20 if ( 'future' === $post_status ) { 21 $date = strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 year' ));21 $date = date_format( date_create( '+1 year' ), 'Y-m-d H:i:s' ); 22 22 } elseif ( in_array( $post_status, array( 'trash', 'delete' ), true ) ) { 23 23 $actual_status = 'publish'; … … 52 52 $date = ''; 53 53 if ( 'future' === $post_status ) { 54 $date = strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 year' ));54 $date = date_format( date_create( '+1 year' ), 'Y-m-d H:i:s' ); 55 55 } 56 56 -
trunk/tests/phpunit/tests/upload.php
r51568 r51587 23 23 // wp_upload_dir() with default parameters. 24 24 $info = wp_upload_dir(); 25 $subdir = gmstrftime( '/%Y/%m' );25 $subdir = date_format( date_create( 'now' ), '/Y/m' ); 26 26 27 27 $this->assertSame( get_option( 'siteurl' ) . '/wp-content/uploads' . $subdir, $info['url'] ); … … 35 35 update_option( 'upload_path', 'foo/bar' ); 36 36 $info = _wp_upload_dir(); 37 $subdir = gmstrftime( '/%Y/%m' );37 $subdir = date_format( date_create( 'now' ), '/Y/m' ); 38 38 39 39 $this->assertSame( get_option( 'siteurl' ) . '/foo/bar' . $subdir, $info['url'] ); … … 58 58 // It doesn't create the /year/month directories. 59 59 $info = _wp_upload_dir(); 60 $subdir = gmstrftime( '/%Y/%m' );60 $subdir = date_format( date_create( 'now' ), '/Y/m' ); 61 61 62 62 $this->assertSame( '/baz' . $subdir, $info['url'] ); … … 84 84 // It doesn't create the /year/month directories. 85 85 $info = _wp_upload_dir(); 86 $subdir = gmstrftime( '/%Y/%m' );86 $subdir = date_format( date_create( 'now' ), '/Y/m' ); 87 87 88 88 $this->assertSame( 'http://' . WP_TESTS_DOMAIN . '/asdf' . $subdir, $info['url'] ); … … 99 99 // It doesn't create the /year/month directories. 100 100 $info = _wp_upload_dir(); 101 $subdir = gmstrftime( '/%Y/%m' );101 $subdir = date_format( date_create( 'now' ), '/Y/m' ); 102 102 103 103 $this->assertSame( get_option( 'siteurl' ) . '/wp-content/uploads' . $subdir, $info['url'] ); -
trunk/tests/phpunit/tests/xmlrpc/mw/editPost.php
r51415 r51587 333 333 $this->assertSame( 'future', $after->post_status ); 334 334 335 $future_date_string = strftime( '%Y-%m-%d %H:%M:%S', $future_time);335 $future_date_string = date_format( date_create( "@{$future_time}" ), 'Y-m-d H:i:s' ); 336 336 $this->assertSame( $future_date_string, $after->post_date ); 337 337 } -
trunk/tests/phpunit/tests/xmlrpc/mw/getPost.php
r51415 r51587 17 17 ) 18 18 ), 19 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' )),19 'post_date' => date_format( date_create( '+1 day' ), 'Y-m-d H:i:s' ), 20 20 ) 21 21 ); -
trunk/tests/phpunit/tests/xmlrpc/mw/getRecentPosts.php
r51415 r51587 18 18 ) 19 19 ), 20 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' )),20 'post_date' => date_format( date_create( '+1 day' ), 'Y-m-d H:i:s' ), 21 21 ) 22 22 ); -
trunk/tests/phpunit/tests/xmlrpc/wp/editPost.php
r51415 r51587 497 497 $this->assertSame( 'future', $after->post_status ); 498 498 499 $future_date_string = strftime( '%Y-%m-%d %H:%M:%S', $future_time);499 $future_date_string = date_format( date_create( "@{$future_time}" ), 'Y-m-d H:i:s' ); 500 500 $this->assertSame( $future_date_string, $after->post_date ); 501 501 } -
trunk/tests/phpunit/tests/xmlrpc/wp/getPage.php
r51331 r51587 18 18 ) 19 19 ), 20 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' )),20 'post_date' => date_format( date_create( '+1 day' ), 'Y-m-d H:i:s' ), 21 21 ) 22 22 ); -
trunk/tests/phpunit/tests/xmlrpc/wp/getPageList.php
r48937 r51587 18 18 ) 19 19 ), 20 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' )),20 'post_date' => date_format( date_create( '+1 day' ), 'Y-m-d H:i:s' ), 21 21 ) 22 22 ); -
trunk/tests/phpunit/tests/xmlrpc/wp/getPages.php
r48937 r51587 19 19 ) 20 20 ), 21 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' )),21 'post_date' => date_format( date_create( '+1 day' ), 'Y-m-d H:i:s' ), 22 22 ) 23 23 ); -
trunk/tests/phpunit/tests/xmlrpc/wp/getPost.php
r51568 r51587 19 19 'post_excerpt' => rand_str( 100 ), 20 20 'post_author' => $this->make_user_by_role( 'author' ), 21 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', $this->post_date_ts),21 'post_date' => date_format( date_create( "@{$this->post_date_ts}" ), 'Y-m-d H:i:s' ), 22 22 ); 23 23 $this->post_id = wp_insert_post( $this->post_data ); -
trunk/tests/phpunit/tests/xmlrpc/wp/getUser.php
r51568 r51587 62 62 'role' => 'author', 63 63 'aim' => 'wordpress', 64 'user_registered' => strftime( '%Y-%m-%d %H:%M:%S', $registered_date),64 'user_registered' => date_format( date_create( "@{$registered_date}" ), 'Y-m-d H:i:s' ), 65 65 ); 66 66 $user_id = wp_insert_user( $user_data );
Note: See TracChangeset
for help on using the changeset viewer.