Ticket #39265: d_folders.patch
File d_folders.patch, 57.9 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 ); … … 30 34 $timestamp = time(); 31 35 $wp_timestamp = $timestamp + 6 * HOUR_IN_SECONDS; 32 36 33 37 $this->assertEquals( strtotime( gmdate( $format ) ), strtotime( current_time( 'mysql', true ) ), 'The dates should be equal', 2 ); 34 38 $this->assertEquals( strtotime( gmdate( $format, $wp_timestamp ) ), strtotime( current_time( 'mysql' ) ), 'The dates should be equal', 2 ); 35 39 } 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 94 /* @var WP_Locale $locale */ … … 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'; … … 113 140 $this->assertSame( $datetime->format( $timezone_formats ), date_i18n( $timezone_formats ) ); 114 141 } 115 142 116 143 /** 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; … … 59 61 60 62 $this->assertSame( $output, $declined_date ); 61 63 } 62 64 65 63 66 public function filter__enable_months_names_declension( $translation, $text, $context ) { 64 67 if ( 'decline months names: on or off' === $context ) { 65 68 $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 * Test WP_Date_Query handling of 'NOT BETWEEN' compare value 302 * 303 * @covers WP_Date_Query 304 */ 220 305 public function test_get_compare_not_between() { 221 306 $q = new WP_Date_Query( array() ); 222 307 223 308 $found = $q->get_compare( 224 309 array( 225 'compare' => ' BETWEEN',310 'compare' => 'NOT BETWEEN', 226 311 ) 227 312 ); 228 $this->assertSame( ' BETWEEN', $found );313 $this->assertSame( 'NOT BETWEEN', $found ); 229 314 } 230 315 316 /* 317 * Test WP_Date_Query validation of post_date column 318 * 319 * @covers WP_Date_Query::validate_column 320 */ 231 321 public function test_validate_column_post_date() { 232 322 global $wpdb; 233 323 $q = new WP_Date_Query( array() ); … … 234 324 235 325 $this->assertSame( $wpdb->posts . '.post_date', $q->validate_column( 'post_date' ) ); 236 326 } 237 327 328 /* 329 * Test WP_Date_Query validation of post_date_gmt column 330 * 331 * @covers WP_Date_Query::validate_column 332 */ 238 333 public function test_validate_column_post_date_gmt() { 239 334 global $wpdb; 240 335 $q = new WP_Date_Query( array() ); … … 241 336 242 337 $this->assertSame( $wpdb->posts . '.post_date_gmt', $q->validate_column( 'post_date_gmt' ) ); 243 338 } 244 339 340 /* 341 * Test WP_Date_Query validation of post_modified column 342 * 343 * @covers WP_Date_Query::validate_column 344 */ 245 345 public function test_validate_column_post_modified() { 246 346 global $wpdb; 247 347 $q = new WP_Date_Query( array() ); … … 248 348 249 349 $this->assertSame( $wpdb->posts . '.post_modified', $q->validate_column( 'post_modified' ) ); 250 350 } 251 351 352 /* 353 * Test WP_Date_Query validation of post_modified_gmt column 354 * 355 * @covers WP_Date_Query::validate_column 356 */ 252 357 public function test_validate_column_post_modified_gmt() { 253 358 global $wpdb; 254 359 $q = new WP_Date_Query( array() ); … … 255 360 256 361 $this->assertSame( $wpdb->posts . '.post_modified_gmt', $q->validate_column( 'post_modified_gmt' ) ); 257 362 } 258 363 364 /* 365 * Test WP_Date_Query validation of comment_date column 366 * 367 * @covers WP_Date_Query::validate_column 368 */ 259 369 public function test_validate_column_comment_date() { 260 370 global $wpdb; 261 371 $q = new WP_Date_Query( array() ); … … 262 372 263 373 $this->assertSame( $wpdb->comments . '.comment_date', $q->validate_column( 'comment_date' ) ); 264 374 } 265 375 376 /* 377 * Test WP_Date_Query validation of comment_date_gmt column 378 * 379 * @covers WP_Date_Query::validate_column 380 */ 266 381 public function test_validate_column_comment_date_gmt() { 267 382 global $wpdb; 268 383 $q = new WP_Date_Query( array() ); … … 269 384 270 385 $this->assertSame( $wpdb->comments . '.comment_date_gmt', $q->validate_column( 'comment_date_gmt' ) ); 271 386 } 272 387 388 /* 389 * Test WP_Date_Query validation of an invalid post_date value 390 * 391 * @covers WP_Date_Query::validate_column 392 */ 273 393 public function test_validate_column_invalid() { 274 394 global $wpdb; 275 395 $q = new WP_Date_Query( array() ); … … 279 399 280 400 /** 281 401 * @ticket 25775 402 * 403 * @covers WP_Date_Query::validate_column 282 404 */ 283 405 public function test_validate_column_with_date_query_valid_columns_filter() { 284 406 $q = new WP_Date_Query( array() ); … … 292 414 293 415 /** 294 416 * @ticket 25775 417 * 418 * @covers WP_Date_Query::validate_column 295 419 */ 296 420 public function test_validate_column_prefixed_column_name() { 297 421 $q = new WP_Date_Query( array() ); … … 301 425 302 426 /** 303 427 * @ticket 25775 428 * 429 * @covers WP_Date_Query::validate_column 304 430 */ 305 431 public function test_validate_column_prefixed_column_name_with_illegal_characters() { 306 432 $q = new WP_Date_Query( array() ); … … 307 433 308 434 $this->assertSame( 'foo.bar', $q->validate_column( 'f"\'oo\/.b;:()ar' ) ); 309 435 } 310 436 437 /* 438 * Test WP_Date_Query::build_value when passed a null value 439 * 440 * @covers WP_Date_Query::build_value 441 */ 311 442 public function test_build_value_value_null() { 312 443 global $wpdb; 313 444 $q = new WP_Date_Query( array() ); … … 317 448 318 449 /** 319 450 * @ticket 29801 451 * 452 * @covers WP_Date_Query::build_value 320 453 */ 321 454 public function test_build_value_compare_in() { 322 455 $q = new WP_Date_Query( array() ); … … 340 473 341 474 /** 342 475 * @ticket 29801 476 * 477 * @covers WP_Date_Query::build_value 343 478 */ 344 479 public function test_build_value_compare_not_in() { 345 480 $q = new WP_Date_Query( array() ); … … 360 495 $found = $q->build_value( 'NOT IN', array( 1, 'foo', 7 ) ); 361 496 $this->assertSame( '(1,7)', $found ); 362 497 } 363 498 499 /* 500 * Test WP_Date_Query::build_value when passed the same values as compare BETWEEN 501 * 502 * @covers WP_Date_Query::build_value 503 */ 364 504 public function test_build_value_compare_between_single_integer() { 365 505 $q = new WP_Date_Query( array() ); 366 506 … … 370 510 371 511 /** 372 512 * @ticket 29801 513 * 514 * @covers WP_Date_Query::build_value 373 515 */ 374 516 public function test_build_value_compare_between_single_non_numeric() { 375 517 $q = new WP_Date_Query( array() ); … … 380 522 381 523 /** 382 524 * @ticket 29801 525 * 526 * @covers WP_Date_Query::build_value 383 527 */ 384 528 public function test_build_value_compare_between_array_with_other_than_two_items() { 385 529 $q = new WP_Date_Query( array() ); … … 390 534 391 535 /** 392 536 * @ticket 29801 537 * 538 * @covers WP_Date_Query::build_value 393 539 */ 394 540 public function test_build_value_compare_between_incorrect_array_key() { 395 541 $q = new WP_Date_Query( array() ); … … 407 553 408 554 /** 409 555 * @ticket 29801 556 * 557 * @covers WP_Date_Query::build_value 410 558 */ 411 559 public function test_build_value_compare_between_array_contains_non_numeric() { 412 560 $q = new WP_Date_Query( array() ); … … 431 579 432 580 /** 433 581 * @ticket 29801 582 * 583 * @covers WP_Date_Query::build_value 434 584 */ 435 585 public function test_build_value_compare_not_between_single_non_numeric() { 436 586 $q = new WP_Date_Query( array() ); … … 441 591 442 592 /** 443 593 * @ticket 29801 594 * 595 * @covers WP_Date_Query::build_value 444 596 */ 445 597 public function test_build_value_compare_not_between_array_with_other_than_two_items() { 446 598 $q = new WP_Date_Query( array() ); … … 451 603 452 604 /** 453 605 * @ticket 29801 606 * 607 * @covers WP_Date_Query::build_value 454 608 */ 455 609 public function test_build_value_compare_not_between_incorrect_array_key() { 456 610 $q = new WP_Date_Query( array() ); … … 468 622 469 623 /** 470 624 * @ticket 29801 625 * 626 * @covers WP_Date_Query::build_value 471 627 */ 472 628 public function test_build_value_compare_not_between_array_contains_non_numeric() { 473 629 $q = new WP_Date_Query( array() ); … … 475 631 $found = $q->build_value( 'NOT BETWEEN', array( 2, 'foo' ) ); 476 632 $this->assertFalse( $found ); 477 633 } 478 634 635 /** 636 * 637 * @covers WP_Date_Query::build_value 638 */ 479 639 public function test_build_value_compare_not_between() { 480 640 $q = new WP_Date_Query( array() ); 481 641 … … 482 642 $found = $q->build_value( 'NOT BETWEEN', array( 2, 3 ) ); 483 643 $this->assertSame( '2 AND 3', $found ); 484 644 } 485 645 646 /** 647 * 648 * @covers WP_Date_Query::build_value 649 */ 486 650 public function test_build_value_compare_default_value_integer() { 487 651 $q = new WP_Date_Query( array() ); 488 652 … … 492 656 493 657 /** 494 658 * @ticket 29801 659 * 660 * @covers WP_Date_Query::build_value 495 661 */ 496 662 public function test_build_value_compare_default_value_non_numeric() { 497 663 $q = new WP_Date_Query( array() ); … … 499 665 $found = $q->build_value( 'foo', 'foo' ); 500 666 $this->assertFalse( $found ); 501 667 } 502 668 669 /** 670 * 671 * @covers WP_Date_Query::build_mysql_datetime 672 */ 503 673 public function test_build_mysql_datetime_datetime_non_array() { 504 674 $q = new WP_Date_Query( array() ); 505 675 … … 517 687 * @param array|string $datetime Array or string date input. 518 688 * @param string $expected Expected built result. 519 689 * @param bool $default_to_max Flag to default missing values to max. 690 * 691 * @covers WP_Date_Query::build_mysql_datetime 520 692 */ 521 693 public function test_build_mysql_datetime( $datetime, $expected, $default_to_max = false ) { 522 694 $q = new WP_Date_Query( array() ); … … 550 722 * @param array|string $datetime Array or string date input. 551 723 * @param string $expected Expected built result. 552 724 * @param bool $default_to_max Flag to default missing values to max. 725 * 726 * @covers WP_Date_Query::build_mysql_datetime 553 727 */ 554 728 public function test_build_mysql_datetime_with_custom_timezone( $datetime, $expected, $default_to_max = false ) { 555 729 update_option( 'timezone_string', 'Europe/Kiev' ); … … 572 746 573 747 /** 574 748 * @ticket 41782 749 * 750 * @covers WP_Date_Query::build_mysql_datetime 575 751 */ 576 752 public function test_build_mysql_datetime_with_relative_date() { 577 753 update_option( 'timezone_string', 'Europe/Kiev' ); … … 585 761 $message = "Expected {$expected}, got {$found}"; 586 762 $this->assertEquals( strtotime( $expected ), strtotime( $found ), $message, 10 ); 587 763 } 588 764 765 /* 766 * 767 * @covers WP_Date_Query::build_time_query 768 */ 589 769 public function test_build_time_query_insufficient_time_values() { 590 770 $q = new WP_Date_Query( array() ); 591 771 … … 594 774 595 775 /** 596 776 * @ticket 34228 777 * 778 * @covers WP_Date_Query::build_time_query 597 779 */ 598 780 public function test_build_time_query_should_not_discard_hour_0() { 599 781 global $wpdb; … … 603 785 604 786 $this->assertContains( '%H', $wpdb->remove_placeholder_escape( $found ) ); 605 787 } 606 788 789 /** 790 * @covers WP_Date_Query::build_time_query 791 */ 607 792 public function test_build_time_query_compare_in() { 608 793 $q = new WP_Date_Query( array() ); 609 794 … … 619 804 $found = $q->build_time_query( 'post_date', 'IN', array( 1, 2 ), array( 3, 4, 5 ), 6 ); 620 805 $this->assertSame( 'HOUR( post_date ) IN (1,2) AND MINUTE( post_date ) IN (3,4,5) AND SECOND( post_date ) IN (6)', $found ); 621 806 } 622 807 808 /** 809 * @covers WP_Date_Query::build_time_query 810 */ 623 811 public function test_build_time_query_compare_not_in() { 624 812 $q = new WP_Date_Query( array() ); 625 813 … … 635 823 $found = $q->build_time_query( 'post_date', 'NOT IN', array( 1, 2 ), array( 3, 4, 5 ), 6 ); 636 824 $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 825 } 638 826 827 /** 828 * @covers WP_Date_Query::build_time_query 829 */ 639 830 public function test_build_time_query_compare_between() { 640 831 $q = new WP_Date_Query( array() ); 641 832 … … 651 842 $found = $q->build_time_query( 'post_date', 'BETWEEN', array( 1, 2 ), array( 3, 4 ), array( 6, 7 ) ); 652 843 $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 844 } 654 845 846 /** 847 * @covers WP_Date_Query::build_time_query 848 */ 655 849 public function test_build_time_query_compare_not_between() { 656 850 $q = new WP_Date_Query( array() ); 657 851 … … 667 861 $found = $q->build_time_query( 'post_date', 'NOT BETWEEN', array( 1, 2 ), array( 3, 4 ), array( 6, 7 ) ); 668 862 $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 863 } 670 864 865 /** 866 * @covers WP_Date_Query::build_time_query 867 */ 671 868 public function test_build_time_query_hour_only() { 672 869 $q = new WP_Date_Query( array() ); 673 870 … … 681 878 $found = $q->build_time_query( 'post_date', '=', null, 5 ); 682 879 $this->assertSame( 'MINUTE( post_date ) = 5', $found ); 683 880 } 684 881 882 /** 883 * @covers WP_Date_Query::build_time_query 884 */ 685 885 public function test_build_time_query_second_only() { 686 886 $q = new WP_Date_Query( array() ); 687 887 … … 695 895 $found = $q->build_time_query( 'post_date', '=', 5, null, 5 ); 696 896 $this->assertFalse( $found ); 697 897 } 698 898 899 /** 900 * @covers WP_Date_Query::build_time_query 901 * @covers wpdb::remove_placeholder_escape 902 */ 699 903 public function test_build_time_query_hour_minute() { 700 904 global $wpdb; 701 905 $q = new WP_Date_Query( array() ); … … 706 910 // varying precision on different PHP installations. 707 911 $this->assertRegExp( "/DATE_FORMAT\( post_date, '%H\.%i' \) = 5\.150*/", $wpdb->remove_placeholder_escape( $found ) ); 708 912 } 709 913 914 /** 915 * @covers WP_Date_Query::build_time_query 916 * @covers wpdb::remove_placeholder_escape 917 */ 710 918 public function test_build_time_query_hour_minute_second() { 711 919 global $wpdb; 712 920 $q = new WP_Date_Query( array() ); … … 717 925 // varying precision on different PHP installations. 718 926 $this->assertRegExp( "/DATE_FORMAT\( post_date, '%H\.%i%s' \) = 5\.15350*/", $wpdb->remove_placeholder_escape( $found ) ); 719 927 } 720 928 929 /** 930 * @covers WP_Date_Query::build_time_query 931 * @covers wpdb::remove_placeholder_escape 932 */ 721 933 public function test_build_time_query_minute_second() { 722 934 global $wpdb; 723 935 $q = new WP_Date_Query( array() ); … … 732 944 /** 733 945 * @ticket 25834 734 946 * @expectedIncorrectUsage WP_Date_Query 947 * 948 * @covers WP_Date_Query::validate_date_values 735 949 */ 736 950 public function test_validate_date_query_before_after() { 737 951 // Valid values. … … 779 993 /** 780 994 * @ticket 25834 781 995 * @expectedIncorrectUsage WP_Date_Query 996 * 997 * @covers WP_Date_Query::validate_date_values 782 998 */ 783 999 public function test_validate_date_query_before_after_with_month() { 784 1000 // Both are valid. … … 825 1041 /** 826 1042 * @ticket 25834 827 1043 * @expectedIncorrectUsage WP_Date_Query 1044 * 1045 * @covers WP_Date_Query::validate_date_values 828 1046 */ 829 1047 public function test_validate_date_values_week() { 830 1048 // Valid values. … … 878 1096 /** 879 1097 * @ticket 25834 880 1098 * @expectedIncorrectUsage WP_Date_Query 1099 * 1100 * @covers WP_Date_Query::validate_date_values 881 1101 */ 882 1102 public function test_validate_date_values_month() { 883 1103 // Valid values. … … 896 1116 /** 897 1117 * @ticket 25834 898 1118 * @expectedIncorrectUsage WP_Date_Query 1119 * 1120 * @covers WP_Date_Query::validate_date_values 899 1121 */ 900 1122 public function test_validate_date_values_day() { 901 1123 // Valid values. … … 953 1175 /** 954 1176 * @ticket 25834 955 1177 * @expectedIncorrectUsage WP_Date_Query 1178 * 1179 * @covers WP_Date_Query::validate_date_values 956 1180 */ 957 1181 public function test_validate_date_values_hour() { 958 1182 // Valid values. … … 971 1195 /** 972 1196 * @ticket 25834 973 1197 * @expectedIncorrectUsage WP_Date_Query 1198 * 1199 * @covers WP_Date_Query::validate_date_values 974 1200 */ 975 1201 public function test_validate_date_values_minute() { 976 1202 // Valid values. … … 989 1215 /** 990 1216 * @ticket 25834 991 1217 * @expectedIncorrectUsage WP_Date_Query 1218 * 1219 * @covers WP_Date_Query::validate_date_values 992 1220 */ 993 1221 public function test_validate_date_values_second() { 994 1222 // Valid values. … … 1008 1236 /** 1009 1237 * @ticket 25834 1010 1238 * @expectedIncorrectUsage WP_Date_Query 1239 * 1240 * @covers WP_Date_Query::validate_date_values 1011 1241 */ 1012 1242 public function test_validate_date_values_day_of_week() { 1013 1243 // Valid values. … … 1026 1256 /** 1027 1257 * @ticket 28063 1028 1258 * @expectedIncorrectUsage WP_Date_Query 1259 * 1260 * @covers WP_Date_Query::validate_date_values 1029 1261 */ 1030 1262 public function test_validate_date_values_day_of_week_iso() { 1031 1263 // Valid values. … … 1044 1276 /** 1045 1277 * @ticket 25834 1046 1278 * @expectedIncorrectUsage WP_Date_Query 1279 * 1280 * @covers WP_Date_Query::validate_date_values 1047 1281 */ 1048 1282 public function test_validate_date_values_day_of_year() { 1049 1283 // Valid values. … … 1061 1295 1062 1296 /** 1063 1297 * @ticket 31001 1298 * 1299 * @covers WP_Date_Query 1064 1300 */ 1065 1301 public function test_validate_date_values_should_process_array_value_for_year() { 1066 1302 $p1 = self::factory()->post->create( array( 'post_date' => '2015-01-12 00:00:00' ) ); … … 1083 1319 1084 1320 /** 1085 1321 * @ticket 31001 1322 * 1323 * @covers WP_Date_Query 1086 1324 */ 1087 1325 public function test_validate_date_values_should_process_array_value_for_day() { 1088 1326 $p1 = self::factory()->post->create( array( 'post_date' => '2015-01-12 00:00:00' ) ); … … 1106 1344 /** 1107 1345 * @ticket 31001 1108 1346 * @expectedIncorrectUsage WP_Date_Query 1347 * 1348 * @covers WP_Date_Query 1109 1349 */ 1110 1350 public function test_validate_date_values_should_process_array_value_for_day_when_values_are_invalid() { 1111 1351 $p1 = self::factory()->post->create( array( 'post_date' => '2015-01-12 00:00:00' ) ); -
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' );