Ticket #39265: d_folders.2.patch
File d_folders.2.patch, 60.8 KB (added by , 4 years ago) |
---|
-
date/currentTime.php
8 8 9 9 /** 10 10 * @ticket 34378 11 * 12 * @covers ::current_time 11 13 */ 12 14 public function test_current_time_with_date_format_string() { 13 15 update_option( 'gmt_offset', 6 ); … … 22 24 23 25 /** 24 26 * @ticket 34378 27 * 28 * @covers ::current_time 25 29 */ 26 30 public function test_current_time_with_mysql_format() { 27 31 update_option( 'gmt_offset', 6 ); … … 36 40 37 41 /** 38 42 * @ticket 34378 43 * 44 * @covers ::current_time 39 45 */ 40 46 public function test_current_time_with_timestamp() { 41 47 update_option( 'gmt_offset', 6 ); … … 51 57 52 58 /** 53 59 * @ticket 37440 60 * 61 * @covers ::current_time 54 62 */ 55 63 public function test_should_work_with_changed_timezone() { 56 64 $format = 'Y-m-d H:i:s'; … … 78 86 79 87 /** 80 88 * @ticket 40653 89 * 90 * @covers ::current_time 81 91 */ 82 92 public function test_should_return_wp_timestamp() { 83 93 update_option( 'timezone_string', 'Europe/Kiev' ); … … 103 113 104 114 /** 105 115 * @ticket 40653 116 * 117 * @covers ::current_time 106 118 */ 107 119 public function test_should_return_correct_local_time() { 108 120 update_option( 'timezone_string', 'Europe/Kiev' ); -
date/dateI18n.php
8 8 9 9 /** 10 10 * @ticket 28636 11 * 12 * @covers ::date_i18n 11 13 */ 12 14 public function test_should_return_current_time_on_invalid_timestamp() { 13 15 $timezone = 'Europe/Kiev'; … … 21 23 22 24 /** 23 25 * @ticket 28636 26 * 27 * @covers ::date_i18n 24 28 */ 25 29 public function test_should_handle_zero_timestamp() { 26 30 $timezone = 'Europe/Kiev'; … … 36 40 $this->assertSame( 0, date_i18n( 'U', 0 ) ); 37 41 $this->assertSame( $rfc3339, date_i18n( DATE_RFC3339, 0 ) ); 38 42 } 39 43 44 /** 45 * @covers ::date_i18n 46 */ 40 47 public function test_should_format_date() { 41 48 $this->assertEquals( strtotime( gmdate( 'Y-m-d H:i:s' ) ), strtotime( date_i18n( 'Y-m-d H:i:s' ) ), 'The dates should be equal', 2 ); 42 49 } 43 50 51 /** 52 * @covers ::date_i18n 53 */ 44 54 public function test_should_use_custom_timestamp() { 45 55 $this->assertSame( '2012-12-01 00:00:00', date_i18n( 'Y-m-d H:i:s', strtotime( '2012-12-01 00:00:00' ) ) ); 46 56 } 47 57 58 /** 59 * @covers ::date_i18n 60 */ 48 61 public function test_date_should_be_in_gmt() { 49 62 $this->assertEquals( strtotime( gmdate( DATE_RFC3339 ) ), strtotime( date_i18n( DATE_RFC3339, false, true ) ), 'The dates should be equal', 2 ); 50 63 } 51 64 65 /** 66 * @covers ::date_i18n 67 */ 52 68 public function test_custom_timezone_setting() { 53 69 update_option( 'timezone_string', 'America/Regina' ); 54 70 55 71 $this->assertEquals( strtotime( gmdate( 'Y-m-d H:i:s', time() + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ), strtotime( date_i18n( 'Y-m-d H:i:s' ) ), 'The dates should be equal', 2 ); 56 72 } 57 73 74 /** 75 * @covers ::date_i18n 76 */ 58 77 public function test_date_should_be_in_gmt_with_custom_timezone_setting() { 59 78 update_option( 'timezone_string', 'America/Regina' ); 60 79 … … 66 85 67 86 $this->assertSame( '2012-12-01 00:00:00', date_i18n( 'Y-m-d H:i:s', strtotime( '2012-12-01 00:00:00' ) ) ); 68 87 } 69 88 89 /** 90 * @covers ::date_i18n 91 */ 70 92 public function test_adjusts_format_based_on_locale() { 71 93 $original_locale = $GLOBALS['wp_locale']; 72 /* @var WP_Locale $locale */94 /** @var WP_Locale $locale */ 73 95 $locale = clone $GLOBALS['wp_locale']; 74 96 75 97 $locale->weekday[6] = 'Saturday_Translated'; … … 89 111 90 112 $this->assertSame( $expected, $actual ); 91 113 } 92 114 115 /** 116 * @covers ::date_i18n 117 */ 93 118 public function test_adjusts_format_based_on_timezone_string() { 94 119 update_option( 'timezone_string', 'America/Regina' ); 95 120 … … 98 123 99 124 /** 100 125 * @ticket 34835 126 * 127 * @covers ::date_i18n 101 128 */ 102 129 public function test_gmt_offset_should_output_correct_timezone() { 103 130 $timezone_formats = 'P I O T Z e'; … … 117 144 * @ticket 20973 118 145 * 119 146 * @dataProvider data_formats 147 * 148 * @covers ::date_i18n 120 149 */ 121 150 public function test_date_i18n_handles_shorthand_formats( $short, $full ) { 122 151 update_option( 'timezone_string', 'America/Regina' ); … … 140 169 141 170 /** 142 171 * @ticket 25768 172 * 173 * @covers ::date_i18n 143 174 */ 144 175 public function test_should_return_wp_timestamp() { 145 176 update_option( 'timezone_string', 'Europe/Kiev' ); … … 155 186 156 187 /** 157 188 * @ticket 43530 189 * 190 * @covers ::date_i18n 158 191 */ 159 192 public function test_swatch_internet_time_with_wp_timestamp() { 160 193 update_option( 'timezone_string', 'America/Regina' ); … … 164 197 165 198 /** 166 199 * @ticket 25768 200 * 201 * @covers ::date_i18n 167 202 */ 168 203 public function test_should_handle_escaped_formats() { 169 204 $format = 'D | \D | \\D | \\\D | \\\\D | \\\\\D | \\\\\\D'; … … 178 213 * 179 214 * @param string $time Time to test in Y-m-d H:i:s format. 180 215 * @param string $timezone PHP timezone string to use. 216 * 217 * @covers ::date_i18n 181 218 */ 182 219 public function test_should_handle_dst( $time, $timezone ) { 183 220 update_option( 'timezone_string', $timezone ); -
date/getCommentDate.php
9 9 10 10 /** 11 11 * @ticket 51184 12 * 13 * @covers ::get_comment_date 12 14 */ 13 15 public function test_get_comment_date_returns_correct_time_with_comment_id() { 14 16 $c = self::factory()->comment->create( array( 'comment_date' => '2020-08-29 01:51:00' ) ); … … 18 20 19 21 /** 20 22 * @ticket 51184 23 * 24 * @covers ::get_comment_date 21 25 */ 22 26 public function test_get_comment_date_returns_correct_time_with_empty_format() { 23 27 $c = self::factory()->comment->create( array( 'comment_date' => '2020-08-29 01:51:00' ) ); … … 28 32 29 33 /** 30 34 * @ticket 51184 35 * 36 * @covers ::get_comment_time 31 37 */ 32 38 public function test_get_comment_time_returns_correct_time() { 33 39 $c = self::factory()->comment->create( array( 'comment_date' => '2020-08-29 01:51:00' ) ); … … 38 44 39 45 /** 40 46 * @ticket 51184 47 * 48 * @covers ::get_comment_time 41 49 */ 42 50 public function test_get_comment_time_returns_correct_time_with_empty_format() { 43 51 $c = self::factory()->comment->create( array( 'comment_date' => '2020-08-29 01:51:00' ) ); -
date/getFeedBuildDate.php
19 19 20 20 /** 21 21 * @ticket 48675 22 * 23 * @covers ::get_feed_build_date 22 24 */ 23 25 public function test_should_return_correct_feed_build_date() { 24 26 global $wp_query; … … 42 44 * Test that get_feed_build_date() works with invalid post dates. 43 45 * 44 46 * @ticket 48957 47 * 48 * @covers ::get_feed_build_date 45 49 */ 46 50 public function test_should_fall_back_to_last_post_modified() { 47 51 global $wp_query; -
date/getPermalink.php
18 18 19 19 /** 20 20 * @ticket 48623 21 * 22 * @covers ::get_permalink 21 23 */ 22 24 public function test_should_return_correct_date_permalink_with_changed_time_zone() { 23 25 $timezone = 'America/Chicago'; -
date/getPostTime.php
9 9 10 10 /** 11 11 * @ticket 28310 12 * 13 * @covers ::get_post_time 12 14 */ 13 15 public function test_get_post_time_returns_correct_time_with_post_id() { 14 16 $post_id = self::factory()->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) ); … … 18 20 19 21 /** 20 22 * @ticket 28310 23 * 24 * @covers ::get_post_time 21 25 */ 22 26 public function test_get_post_time_returns_false_with_null_or_non_existing_post() { 23 27 $this->assertFalse( get_post_time() ); … … 28 32 29 33 /** 30 34 * @ticket 28310 35 * 36 * @covers ::get_post_modified_time 31 37 */ 32 38 public function test_get_post_modified_time_returns_correct_time_with_post_id() { 33 39 $post_id = self::factory()->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) ); … … 37 43 38 44 /** 39 45 * @ticket 28310 46 * 47 * @covers ::get_post_modified_time 40 48 */ 41 49 public function test_get_post_modified_time_returns_false_with_null_or_non_existing_post() { 42 50 $this->assertFalse( get_post_modified_time() ); … … 47 55 48 56 /** 49 57 * @ticket 25002 58 * 59 * @covers ::get_post_time 60 * @covers ::get_post_modified_time 50 61 */ 51 62 public function test_should_return_wp_timestamp() { 52 63 $timezone = 'Europe/Kiev'; … … 76 87 77 88 /** 78 89 * @ticket 25002 90 * 91 * @covers ::get_post_time 92 * @covers ::get_post_modified_time 79 93 */ 80 94 public function test_should_return_time() { 81 95 $timezone = 'Europe/Kiev'; … … 104 118 105 119 /** 106 120 * @ticket 48384 121 * 122 * @covers ::get_post_time 123 * @covers ::get_post_modified_time 107 124 */ 108 125 public function test_should_keep_utc_time_on_timezone_change() { 109 126 $timezone = 'UTC'; -
date/getTheDate.php
9 9 10 10 /** 11 11 * @ticket 13771 12 * 13 * @covers ::get_the_date 12 14 */ 13 15 public function test_get_the_date_returns_correct_time_with_post_id() { 14 16 $post_id = self::factory()->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) ); … … 18 20 19 21 /** 20 22 * @ticket 28310 23 * 24 * @covers ::get_the_date 21 25 */ 22 26 public function test_get_the_date_returns_false_with_null_or_non_existing_post() { 23 27 $this->assertFalse( get_the_date() ); … … 28 32 29 33 /** 30 34 * @ticket 51184 35 * 36 * @covers ::get_the_date 31 37 */ 32 38 public function test_get_the_date_returns_correct_time_with_empty_format() { 33 39 $post_id = self::factory()->post->create( array( 'post_date' => '2020-08-29 01:51:00' ) ); … … 38 44 39 45 /** 40 46 * @ticket 28310 47 * 48 * @covers ::get_the_time 41 49 */ 42 50 public function test_get_the_time_returns_correct_time_with_post_id() { 43 51 $post_id = self::factory()->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) ); … … 47 55 48 56 /** 49 57 * @ticket 28310 58 * 59 * @covers ::get_the_time 50 60 */ 51 61 public function test_get_the_time_returns_false_with_null_or_non_existing_post() { 52 62 $this->assertFalse( get_the_time() ); … … 57 67 58 68 /** 59 69 * @ticket 51184 70 * 71 * @covers ::get_the_time 60 72 */ 61 73 public function test_get_the_time_returns_correct_time_with_empty_format() { 62 74 $post_id = self::factory()->post->create( array( 'post_date' => '2020-08-29 01:51:00' ) ); -
date/getTheModifiedDate.php
13 13 * @ticket 37059 14 14 * 15 15 * @since 4.6.0 16 * 17 * @covers ::get_the_modified_date 16 18 */ 17 19 public function test_get_the_modified_date_with_post_id() { 18 20 $details = array( … … 32 34 * @ticket 37059 33 35 * 34 36 * @since 4.6.0 37 * 38 * @covers ::get_the_modified_date 35 39 */ 36 40 public function test_get_the_modified_date_default() { 37 41 $details = array( … … 55 59 * @ticket 37059 56 60 * 57 61 * @since 4.6.0 62 * 63 * @covers ::get_the_modified_date 58 64 */ 59 65 public function test_get_the_modified_date_failures_are_filtered() { 60 66 // Remove global post object. … … 80 86 81 87 /** 82 88 * @ticket 51184 89 * 90 * @covers ::get_the_modified_date 83 91 */ 84 92 public function test_get_the_modified_date_returns_false_with_null_or_non_existing_post() { 85 93 $this->assertFalse( get_the_modified_date() ); … … 90 98 91 99 /** 92 100 * @ticket 51184 101 * 102 * @covers ::get_the_modified_date 93 103 */ 94 104 public function test_get_the_modified_date_returns_correct_time_with_empty_format() { 95 105 $post_id = self::factory()->post->create( array( 'post_date' => '2020-08-31 23:14:00' ) ); … … 104 114 * @ticket 37059 105 115 * 106 116 * @since 4.6.0 117 * 118 * @covers ::get_the_modified_time 107 119 */ 108 120 public function test_get_the_modified_time_with_post_id() { 109 121 $details = array( … … 123 135 * @ticket 37059 124 136 * 125 137 * @since 4.6.0 138 * 139 * @covers ::get_the_modified_time 126 140 */ 127 141 public function test_get_the_modified_time_default() { 128 142 $details = array( … … 146 160 * @ticket 37059 147 161 * 148 162 * @since 4.6.0 163 * 164 * @covers ::get_the_modified_time 149 165 */ 150 166 public function test_get_the_modified_time_failures_are_filtered() { 151 167 // Remove global post object. … … 171 187 172 188 /** 173 189 * @ticket 51184 190 * 191 * @covers ::get_the_modified_time 174 192 */ 175 193 public function test_get_the_modified_time_returns_false_with_null_or_non_existing_post() { 176 194 $this->assertFalse( get_the_modified_time() ); … … 181 199 182 200 /** 183 201 * @ticket 51184 202 * 203 * @covers ::get_the_modified_time 184 204 */ 185 205 public function test_get_the_modified_time_returns_correct_time_with_empty_format() { 186 206 $post_id = self::factory()->post->create( array( 'post_date' => '2020-08-31 23:14:00' ) ); -
date/maybeDeclineDate.php
41 41 * @ticket 48606 42 42 * @ticket 48934 43 43 * @dataProvider data_wp_maybe_decline_date 44 * 45 * @covers ::wp_maybe_decline_date 44 46 */ 45 47 public function test_wp_maybe_decline_date( $test_locale, $format, $input, $output ) { 46 48 global $locale, $wp_locale; … … 58 60 remove_filter( 'gettext_with_context', array( $this, 'filter__enable_months_names_declension' ), 10 ); 59 61 60 62 $this->assertSame( $output, $declined_date ); 61 } 62 63 } 64 63 65 public function filter__enable_months_names_declension( $translation, $text, $context ) { 64 66 if ( 'decline months names: on or off' === $context ) { 65 67 $translation = 'on'; -
date/mysql2date.php
15 15 16 16 /** 17 17 * @ticket 28310 18 * 19 * @covers ::mysql2date 18 20 */ 19 21 function test_mysql2date_returns_false_with_no_date() { 20 22 $this->assertFalse( mysql2date( 'F j, Y H:i:s', '' ) ); … … 22 24 23 25 /** 24 26 * @ticket 28310 27 * 28 * @covers ::mysql2date 25 29 */ 26 30 function test_mysql2date_returns_gmt_or_unix_timestamp() { 27 31 $this->assertSame( 441013392, mysql2date( 'G', '1983-12-23 07:43:12' ) ); … … 30 34 31 35 /** 32 36 * @ticket 28992 37 * 38 * @covers ::mysql2date 33 39 */ 34 40 function test_mysql2date_should_format_time() { 35 41 $timezone = 'Europe/Kiev'; … … 44 50 45 51 /** 46 52 * @ticket 28992 53 * 54 * @covers ::mysql2date 47 55 */ 48 56 function test_mysql2date_should_format_time_with_changed_time_zone() { 49 57 $timezone = 'Europe/Kiev'; … … 60 68 61 69 /** 62 70 * @ticket 28992 71 * 72 * @covers ::mysql2date 63 73 */ 64 74 function test_mysql2date_should_return_wp_timestamp() { 65 75 $timezone = 'Europe/Kiev'; … … 74 84 75 85 /** 76 86 * @ticket 28992 87 * 88 * @covers ::mysql2date 77 89 */ 78 90 function test_mysql2date_should_return_unix_timestamp_for_gmt_time() { 79 91 $timezone = 'Europe/Kiev'; -
date/query.php
16 16 unset( $this->q ); 17 17 $this->q = new WP_Date_Query( array( 'm' => 2 ) ); 18 18 } 19 19 20 /** 21 * Test WP_Date_Query handling of empty query. 22 * 23 * @covers WP_Date_Query 24 */ 20 25 public function test_construct_date_query_empty() { 21 26 $q = new WP_Date_Query( array() ); 22 27 $this->assertSame( 'AND', $q->relation ); … … 24 29 $this->assertSame( '=', $q->compare ); 25 30 $this->assertSame( array(), $q->queries ); 26 31 } 27 32 33 /** 34 * Test WP_Date_Query handling of non array query. 35 * 36 * @covers WP_Date_Query 37 */ 28 38 public function test_construct_date_query_non_array() { 29 39 $q = new WP_Date_Query( 'foo' ); 30 40 $this->assertSame( 'AND', $q->relation ); … … 32 42 $this->assertSame( '=', $q->compare ); 33 43 $this->assertSame( array(), $q->queries ); 34 44 } 35 45 46 /** 47 * Test WP_Date_Query handling of using a lowercase 'or' relation value. 48 * 49 * @covers WP_Date_Query 50 */ 36 51 public function test_construct_relation_or_lowercase() { 37 52 $q = new WP_Date_Query( 38 53 array( … … 42 57 43 58 $this->assertSame( 'OR', $q->relation ); 44 59 } 45 60 61 /** 62 * Test WP_Date_Query handling of an invalid relation value. 63 * 64 * @covers WP_Date_Query 65 */ 46 66 public function test_construct_relation_invalid() { 47 67 $q = new WP_Date_Query( 48 68 array( … … 52 72 53 73 $this->assertSame( 'AND', $q->relation ); 54 74 } 55 75 76 /** 77 * Test WP_Date_Query handling of the query not being an array of arrays. 78 * 79 * @covers WP_Date_Query 80 */ 56 81 public function test_construct_query_not_an_array_of_arrays() { 57 82 $q = new WP_Date_Query( 58 83 array( … … 80 105 81 106 $this->assertSame( $expected, $q->queries ); 82 107 } 83 108 109 /** 110 * Test WP_Date_Query handling of the query missing a level of array nesting. 111 * 112 * @covers WP_Date_Query 113 */ 84 114 public function test_construct_query_contains_non_arrays() { 85 115 $q = new WP_Date_Query( 86 116 array( … … 112 142 113 143 $this->assertSame( $expected, $q->queries ); 114 144 } 115 145 146 /** 147 * Test WP_Date_Query handling of not provided compare value. 148 * 149 * @covers WP_Date_Query 150 */ 116 151 public function test_get_compare_empty() { 117 152 $q = new WP_Date_Query( array() ); 118 153 $this->assertSame( '=', $q->get_compare( array() ) ); 119 154 } 120 155 156 /** 157 * Test WP_Date_Query handling of '=' compare value. 158 * 159 * @covers WP_Date_Query 160 */ 121 161 public function test_get_compare_equals() { 122 162 $q = new WP_Date_Query( array() ); 123 163 … … 128 168 ); 129 169 $this->assertSame( '=', $found ); 130 170 } 131 171 172 /** 173 * Test WP_Date_Query handling of '!=' compare value. 174 * 175 * @covers WP_Date_Query 176 */ 132 177 public function test_get_compare_not_equals() { 133 178 $q = new WP_Date_Query( array() ); 134 179 … … 139 184 ); 140 185 $this->assertSame( '!=', $found ); 141 186 } 142 187 188 /** 189 * Test WP_Date_Query handling of '>' compare value. 190 * 191 * @covers WP_Date_Query 192 */ 143 193 public function test_get_compare_greater_than() { 144 194 $q = new WP_Date_Query( array() ); 145 195 … … 150 200 ); 151 201 $this->assertSame( '>', $found ); 152 202 } 153 203 204 /** 205 * Test WP_Date_Query handling of '>=' compare value. 206 * 207 * @covers WP_Date_Query 208 */ 154 209 public function test_get_compare_greater_than_or_equal_to() { 155 210 $q = new WP_Date_Query( array() ); 156 211 … … 161 216 ); 162 217 $this->assertSame( '>=', $found ); 163 218 } 164 219 220 /** 221 * Test WP_Date_Query handling of '<' compare value. 222 * 223 * @covers WP_Date_Query 224 */ 165 225 public function test_get_compare_less_than() { 166 226 $q = new WP_Date_Query( array() ); 167 227 … … 172 232 ); 173 233 $this->assertSame( '<', $found ); 174 234 } 175 235 236 /** 237 * Test WP_Date_Query handling of '<=' compare value. 238 * 239 * @covers WP_Date_Query 240 */ 176 241 public function test_get_compare_less_than_or_equal_to() { 177 242 $q = new WP_Date_Query( array() ); 178 243 … … 183 248 ); 184 249 $this->assertSame( '<=', $found ); 185 250 } 186 251 252 /** 253 * Test WP_Date_Query handling of 'IN' compare value. 254 * 255 * @covers WP_Date_Query 256 */ 187 257 public function test_get_compare_in() { 188 258 $q = new WP_Date_Query( array() ); 189 259 … … 194 264 ); 195 265 $this->assertSame( 'IN', $found ); 196 266 } 197 267 268 /** 269 * Test WP_Date_Query handling of 'NOT IN' compare value. 270 * 271 * @covers WP_Date_Query 272 */ 198 273 public function test_get_compare_not_in() { 199 274 $q = new WP_Date_Query( array() ); 200 275 … … 205 280 ); 206 281 $this->assertSame( 'NOT IN', $found ); 207 282 } 208 283 284 /** 285 * Test WP_Date_Query handling of 'BETWEEN' compare value. 286 * 287 * @covers WP_Date_Query 288 */ 209 289 public function test_get_compare_between() { 210 290 $q = new WP_Date_Query( array() ); 211 291 … … 216 296 ); 217 297 $this->assertSame( 'BETWEEN', $found ); 218 298 } 219 299 300 /** 301 * @covers WP_Date_Query 302 */ 220 303 public function test_get_compare_not_between() { 221 304 $q = new WP_Date_Query( array() ); 222 305 … … 227 310 ); 228 311 $this->assertSame( 'BETWEEN', $found ); 229 312 } 230 313 314 /** 315 * Test WP_Date_Query validation of post_date column. 316 * 317 * @covers WP_Date_Query::validate_column 318 */ 231 319 public function test_validate_column_post_date() { 232 320 global $wpdb; 233 321 $q = new WP_Date_Query( array() ); … … 234 322 235 323 $this->assertSame( $wpdb->posts . '.post_date', $q->validate_column( 'post_date' ) ); 236 324 } 237 325 326 /** 327 * Test WP_Date_Query validation of post_date_gmt column. 328 * 329 * @covers WP_Date_Query::validate_column 330 */ 238 331 public function test_validate_column_post_date_gmt() { 239 332 global $wpdb; 240 333 $q = new WP_Date_Query( array() ); … … 241 334 242 335 $this->assertSame( $wpdb->posts . '.post_date_gmt', $q->validate_column( 'post_date_gmt' ) ); 243 336 } 244 337 338 /** 339 * Test WP_Date_Query validation of post_modified column. 340 * 341 * @covers WP_Date_Query::validate_column 342 */ 245 343 public function test_validate_column_post_modified() { 246 344 global $wpdb; 247 345 $q = new WP_Date_Query( array() ); … … 248 346 249 347 $this->assertSame( $wpdb->posts . '.post_modified', $q->validate_column( 'post_modified' ) ); 250 348 } 251 349 350 /** 351 * Test WP_Date_Query validation of post_modified_gmt column. 352 * 353 * @covers WP_Date_Query::validate_column 354 */ 252 355 public function test_validate_column_post_modified_gmt() { 253 356 global $wpdb; 254 357 $q = new WP_Date_Query( array() ); … … 255 358 256 359 $this->assertSame( $wpdb->posts . '.post_modified_gmt', $q->validate_column( 'post_modified_gmt' ) ); 257 360 } 258 361 362 /** 363 * Test WP_Date_Query validation of comment_date column. 364 * 365 * @covers WP_Date_Query::validate_column 366 */ 259 367 public function test_validate_column_comment_date() { 260 368 global $wpdb; 261 369 $q = new WP_Date_Query( array() ); … … 262 370 263 371 $this->assertSame( $wpdb->comments . '.comment_date', $q->validate_column( 'comment_date' ) ); 264 372 } 265 373 374 /** 375 * Test WP_Date_Query validation of comment_date_gmt column. 376 * 377 * @covers WP_Date_Query::validate_column 378 */ 266 379 public function test_validate_column_comment_date_gmt() { 267 380 global $wpdb; 268 381 $q = new WP_Date_Query( array() ); … … 269 382 270 383 $this->assertSame( $wpdb->comments . '.comment_date_gmt', $q->validate_column( 'comment_date_gmt' ) ); 271 384 } 272 385 386 /** 387 * Test WP_Date_Query validation of an invalid post_date value. 388 * 389 * @covers WP_Date_Query::validate_column 390 */ 273 391 public function test_validate_column_invalid() { 274 392 global $wpdb; 275 393 $q = new WP_Date_Query( array() ); … … 279 397 280 398 /** 281 399 * @ticket 25775 400 * 401 * @covers WP_Date_Query::validate_column 282 402 */ 283 403 public function test_validate_column_with_date_query_valid_columns_filter() { 284 404 $q = new WP_Date_Query( array() ); … … 292 412 293 413 /** 294 414 * @ticket 25775 415 * 416 * @covers WP_Date_Query::validate_column 295 417 */ 296 418 public function test_validate_column_prefixed_column_name() { 297 419 $q = new WP_Date_Query( array() ); … … 301 423 302 424 /** 303 425 * @ticket 25775 426 * 427 * @covers WP_Date_Query::validate_column 304 428 */ 305 429 public function test_validate_column_prefixed_column_name_with_illegal_characters() { 306 430 $q = new WP_Date_Query( array() ); … … 307 431 308 432 $this->assertSame( 'foo.bar', $q->validate_column( 'f"\'oo\/.b;:()ar' ) ); 309 433 } 310 434 435 /** 436 * Test WP_Date_Query::build_value when passed a null value 437 * 438 * @covers WP_Date_Query::build_value 439 */ 311 440 public function test_build_value_value_null() { 312 441 global $wpdb; 313 442 $q = new WP_Date_Query( array() ); … … 317 446 318 447 /** 319 448 * @ticket 29801 449 * 450 * @covers WP_Date_Query::build_value 320 451 */ 321 452 public function test_build_value_compare_in() { 322 453 $q = new WP_Date_Query( array() ); … … 340 471 341 472 /** 342 473 * @ticket 29801 474 * 475 * @covers WP_Date_Query::build_value 343 476 */ 344 477 public function test_build_value_compare_not_in() { 345 478 $q = new WP_Date_Query( array() ); … … 360 493 $found = $q->build_value( 'NOT IN', array( 1, 'foo', 7 ) ); 361 494 $this->assertSame( '(1,7)', $found ); 362 495 } 363 496 497 /** 498 * Test WP_Date_Query::build_value when passed the same values as compare BETWEEN. 499 * 500 * @covers WP_Date_Query::build_value 501 */ 364 502 public function test_build_value_compare_between_single_integer() { 365 503 $q = new WP_Date_Query( array() ); 366 504 … … 370 508 371 509 /** 372 510 * @ticket 29801 511 * 512 * @covers WP_Date_Query::build_value 373 513 */ 374 514 public function test_build_value_compare_between_single_non_numeric() { 375 515 $q = new WP_Date_Query( array() ); … … 380 520 381 521 /** 382 522 * @ticket 29801 523 * 524 * @covers WP_Date_Query::build_value 383 525 */ 384 526 public function test_build_value_compare_between_array_with_other_than_two_items() { 385 527 $q = new WP_Date_Query( array() ); … … 390 532 391 533 /** 392 534 * @ticket 29801 535 * 536 * @covers WP_Date_Query::build_value 393 537 */ 394 538 public function test_build_value_compare_between_incorrect_array_key() { 395 539 $q = new WP_Date_Query( array() ); … … 407 551 408 552 /** 409 553 * @ticket 29801 554 * 555 * @covers WP_Date_Query::build_value 410 556 */ 411 557 public function test_build_value_compare_between_array_contains_non_numeric() { 412 558 $q = new WP_Date_Query( array() ); … … 414 560 $found = $q->build_value( 'BETWEEN', array( 2, 'foo' ) ); 415 561 $this->assertFalse( $found ); 416 562 } 417 563 564 /** 565 * @covers WP_Date_Query::build_value 566 */ 418 567 public function test_build_value_compare_between() { 419 568 $q = new WP_Date_Query( array() ); 420 569 … … 421 570 $found = $q->build_value( 'BETWEEN', array( 2, 3 ) ); 422 571 $this->assertSame( '2 AND 3', $found ); 423 572 } 424 573 574 /** 575 * @covers WP_Date_Query::build_value 576 */ 425 577 public function test_build_value_compare_not_between_single_integer() { 426 578 $q = new WP_Date_Query( array() ); 427 579 … … 431 583 432 584 /** 433 585 * @ticket 29801 586 * 587 * @covers WP_Date_Query::build_value 434 588 */ 435 589 public function test_build_value_compare_not_between_single_non_numeric() { 436 590 $q = new WP_Date_Query( array() ); … … 441 595 442 596 /** 443 597 * @ticket 29801 598 * 599 * @covers WP_Date_Query::build_value 444 600 */ 445 601 public function test_build_value_compare_not_between_array_with_other_than_two_items() { 446 602 $q = new WP_Date_Query( array() ); … … 451 607 452 608 /** 453 609 * @ticket 29801 610 * 611 * @covers WP_Date_Query::build_value 454 612 */ 455 613 public function test_build_value_compare_not_between_incorrect_array_key() { 456 614 $q = new WP_Date_Query( array() ); … … 468 626 469 627 /** 470 628 * @ticket 29801 629 * 630 * @covers WP_Date_Query::build_value 471 631 */ 472 632 public function test_build_value_compare_not_between_array_contains_non_numeric() { 473 633 $q = new WP_Date_Query( array() ); … … 475 635 $found = $q->build_value( 'NOT BETWEEN', array( 2, 'foo' ) ); 476 636 $this->assertFalse( $found ); 477 637 } 478 638 639 /** 640 * @covers WP_Date_Query::build_value 641 */ 479 642 public function test_build_value_compare_not_between() { 480 643 $q = new WP_Date_Query( array() ); 481 644 … … 482 645 $found = $q->build_value( 'NOT BETWEEN', array( 2, 3 ) ); 483 646 $this->assertSame( '2 AND 3', $found ); 484 647 } 485 648 649 /** 650 * @covers WP_Date_Query::build_value 651 */ 486 652 public function test_build_value_compare_default_value_integer() { 487 653 $q = new WP_Date_Query( array() ); 488 654 … … 492 658 493 659 /** 494 660 * @ticket 29801 661 * 662 * @covers WP_Date_Query::build_value 495 663 */ 496 664 public function test_build_value_compare_default_value_non_numeric() { 497 665 $q = new WP_Date_Query( array() ); … … 499 667 $found = $q->build_value( 'foo', 'foo' ); 500 668 $this->assertFalse( $found ); 501 669 } 502 670 671 /** 672 * @covers WP_Date_Query::build_mysql_datetime 673 */ 503 674 public function test_build_mysql_datetime_datetime_non_array() { 504 675 $q = new WP_Date_Query( array() ); 505 676 … … 517 688 * @param array|string $datetime Array or string date input. 518 689 * @param string $expected Expected built result. 519 690 * @param bool $default_to_max Flag to default missing values to max. 691 * 692 * @covers WP_Date_Query::build_mysql_datetime 520 693 */ 521 694 public function test_build_mysql_datetime( $datetime, $expected, $default_to_max = false ) { 522 695 $q = new WP_Date_Query( array() ); … … 525 698 526 699 $message = "Expected {$expected}, got {$found}"; 527 700 $this->assertEquals( strtotime( $expected ), strtotime( $found ), $message, 10 ); 528 } 701 } 529 702 530 public function mysql_datetime_input_provider() {531 return array(532 array( '2019-06-04T08:18:24+03:00', '2019-06-04 05:18:24' ),533 array( '2019-06-04T05:18:24+00:00', '2019-06-04 05:18:24' ),534 array( array(), current_time( 'Y' ) . '-01-01 00:00:00' ),535 array( array( 'year' => 2011 ), '2011-12-31 23:59:59', true ),536 array( array( 'year' => 2011 ), '2011-01-01 00:00:00' ),537 array( '2011', '2011-01-01 00:00:00' ),538 array( '2011-02', '2011-02-01 00:00:00' ),539 array( '2011-02-03', '2011-02-03 00:00:00' ),540 array( '2011-02-03 13:30', '2011-02-03 13:30:00' ),541 array( '2011-02-03 13:30:35', '2011-02-03 13:30:35' ),542 );543 }544 545 703 /** 546 704 * @ticket 41782 547 705 * … … 550 708 * @param array|string $datetime Array or string date input. 551 709 * @param string $expected Expected built result. 552 710 * @param bool $default_to_max Flag to default missing values to max. 711 * 712 * @covers WP_Date_Query::build_mysql_datetime 553 713 */ 554 714 public function test_build_mysql_datetime_with_custom_timezone( $datetime, $expected, $default_to_max = false ) { 555 715 update_option( 'timezone_string', 'Europe/Kiev' ); … … 561 721 $message = "Expected {$expected}, got {$found}"; 562 722 $this->assertEquals( strtotime( $expected ), strtotime( $found ), $message, 10 ); 563 723 564 } 724 } 565 725 566 public function mysql_datetime_input_provider_custom_timezone() {567 return array(568 array( '2019-06-04T08:18:24+03:00', '2019-06-04 08:18:24' ),569 array( '2019-06-04T05:18:24+00:00', '2019-06-04 08:18:24' ),570 );571 }572 573 726 /** 574 727 * @ticket 41782 728 * 729 * @covers WP_Date_Query::build_mysql_datetime 575 730 */ 576 731 public function test_build_mysql_datetime_with_relative_date() { 577 732 update_option( 'timezone_string', 'Europe/Kiev' ); … … 585 740 $message = "Expected {$expected}, got {$found}"; 586 741 $this->assertEquals( strtotime( $expected ), strtotime( $found ), $message, 10 ); 587 742 } 588 743 744 /** 745 * @covers WP_Date_Query::build_time_query 746 */ 589 747 public function test_build_time_query_insufficient_time_values() { 590 748 $q = new WP_Date_Query( array() ); 591 749 … … 594 752 595 753 /** 596 754 * @ticket 34228 755 * 756 * @covers WP_Date_Query::build_time_query 597 757 */ 598 758 public function test_build_time_query_should_not_discard_hour_0() { 599 759 global $wpdb; … … 603 763 604 764 $this->assertContains( '%H', $wpdb->remove_placeholder_escape( $found ) ); 605 765 } 606 766 767 /** 768 * @covers WP_Date_Query::build_time_query 769 */ 607 770 public function test_build_time_query_compare_in() { 608 771 $q = new WP_Date_Query( array() ); 609 772 … … 619 782 $found = $q->build_time_query( 'post_date', 'IN', array( 1, 2 ), array( 3, 4, 5 ), 6 ); 620 783 $this->assertSame( 'HOUR( post_date ) IN (1,2) AND MINUTE( post_date ) IN (3,4,5) AND SECOND( post_date ) IN (6)', $found ); 621 784 } 622 785 786 /** 787 * @covers WP_Date_Query::build_time_query 788 */ 623 789 public function test_build_time_query_compare_not_in() { 624 790 $q = new WP_Date_Query( array() ); 625 791 … … 635 801 $found = $q->build_time_query( 'post_date', 'NOT IN', array( 1, 2 ), array( 3, 4, 5 ), 6 ); 636 802 $this->assertSame( 'HOUR( post_date ) NOT IN (1,2) AND MINUTE( post_date ) NOT IN (3,4,5) AND SECOND( post_date ) NOT IN (6)', $found ); 637 803 } 638 804 805 /** 806 * @covers WP_Date_Query::build_time_query 807 */ 639 808 public function test_build_time_query_compare_between() { 640 809 $q = new WP_Date_Query( array() ); 641 810 … … 651 820 $found = $q->build_time_query( 'post_date', 'BETWEEN', array( 1, 2 ), array( 3, 4 ), array( 6, 7 ) ); 652 821 $this->assertSame( 'HOUR( post_date ) BETWEEN 1 AND 2 AND MINUTE( post_date ) BETWEEN 3 AND 4 AND SECOND( post_date ) BETWEEN 6 AND 7', $found ); 653 822 } 654 823 824 /** 825 * @covers WP_Date_Query::build_time_query 826 */ 655 827 public function test_build_time_query_compare_not_between() { 656 828 $q = new WP_Date_Query( array() ); 657 829 … … 667 839 $found = $q->build_time_query( 'post_date', 'NOT BETWEEN', array( 1, 2 ), array( 3, 4 ), array( 6, 7 ) ); 668 840 $this->assertSame( 'HOUR( post_date ) NOT BETWEEN 1 AND 2 AND MINUTE( post_date ) NOT BETWEEN 3 AND 4 AND SECOND( post_date ) NOT BETWEEN 6 AND 7', $found ); 669 841 } 670 842 843 /** 844 * @covers WP_Date_Query::build_time_query 845 */ 671 846 public function test_build_time_query_hour_only() { 672 847 $q = new WP_Date_Query( array() ); 673 848 … … 681 856 $found = $q->build_time_query( 'post_date', '=', null, 5 ); 682 857 $this->assertSame( 'MINUTE( post_date ) = 5', $found ); 683 858 } 684 859 860 /** 861 * @covers WP_Date_Query::build_time_query 862 */ 685 863 public function test_build_time_query_second_only() { 686 864 $q = new WP_Date_Query( array() ); 687 865 … … 688 866 $found = $q->build_time_query( 'post_date', '=', null, null, 5 ); 689 867 $this->assertSame( 'SECOND( post_date ) = 5', $found ); 690 868 } 691 869 870 /** 871 * @covers WP_Date_Query::build_time_query 872 */ 692 873 public function test_build_time_query_hour_and_second() { 693 874 $q = new WP_Date_Query( array() ); 694 875 … … 695 876 $found = $q->build_time_query( 'post_date', '=', 5, null, 5 ); 696 877 $this->assertFalse( $found ); 697 878 } 698 879 880 /** 881 * @covers WP_Date_Query::build_time_query 882 * @covers wpdb::remove_placeholder_escape 883 */ 699 884 public function test_build_time_query_hour_minute() { 700 885 global $wpdb; 701 886 $q = new WP_Date_Query( array() ); … … 706 891 // varying precision on different PHP installations. 707 892 $this->assertRegExp( "/DATE_FORMAT\( post_date, '%H\.%i' \) = 5\.150*/", $wpdb->remove_placeholder_escape( $found ) ); 708 893 } 709 894 895 /** 896 * @covers WP_Date_Query::build_time_query 897 * @covers wpdb::remove_placeholder_escape 898 */ 710 899 public function test_build_time_query_hour_minute_second() { 711 900 global $wpdb; 712 901 $q = new WP_Date_Query( array() ); … … 717 906 // varying precision on different PHP installations. 718 907 $this->assertRegExp( "/DATE_FORMAT\( post_date, '%H\.%i%s' \) = 5\.15350*/", $wpdb->remove_placeholder_escape( $found ) ); 719 908 } 720 909 910 /** 911 * @covers WP_Date_Query::build_time_query 912 * @covers wpdb::remove_placeholder_escape 913 */ 721 914 public function test_build_time_query_minute_second() { 722 915 global $wpdb; 723 916 $q = new WP_Date_Query( array() ); … … 732 925 /** 733 926 * @ticket 25834 734 927 * @expectedIncorrectUsage WP_Date_Query 928 * 929 * @covers WP_Date_Query::validate_date_values 735 930 */ 736 931 public function test_validate_date_query_before_after() { 737 932 // Valid values. … … 779 974 /** 780 975 * @ticket 25834 781 976 * @expectedIncorrectUsage WP_Date_Query 977 * 978 * @covers WP_Date_Query::validate_date_values 782 979 */ 783 980 public function test_validate_date_query_before_after_with_month() { 784 981 // Both are valid. … … 825 1022 /** 826 1023 * @ticket 25834 827 1024 * @expectedIncorrectUsage WP_Date_Query 1025 * 1026 * @covers WP_Date_Query::validate_date_values 828 1027 */ 829 1028 public function test_validate_date_values_week() { 830 1029 // Valid values. … … 878 1077 /** 879 1078 * @ticket 25834 880 1079 * @expectedIncorrectUsage WP_Date_Query 1080 * 1081 * @covers WP_Date_Query::validate_date_values 881 1082 */ 882 1083 public function test_validate_date_values_month() { 883 1084 // Valid values. … … 896 1097 /** 897 1098 * @ticket 25834 898 1099 * @expectedIncorrectUsage WP_Date_Query 1100 * 1101 * @covers WP_Date_Query::validate_date_values 899 1102 */ 900 1103 public function test_validate_date_values_day() { 901 1104 // Valid values. … … 953 1156 /** 954 1157 * @ticket 25834 955 1158 * @expectedIncorrectUsage WP_Date_Query 1159 * 1160 * @covers WP_Date_Query::validate_date_values 956 1161 */ 957 1162 public function test_validate_date_values_hour() { 958 1163 // Valid values. … … 971 1176 /** 972 1177 * @ticket 25834 973 1178 * @expectedIncorrectUsage WP_Date_Query 1179 * 1180 * @covers WP_Date_Query::validate_date_values 974 1181 */ 975 1182 public function test_validate_date_values_minute() { 976 1183 // Valid values. … … 989 1196 /** 990 1197 * @ticket 25834 991 1198 * @expectedIncorrectUsage WP_Date_Query 1199 * 1200 * @covers WP_Date_Query::validate_date_values 992 1201 */ 993 1202 public function test_validate_date_values_second() { 994 1203 // Valid values. … … 1008 1217 /** 1009 1218 * @ticket 25834 1010 1219 * @expectedIncorrectUsage WP_Date_Query 1220 * 1221 * @covers WP_Date_Query::validate_date_values 1011 1222 */ 1012 1223 public function test_validate_date_values_day_of_week() { 1013 1224 // Valid values. … … 1026 1237 /** 1027 1238 * @ticket 28063 1028 1239 * @expectedIncorrectUsage WP_Date_Query 1240 * 1241 * @covers WP_Date_Query::validate_date_values 1029 1242 */ 1030 1243 public function test_validate_date_values_day_of_week_iso() { 1031 1244 // Valid values. … … 1044 1257 /** 1045 1258 * @ticket 25834 1046 1259 * @expectedIncorrectUsage WP_Date_Query 1260 * 1261 * @covers WP_Date_Query::validate_date_values 1047 1262 */ 1048 1263 public function test_validate_date_values_day_of_year() { 1049 1264 // Valid values. … … 1061 1276 1062 1277 /** 1063 1278 * @ticket 31001 1279 * 1280 * @covers WP_Date_Query 1064 1281 */ 1065 1282 public function test_validate_date_values_should_process_array_value_for_year() { 1066 1283 $p1 = self::factory()->post->create( array( 'post_date' => '2015-01-12 00:00:00' ) ); … … 1083 1300 1084 1301 /** 1085 1302 * @ticket 31001 1303 * 1304 * @covers WP_Date_Query 1086 1305 */ 1087 1306 public function test_validate_date_values_should_process_array_value_for_day() { 1088 1307 $p1 = self::factory()->post->create( array( 'post_date' => '2015-01-12 00:00:00' ) ); … … 1106 1325 /** 1107 1326 * @ticket 31001 1108 1327 * @expectedIncorrectUsage WP_Date_Query 1328 * 1329 * @covers WP_Date_Query 1109 1330 */ 1110 1331 public function test_validate_date_values_should_process_array_value_for_day_when_values_are_invalid() { 1111 1332 $p1 = self::factory()->post->create( array( 'post_date' => '2015-01-12 00:00:00' ) ); … … 1127 1348 $this->assertSame( array( $p1, $p2 ), $q->posts ); 1128 1349 } 1129 1350 1130 /** Helpers */ 1351 /** 1352 * Helpers 1353 */ 1131 1354 1132 1355 public function date_query_valid_columns_callback( $columns ) { 1133 1356 $columns[] = 'my_custom_column'; 1134 1357 return $columns; 1135 1358 } 1359 1360 public function mysql_datetime_input_provider() { 1361 return array( 1362 array( '2019-06-04T08:18:24+03:00', '2019-06-04 05:18:24' ), 1363 array( '2019-06-04T05:18:24+00:00', '2019-06-04 05:18:24' ), 1364 array( array(), current_time( 'Y' ) . '-01-01 00:00:00' ), 1365 array( array( 'year' => 2011 ), '2011-12-31 23:59:59', true ), 1366 array( array( 'year' => 2011 ), '2011-01-01 00:00:00' ), 1367 array( '2011', '2011-01-01 00:00:00' ), 1368 array( '2011-02', '2011-02-01 00:00:00' ), 1369 array( '2011-02-03', '2011-02-03 00:00:00' ), 1370 array( '2011-02-03 13:30', '2011-02-03 13:30:00' ), 1371 array( '2011-02-03 13:30:35', '2011-02-03 13:30:35' ), 1372 ); 1373 } 1374 1375 public function mysql_datetime_input_provider_custom_timezone() { 1376 return array( 1377 array( '2019-06-04T08:18:24+03:00', '2019-06-04 08:18:24' ), 1378 array( '2019-06-04T05:18:24+00:00', '2019-06-04 08:18:24' ), 1379 ); 1380 } 1136 1381 } -
date/theDate.php
52 52 53 53 the_date(); 54 54 get_the_date(); 55 55 56 56 the_modified_date(); 57 57 get_the_modified_date(); 58 58 … … 85 85 86 86 /** 87 87 * @ticket 33750 88 * 89 * @covers ::the_date 88 90 */ 89 91 function test_the_date() { 90 92 ob_start(); … … 125 127 126 128 /** 127 129 * @ticket 47354 130 * 131 * @covers ::the_weekday_date 128 132 */ 129 133 function test_the_weekday_date() { 130 134 ob_start(); -
date/wpDate.php
27 27 28 28 /** 29 29 * @ticket 28636 30 * 31 * @covers ::wp_date 30 32 */ 31 33 public function test_should_return_false_on_invalid_timestamp() { 32 34 $this->assertFalse( wp_date( DATE_RFC3339, 'invalid' ) ); … … 34 36 35 37 /** 36 38 * @ticket 48319 39 * 40 * @covers ::wp_date 37 41 */ 38 42 public function test_should_not_escape_localized_numbers() { 39 43 global $wp_locale; … … 48 52 49 53 /** 50 54 * @ticket 48319 55 * 56 * @covers ::wp_date 51 57 */ 52 58 public function test_should_keep_localized_slashes() { 53 59 global $wp_locale; -
date/wpTimezone.php
13 13 * 14 14 * @param float $gmt_offset Numeric offset from UTC. 15 15 * @param string $tz_name Expected timezone name. 16 * 17 * @covers ::wp_timezone_string 18 * @covers ::wp_timezone 16 19 */ 17 20 public function test_should_convert_gmt_offset( $gmt_offset, $tz_name ) { 18 21 delete_option( 'timezone_string' ); … … 27 30 28 31 /** 29 32 * @ticket 24730 33 * 34 * @covers ::wp_timezone_string 35 * @covers ::wp_timezone 30 36 */ 31 37 public function test_should_return_timezone_string() { 32 38 update_option( 'timezone_string', 'Europe/Kiev' ); -
date/xmlrpc.php
9 9 10 10 /** 11 11 * @ticket 30429 12 * 13 * @covers wp_xmlrpc_server::mw_newPost 14 * @covers IXR_Date 12 15 */ 13 16 public function test_date_new_post() { 14 17 $timezone = 'Europe/Kiev'; … … 127 130 128 131 /** 129 132 * @ticket 30429 133 * 134 * @covers wp_xmlrpc_server::mw_editPost 135 * @covers IXR_Date 130 136 */ 131 137 public function test_date_edit_post() { 132 138 $timezone = 'Europe/Kiev'; … … 194 200 195 201 /** 196 202 * @ticket 30429 203 * 204 * @covers wp_xmlrpc_server::wp_editComment 205 * @covers IXR_Date 197 206 */ 198 207 function test_date_edit_comment() { 199 208 $timezone = 'Europe/Kiev'; -
db/charset.php
476 476 /** 477 477 * @dataProvider data_strip_invalid_text 478 478 * @ticket 21212 479 * 480 * @covers wpdb::strip_invalid_text 479 481 */ 480 482 function test_strip_invalid_text( $data, $expected, $message ) { 481 483 $charset = self::$_wpdb->charset; … … 507 509 508 510 /** 509 511 * @ticket 21212 512 * 513 * @covers wpdb::process_fields 510 514 */ 511 515 function test_process_fields_failure() { 512 516 global $wpdb; … … 592 596 /** 593 597 * @dataProvider data_process_field_charsets 594 598 * @ticket 21212 599 * 600 * @covers wpdb::process_field_charsets 595 601 */ 596 602 function test_process_field_charsets( $data, $expected, $message ) { 597 603 $actual = self::$_wpdb->process_field_charsets( $data, $GLOBALS['wpdb']->posts ); … … 604 610 * 605 611 * @ticket 21212 606 612 * @depends test_process_field_charsets 613 * 614 * @covers wpdb::process_field_charsets 607 615 */ 608 616 function test_process_field_charsets_on_nonexistent_table() { 609 617 $data = array( … … 619 627 620 628 /** 621 629 * @ticket 21212 630 * 631 * @covers wpdb::check_ascii 622 632 */ 623 633 function test_check_ascii() { 624 634 $ascii = "\0\t\n\r '" . '!"#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'; … … 627 637 628 638 /** 629 639 * @ticket 21212 640 * 641 * @covers wpdb::check_ascii 630 642 */ 631 643 function test_check_ascii_false() { 632 644 $this->assertFalse( self::$_wpdb->check_ascii( 'ABCDEFGHIJKLMNOPQRSTUVWXYZ¡©«' ) ); … … 634 646 635 647 /** 636 648 * @ticket 21212 649 * 650 * @covers wpdb::strip_invalid_text_for_column 637 651 */ 638 652 function test_strip_invalid_text_for_column() { 639 653 global $wpdb; … … 742 756 /** 743 757 * @dataProvider data_test_get_table_charset 744 758 * @ticket 21212 759 * 760 * @covers wpdb::get_table_charset 745 761 */ 746 762 function test_get_table_charset( $drop, $create, $table, $expected_charset ) { 747 763 self::$_wpdb->query( $drop ); … … 782 798 /** 783 799 * @dataProvider data_test_get_column_charset 784 800 * @ticket 21212 801 * 802 * @covers wpdb::get_col_charset 785 803 */ 786 804 function test_get_column_charset( $drop, $create, $table, $expected_charset ) { 787 805 self::$_wpdb->query( $drop ); … … 804 822 /** 805 823 * @dataProvider data_test_get_column_charset 806 824 * @ticket 21212 825 * 826 * @covers wpdb::get_col_charset 807 827 */ 808 828 function test_get_column_charset_non_mysql( $drop, $create, $table, $columns ) { 809 829 self::$_wpdb->query( $drop ); … … 830 850 /** 831 851 * @dataProvider data_test_get_column_charset 832 852 * @ticket 33501 853 * 854 * @covers wpdb::get_col_charset 833 855 */ 834 856 function test_get_column_charset_is_mysql_undefined( $drop, $create, $table, $columns ) { 835 857 self::$_wpdb->query( $drop ); … … 889 911 /** 890 912 * @dataProvider data_strip_invalid_text_from_query 891 913 * @ticket 21212 914 * 915 * @covers wpdb::strip_invalid_text_from_query 892 916 */ 893 917 function test_strip_invalid_text_from_query( $create, $query, $expected, $drop ) { 894 918 self::$_wpdb->query( $drop ); … … 932 956 /** 933 957 * @dataProvider data_dont_strip_text_from_schema_queries 934 958 * @ticket 32104 959 * 960 * @covers wpdb::strip_invalid_text_from_query 935 961 */ 936 962 function test_dont_strip_text_from_schema_queries( $query ) { 937 963 $return = self::$_wpdb->strip_invalid_text_from_query( $query ); … … 1010 1036 /** 1011 1037 * @dataProvider data_table_collation_check 1012 1038 * @ticket 21212 1039 * 1040 * @covers wpdb::check_safe_collation 1013 1041 */ 1014 1042 function test_table_collation_check( $create, $expected, $query, $drop, $always_true ) { 1015 1043 self::$_wpdb->query( $drop ); … … 1026 1054 1027 1055 self::$_wpdb->query( $drop ); 1028 1056 } 1029 1057 1058 /* 1059 * @covers wpdb::strip_invalid_text_for_column 1060 */ 1030 1061 function test_strip_invalid_text_for_column_bails_if_ascii_input_too_long() { 1031 1062 global $wpdb; 1032 1063 … … 1041 1072 1042 1073 /** 1043 1074 * @ticket 32279 1075 * 1076 * @covers wpdb::strip_invalid_text_from_query 1044 1077 */ 1045 1078 function test_strip_invalid_text_from_query_cp1251_is_safe() { 1046 1079 $tablename = 'test_cp1251_query_' . rand_str( 5 ); … … 1058 1091 1059 1092 /** 1060 1093 * @ticket 34708 1094 * 1095 * @covers wpdb::strip_invalid_text_from_query 1061 1096 */ 1062 1097 function test_no_db_charset_defined() { 1063 1098 $tablename = 'test_cp1251_query_' . rand_str( 5 ); … … 1080 1115 1081 1116 /** 1082 1117 * @ticket 36649 1118 * 1119 * @covers wpdb::set_charset 1083 1120 */ 1084 1121 function test_set_charset_changes_the_connection_collation() { 1085 1122 self::$_wpdb->set_charset( self::$_wpdb->dbh, 'utf8', 'utf8_general_ci' ); -
dependencies/jquery.php
47 47 * @ticket 22896 48 48 * 49 49 * @expectedIncorrectUsage wp_deregister_script 50 * 51 * @covers ::wp_script_is 50 52 */ 51 53 function test_dont_allow_deregister_core_scripts_in_admin() { 52 54 set_current_screen( 'edit.php' ); … … 90 92 91 93 /** 92 94 * @ticket 28404 95 * 96 * @covers ::wp_script_is 93 97 */ 94 98 function test_wp_script_is_dep_enqueued() { 95 99 wp_enqueue_script( 'jquery-ui-accordion' ); -
dependencies/scripts.php
38 38 * Test versioning 39 39 * 40 40 * @ticket 11315 41 * 42 * @covers ::wp_print_scripts 41 43 */ 42 44 function test_wp_enqueue_script() { 43 45 wp_enqueue_script( 'no-deps-no-version', 'example.com', array() ); … … 59 61 60 62 /** 61 63 * @ticket 42804 64 * 65 * @covers ::wp_print_scripts 62 66 */ 63 67 function test_wp_enqueue_script_with_html5_support_does_not_contain_type_attribute() { 64 68 add_theme_support( 'html5', array( 'script' ) ); … … 79 83 * 80 84 * @global WP_Scripts $wp_scripts 81 85 * @ticket 16560 86 * 87 * @covers ::wp_enqueue_script 82 88 */ 83 89 public function test_protocols() { 84 90 // Init. … … 121 127 122 128 /** 123 129 * Test script concatenation. 130 * 131 * @covers ::_print_scripts 124 132 */ 125 133 public function test_script_concatenation() { 126 134 global $wp_scripts; … … 145 153 * Testing `wp_script_add_data` with the data key. 146 154 * 147 155 * @ticket 16024 156 * 157 * @covers ::wp_script_add_data 148 158 */ 149 159 function test_wp_script_add_data_with_data_key() { 150 160 // Enqueue and add data. … … 164 174 * Testing `wp_script_add_data` with the conditional key. 165 175 * 166 176 * @ticket 16024 177 * 178 * @covers ::wp_script_add_data 167 179 */ 168 180 function test_wp_script_add_data_with_conditional_key() { 169 181 // Enqueue and add conditional comments. … … 182 194 * Testing `wp_script_add_data` with both the data & conditional keys. 183 195 * 184 196 * @ticket 16024 197 * 198 * @covers ::wp_script_add_data 185 199 */ 186 200 function test_wp_script_add_data_with_data_and_conditional_keys() { 187 201 // Enqueue and add data plus conditional comments for both. … … 202 216 * Testing `wp_script_add_data` with an anvalid key. 203 217 * 204 218 * @ticket 16024 219 * 220 * @covers ::wp_script_add_data 205 221 */ 206 222 function test_wp_script_add_data_with_invalid_key() { 207 223 // Enqueue and add an invalid key. … … 220 236 * Testing 'wp_register_script' return boolean success/failure value. 221 237 * 222 238 * @ticket 31126 239 * 240 * @covers ::wp_register_script 223 241 */ 224 242 function test_wp_register_script() { 225 243 $this->assertTrue( wp_register_script( 'duplicate-handler', 'http://example.com' ) ); … … 228 246 229 247 /** 230 248 * @ticket 35229 249 * 250 * @covers ::wp_register_script 231 251 */ 232 252 function test_wp_register_script_with_handle_without_source() { 233 253 $expected = "<script type='text/javascript' src='http://example.com?ver=1' id='handle-one-js'></script>\n"; … … 244 264 245 265 /** 246 266 * @ticket 35643 267 * 268 * @covers ::wp_register_script 247 269 */ 248 270 function test_wp_enqueue_script_footer_alias() { 249 271 wp_register_script( 'foo', false, array( 'bar', 'baz' ), '1.0', true ); … … 264 286 * Test mismatch of groups in dependencies outputs all scripts in right order. 265 287 * 266 288 * @ticket 35873 289 * 290 * @covers WP_Dependencies::add 291 * @covers WP_Dependencies::enqueue 292 * @covers WP_Dependencies::do_items 267 293 */ 268 294 public function test_group_mismatch_in_deps() { 269 295 $scripts = new WP_Scripts; … … 308 334 309 335 /** 310 336 * @ticket 35873 337 * 338 * @covers ::wp_register_script 311 339 */ 312 340 function test_wp_register_script_with_dependencies_in_head_and_footer() { 313 341 wp_register_script( 'parent', '/parent.js', array( 'child-head' ), null, true ); // In footer. … … 329 357 330 358 /** 331 359 * @ticket 35956 360 * 361 * @covers ::wp_register_script 332 362 */ 333 363 function test_wp_register_script_with_dependencies_in_head_and_footer_in_reversed_order() { 334 364 wp_register_script( 'child-head', '/child-head.js', array(), null, false ); // In head. … … 350 380 351 381 /** 352 382 * @ticket 35956 383 * 384 * @covers ::wp_register_script 353 385 */ 354 386 function test_wp_register_script_with_dependencies_in_head_and_footer_in_reversed_order_and_two_parent_scripts() { 355 387 wp_register_script( 'grandchild-head', '/grandchild-head.js', array(), null, false ); // In head. … … 381 413 382 414 /** 383 415 * @ticket 14853 416 * 417 * @covers ::wp_add_inline_script 384 418 */ 385 419 function test_wp_add_inline_script_returns_bool() { 386 420 $this->assertFalse( wp_add_inline_script( 'test-example', 'console.log("before");', 'before' ) ); … … 390 424 391 425 /** 392 426 * @ticket 14853 427 * 428 * @covers ::wp_add_inline_script 393 429 */ 394 430 function test_wp_add_inline_script_unknown_handle() { 395 431 $this->assertFalse( wp_add_inline_script( 'test-invalid', 'console.log("before");', 'before' ) ); … … 398 434 399 435 /** 400 436 * @ticket 14853 437 * 438 * @covers ::wp_add_inline_script 401 439 */ 402 440 function test_wp_add_inline_script_before() { 403 441 wp_enqueue_script( 'test-example', 'example.com', array(), null ); … … 411 449 412 450 /** 413 451 * @ticket 14853 452 * 453 * @covers ::wp_add_inline_script 414 454 */ 415 455 function test_wp_add_inline_script_after() { 416 456 wp_enqueue_script( 'test-example', 'example.com', array(), null ); … … 424 464 425 465 /** 426 466 * @ticket 14853 467 * 468 * @covers ::wp_add_inline_script 427 469 */ 428 470 function test_wp_add_inline_script_before_and_after() { 429 471 wp_enqueue_script( 'test-example', 'example.com', array(), null ); … … 439 481 440 482 /** 441 483 * @ticket 44551 484 * 485 * @covers ::wp_add_inline_script 442 486 */ 443 487 function test_wp_add_inline_script_before_for_handle_without_source() { 444 488 wp_register_script( 'test-example', '' ); … … 452 496 453 497 /** 454 498 * @ticket 44551 499 * 500 * @covers ::wp_add_inline_script 455 501 */ 456 502 function test_wp_add_inline_script_after_for_handle_without_source() { 457 503 wp_register_script( 'test-example', '' ); … … 465 511 466 512 /** 467 513 * @ticket 44551 514 * 515 * @covers ::wp_add_inline_script 468 516 */ 469 517 function test_wp_add_inline_script_before_and_after_for_handle_without_source() { 470 518 wp_register_script( 'test-example', '' ); … … 480 528 481 529 /** 482 530 * @ticket 14853 531 * 532 * @covers ::wp_add_inline_script 483 533 */ 484 534 function test_wp_add_inline_script_multiple() { 485 535 wp_enqueue_script( 'test-example', 'example.com', array(), null ); … … 497 547 498 548 /** 499 549 * @ticket 14853 550 * 551 * @covers ::wp_add_inline_script 500 552 */ 501 553 function test_wp_add_inline_script_localized_data_is_added_first() { 502 554 wp_enqueue_script( 'test-example', 'example.com', array(), null ); … … 514 566 515 567 /** 516 568 * @ticket 14853 569 * 570 * @covers ::wp_add_inline_script 517 571 */ 518 572 public function test_wp_add_inline_script_before_with_concat() { 519 573 global $wp_scripts; … … 540 594 541 595 /** 542 596 * @ticket 14853 597 * @covers ::wp_add_inline_script 543 598 */ 544 599 public function test_wp_add_inline_script_before_with_concat2() { 545 600 global $wp_scripts; … … 564 619 565 620 /** 566 621 * @ticket 14853 622 * 623 * @covers ::wp_add_inline_script 567 624 */ 568 625 public function test_wp_add_inline_script_after_with_concat() { 569 626 global $wp_scripts; … … 592 649 593 650 /** 594 651 * @ticket 14853 652 * 653 * @covers ::wp_add_inline_script 595 654 */ 596 655 public function test_wp_add_inline_script_after_and_before_with_concat_and_conditional() { 597 656 global $wp_scripts; … … 622 681 623 682 /** 624 683 * @ticket 36392 684 * 685 * @covers ::wp_add_inline_script 625 686 */ 626 687 public function test_wp_add_inline_script_after_with_concat_and_core_dependency() { 627 688 global $wp_scripts; … … 647 708 648 709 /** 649 710 * @ticket 36392 711 * 712 * @covers ::wp_add_inline_script 650 713 */ 651 714 public function test_wp_add_inline_script_after_with_concat_and_conditional_and_core_dependency() { 652 715 global $wp_scripts; … … 675 738 676 739 /** 677 740 * @ticket 36392 741 * 742 * @covers ::wp_add_inline_script 678 743 */ 679 744 public function test_wp_add_inline_script_before_with_concat_and_core_dependency() { 680 745 global $wp_scripts; … … 701 766 702 767 /** 703 768 * @ticket 36392 769 * 770 * @covers ::wp_add_inline_script 704 771 */ 705 772 public function test_wp_add_inline_script_before_after_concat_with_core_dependency() { 706 773 global $wp_scripts; … … 757 824 758 825 /** 759 826 * @ticket 36392 827 * 828 * @covers ::wp_add_inline_script 760 829 */ 761 830 public function test_wp_add_inline_script_customize_dependency() { 762 831 global $wp_scripts; … … 785 854 786 855 /** 787 856 * @ticket 36392 857 * 858 * @covers ::wp_add_inline_script 788 859 */ 789 860 public function test_wp_add_inline_script_after_for_core_scripts_with_concat_is_limited_and_falls_back_to_no_concat() { 790 861 global $wp_scripts; … … 810 881 811 882 /** 812 883 * @ticket 36392 884 * 885 * @covers ::wp_add_inline_script 813 886 */ 814 887 public function test_wp_add_inline_script_before_third_core_script_prints_two_concat_scripts() { 815 888 global $wp_scripts; … … 834 907 835 908 /** 836 909 * @ticket 45103 910 * 911 * @covers ::wp_set_script_translations 837 912 */ 838 913 public function test_wp_set_script_translations() { 839 914 wp_register_script( 'wp-i18n', '/wp-includes/js/dist/wp-i18n.js', array(), null ); … … 861 936 862 937 /** 863 938 * @ticket 45103 939 * 940 * @covers ::wp_set_script_translations 864 941 */ 865 942 public function test_wp_set_script_translations_for_plugin() { 866 943 wp_register_script( 'wp-i18n', '/wp-includes/js/dist/wp-i18n.js', array(), null ); … … 888 965 889 966 /** 890 967 * @ticket 45103 968 * 969 * @covers ::wp_set_script_translations 891 970 */ 892 971 public function test_wp_set_script_translations_for_theme() { 893 972 wp_register_script( 'wp-i18n', '/wp-includes/js/dist/wp-i18n.js', array(), null ); … … 915 994 916 995 /** 917 996 * @ticket 45103 997 * 998 * @covers ::wp_set_script_translations 918 999 */ 919 1000 public function test_wp_set_script_translations_with_handle_file() { 920 1001 wp_register_script( 'wp-i18n', '/wp-includes/js/dist/wp-i18n.js', array(), null ); … … 942 1023 943 1024 /** 944 1025 * @ticket 45103 1026 * 1027 * @covers ::wp_set_script_translations 945 1028 */ 946 1029 public function test_wp_set_script_translations_i18n_dependency() { 947 1030 global $wp_scripts; … … 957 1040 958 1041 /** 959 1042 * @ticket 45103 1043 * 1044 * @covers ::wp_set_script_translations 960 1045 */ 961 1046 public function test_wp_set_script_translations_when_translation_file_does_not_exist() { 962 1047 wp_register_script( 'wp-i18n', '/wp-includes/js/dist/wp-i18n.js', array(), null ); … … 984 1069 985 1070 /** 986 1071 * @ticket 45103 1072 * 1073 * @covers ::wp_set_script_translations 987 1074 */ 988 1075 public function test_wp_set_script_translations_after_register() { 989 1076 wp_register_script( 'wp-i18n', '/wp-includes/js/dist/wp-i18n.js', array(), null ); … … 1013 1100 1014 1101 /** 1015 1102 * @ticket 45103 1103 * 1104 * @covers ::wp_set_script_translations 1016 1105 */ 1017 1106 public function test_wp_set_script_translations_dependency() { 1018 1107 wp_register_script( 'wp-i18n', '/wp-includes/js/dist/wp-i18n.js', array(), null ); … … 1401 1490 array_keys( $wp_enqueue_code_editor['htmlhint'] ) 1402 1491 ); 1403 1492 } 1404 1493 1405 1494 function test_no_source_mapping() { 1406 1495 $all_files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( dirname( ABSPATH ) . '/build/' ) ); 1407 1496 $js_files = new RegexIterator( $all_files, '/\.js$/' ); -
dependencies/styles.php
50 50 * Test versioning 51 51 * 52 52 * @ticket 11315 53 * 54 * @covers ::wp_enqueue_style 53 55 */ 54 56 function test_wp_enqueue_style() { 55 57 wp_enqueue_style( 'no-deps-no-version', 'example.com' ); … … 71 73 72 74 /** 73 75 * @ticket 42804 76 * 77 * @covers ::wp_enqueue_style 74 78 */ 75 79 function test_wp_enqueue_style_with_html5_support_does_not_contain_type_attribute() { 76 80 add_theme_support( 'html5', array( 'style' ) ); … … 91 95 * 92 96 * @global WP_Styles $wp_styles 93 97 * @ticket 16560 98 * 99 * @covers ::wp_enqueue_style 94 100 */ 95 101 public function test_protocols() { 96 102 // Init. … … 135 141 * Test if inline styles work 136 142 * 137 143 * @ticket 24813 144 * 145 * @covers ::wp_add_inline_style 138 146 */ 139 147 public function test_inline_styles() { 140 148 … … 159 167 * 160 168 * @global WP_Styles $wp_styles 161 169 * @ticket 24813 170 * 171 * @covers ::wp_add_inline_style 162 172 */ 163 173 public function test_inline_styles_concat() { 164 174 … … 188 198 * Test if multiple inline styles work 189 199 * 190 200 * @ticket 24813 201 * 202 * @covers ::wp_add_inline_style 191 203 */ 192 204 public function test_multiple_inline_styles() { 193 205 … … 219 231 * 220 232 * @expectedIncorrectUsage wp_add_inline_style 221 233 * @ticket 24813 234 * 235 * @covers ::wp_add_inline_style 222 236 */ 223 237 public function test_plugin_doing_inline_styles_wrong() { 224 238 … … 243 257 * Test to make sure <style> tags aren't output if there are no inline styles. 244 258 * 245 259 * @ticket 24813 260 * 261 * @covers ::wp_enqueue_style 246 262 */ 247 263 public function test_unnecessary_style_tags() { 248 264 … … 257 273 /** 258 274 * Test to make sure that inline styles attached to conditional 259 275 * stylesheets are also conditional. 276 * 277 * @covers ::wp_enqueue_style 278 * @covers ::wp_style_add_data 279 * @covers ::wp_add_inline_style 260 280 */ 261 281 public function test_conditional_inline_styles_are_also_conditional() { 262 282 $expected = <<<CSS … … 279 299 * Testing 'wp_register_style' return boolean success/failure value. 280 300 * 281 301 * @ticket 31126 302 * 303 * @covers ::wp_register_style 282 304 */ 283 305 function test_wp_register_style() { 284 306 $this->assertTrue( wp_register_style( 'duplicate-handler', 'http://example.com' ) ); … … 287 309 288 310 /** 289 311 * @ticket 35229 312 * 313 * @covers ::wp_add_inline_style 290 314 */ 291 315 function test_wp_add_inline_style_for_handle_without_source() { 292 316 $style = 'a { color: blue; }'; … … 310 334 /** 311 335 * @ticket 35921 312 336 * @dataProvider data_styles_with_media 337 * 338 * @covers ::wp_enqueue_style 313 339 */ 314 340 function test_wp_enqueue_style_with_media( $expected, $media ) { 315 341 wp_enqueue_style( 'handle', 'http://example.com', array(), 1, $media ); … … 349 375 * Tests that visual block styles are enqueued in the editor even when there is not theme support for 'wp-block-styles'. 350 376 * 351 377 * Visual block styles should always be enqueued when editing to avoid the appearance of a broken editor. 378 * 379 * @covers ::wp_enqueue_style 352 380 */ 353 381 function test_block_styles_for_editing_without_theme_support() { 354 382 // Confirm we are without theme support by default. … … 365 393 * Tests that visual block styles are enqueued when there is theme support for 'wp-block-styles'. 366 394 * 367 395 * Visual block styles should always be enqueued when editing to avoid the appearance of a broken editor. 396 * 397 * @covers ::wp_common_block_scripts_and_styles 368 398 */ 369 399 function test_block_styles_for_editing_with_theme_support() { 370 400 add_theme_support( 'wp-block-styles' ); … … 381 411 * 382 412 * Visual block styles should not be enqueued unless a theme opts in. 383 413 * This way we avoid style conflicts with existing themes. 414 * 415 * @covers ::wp_enqueue_style 384 416 */ 385 417 function test_no_block_styles_for_viewing_without_theme_support() { 386 418 // Confirm we are without theme support by default. … … 397 429 * Tests that visual block styles are enqueued for viewing when there is theme support for 'wp-block-styles'. 398 430 * 399 431 * Visual block styles should be enqueued when a theme opts in. 432 * 433 * @covers ::wp_common_block_scripts_and_styles 400 434 */ 401 435 function test_block_styles_for_viewing_with_theme_support() { 402 436 add_theme_support( 'wp-block-styles' );