Changeset 29933 for trunk/tests/phpunit/tests/date/query.php
- Timestamp:
- 10/17/2014 01:19:03 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/date/query.php
r29925 r29933 202 202 203 203 public function test_validate_column_post_date() { 204 $q = new WP_Date_Query( array() ); 205 206 $this->assertSame( 'post_date', $q->validate_column( 'post_date' ) ); 204 global $wpdb; 205 $q = new WP_Date_Query( array() ); 206 207 $this->assertSame( $wpdb->posts . '.post_date', $q->validate_column( 'post_date' ) ); 207 208 } 208 209 209 210 public function test_validate_column_post_date_gmt() { 210 $q = new WP_Date_Query( array() ); 211 212 $this->assertSame( 'post_date_gmt', $q->validate_column( 'post_date_gmt' ) ); 211 global $wpdb; 212 $q = new WP_Date_Query( array() ); 213 214 $this->assertSame( $wpdb->posts . '.post_date_gmt', $q->validate_column( 'post_date_gmt' ) ); 213 215 } 214 216 215 217 public function test_validate_column_post_modified() { 216 $q = new WP_Date_Query( array() ); 217 218 $this->assertSame( 'post_modified', $q->validate_column( 'post_modified' ) ); 218 global $wpdb; 219 $q = new WP_Date_Query( array() ); 220 221 $this->assertSame( $wpdb->posts . '.post_modified', $q->validate_column( 'post_modified' ) ); 219 222 } 220 223 221 224 public function test_validate_column_post_modified_gmt() { 222 $q = new WP_Date_Query( array() ); 223 224 $this->assertSame( 'post_modified_gmt', $q->validate_column( 'post_modified_gmt' ) ); 225 global $wpdb; 226 $q = new WP_Date_Query( array() ); 227 228 $this->assertSame( $wpdb->posts . '.post_modified_gmt', $q->validate_column( 'post_modified_gmt' ) ); 225 229 } 226 230 227 231 public function test_validate_column_comment_date() { 228 $q = new WP_Date_Query( array() ); 229 230 $this->assertSame( 'comment_date', $q->validate_column( 'comment_date' ) ); 232 global $wpdb; 233 $q = new WP_Date_Query( array() ); 234 235 $this->assertSame( $wpdb->comments . '.comment_date', $q->validate_column( 'comment_date' ) ); 231 236 } 232 237 233 238 public function test_validate_column_comment_date_gmt() { 234 $q = new WP_Date_Query( array() ); 235 236 $this->assertSame( 'comment_date_gmt', $q->validate_column( 'comment_date_gmt' ) ); 239 global $wpdb; 240 $q = new WP_Date_Query( array() ); 241 242 $this->assertSame( $wpdb->comments . '.comment_date_gmt', $q->validate_column( 'comment_date_gmt' ) ); 237 243 } 238 244 239 245 public function test_validate_column_invalid() { 240 $q = new WP_Date_Query( array() ); 241 242 $this->assertSame( 'post_date', $q->validate_column( 'foo' ) ); 246 global $wpdb; 247 $q = new WP_Date_Query( array() ); 248 249 $this->assertSame( $wpdb->posts . '.post_date', $q->validate_column( 'foo' ) ); 250 } 251 252 /** 253 * @ticket 25775 254 */ 255 public function test_validate_column_with_date_query_valid_columns_filter() { 256 $q = new WP_Date_Query( array() ); 257 258 add_filter( 'date_query_valid_columns', array( $this, 'date_query_valid_columns_callback' ) ); 259 260 $this->assertSame( 'my_custom_column', $q->validate_column( 'my_custom_column' ) ); 261 262 remove_filter( 'date_query_valid_columns', array( $this, 'date_query_valid_columns_callback' ) ); 263 } 264 265 /** 266 * @ticket 25775 267 */ 268 public function test_validate_column_prefixed_column_name() { 269 $q = new WP_Date_Query( array() ); 270 271 $this->assertSame( 'foo.bar', $q->validate_column( 'foo.bar' ) ); 272 } 273 274 /** 275 * @ticket 25775 276 */ 277 public function test_validate_column_prefixed_column_name_with_illegal_characters() { 278 $q = new WP_Date_Query( array() ); 279 280 $this->assertSame( 'foo.bar', $q->validate_column( 'f"\'oo\/.b;:()ar' ) ); 243 281 } 244 282 245 283 public function test_build_value_value_null() { 284 global $wpdb; 246 285 $q = new WP_Date_Query( array() ); 247 286 … … 903 942 } 904 943 } 944 945 /** Helpers **********************************************************/ 946 947 public function date_query_valid_columns_callback( $columns ) { 948 $columns[] = 'my_custom_column'; 949 return $columns; 950 } 905 951 }
Note: See TracChangeset
for help on using the changeset viewer.