Changeset 48633 for trunk/tests/phpunit/tests/post/getLastPostModified.php
- Timestamp:
- 07/27/2020 11:15:04 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/getLastPostModified.php
r48631 r48633 12 12 global $wpdb; 13 13 14 $post_post_date = '2020-01-30 16:09:28'; 15 $post_post_modified = '2020-02-28 17:10:29'; 14 $post_post_date_first = '2020-01-30 16:09:28'; 15 $post_post_modified_first = '2020-02-28 17:10:29'; 16 $post_post_date_last = '2020-03-30 18:11:30'; 17 $post_post_modified_last = '2020-04-30 19:12:31'; 16 18 17 $book_post_date = '2019-03-30 20:09:28'; 18 $book_post_modified = '2019-04-30 21:10:29'; 19 $book_post_date_first = '2019-05-30 20:09:28'; 20 $book_post_modified_first = '2019-06-30 21:10:29'; 21 $book_post_date_last = '2019-07-30 22:11:30'; 22 $book_post_modified_last = '2019-08-30 23:12:31'; 19 23 20 24 // Register book post type. … … 22 26 23 27 // Create a simple post. 24 $simple_post_id = self::factory()->post->create(28 $simple_post_id_first = self::factory()->post->create( 25 29 array( 26 'post_title' => 'Simple Post ',30 'post_title' => 'Simple Post First', 27 31 'post_type' => 'post', 28 'post_date' => $post_post_date, 32 'post_date' => $post_post_date_first, 33 ) 34 ); 35 36 $simple_post_id_last = self::factory()->post->create( 37 array( 38 'post_title' => 'Simple Post Last', 39 'post_type' => 'post', 40 'post_date' => $post_post_date_last, 29 41 ) 30 42 ); 31 43 32 44 // Create custom type post. 33 $book_cpt_id = self::factory()->post->create(45 $book_cpt_id_first = self::factory()->post->create( 34 46 array( 35 'post_title' => 'Book CPT ',47 'post_title' => 'Book CPT First', 36 48 'post_type' => 'book', 37 'post_date' => $book_post_date, 49 'post_date' => $book_post_date_first, 50 ) 51 ); 52 53 $book_cpt_id_last = self::factory()->post->create( 54 array( 55 'post_title' => 'Book CPT Last', 56 'post_type' => 'book', 57 'post_date' => $book_post_date_last, 38 58 ) 39 59 ); … … 43 63 $wpdb->posts, 44 64 array( 45 'post_modified' => $post_post_modified ,46 'post_modified_gmt' => $post_post_modified ,65 'post_modified' => $post_post_modified_first, 66 'post_modified_gmt' => $post_post_modified_first, 47 67 ), 48 68 array( 49 'ID' => $simple_post_id ,69 'ID' => $simple_post_id_first, 50 70 ) 51 71 ); … … 54 74 $wpdb->posts, 55 75 array( 56 'post_modified' => $ book_post_modified,57 'post_modified_gmt' => $ book_post_modified,76 'post_modified' => $post_post_modified_last, 77 'post_modified_gmt' => $post_post_modified_last, 58 78 ), 59 79 array( 60 'ID' => $ book_cpt_id,80 'ID' => $simple_post_id_last, 61 81 ) 62 82 ); 63 83 64 $this->assertEquals( $post_post_modified, get_lastpostmodified( 'blog', 'post' ) ); 65 $this->assertEquals( $book_post_modified, get_lastpostmodified( 'blog', 'book' ) ); 84 $wpdb->update( 85 $wpdb->posts, 86 array( 87 'post_modified' => $book_post_modified_first, 88 'post_modified_gmt' => $book_post_modified_first, 89 ), 90 array( 91 'ID' => $book_cpt_id_first, 92 ) 93 ); 94 95 $wpdb->update( 96 $wpdb->posts, 97 array( 98 'post_modified' => $book_post_modified_last, 99 'post_modified_gmt' => $book_post_modified_last, 100 ), 101 array( 102 'ID' => $book_cpt_id_last, 103 ) 104 ); 105 106 $this->assertEquals( $post_post_modified_last, get_lastpostmodified( 'blog', 'post' ) ); 107 $this->assertEquals( $book_post_modified_last, get_lastpostmodified( 'blog', 'book' ) ); 66 108 } 67 109 }
Note: See TracChangeset
for help on using the changeset viewer.