Changeset 976 in tests for trunk/tests/functions.php
- Timestamp:
- 08/20/2012 05:23:20 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/functions.php
r943 r976 325 325 $_SERVER['REQUEST_URI'] = $old_req_uri; 326 326 } 327 328 function test_get_allowed_mime_types() { 329 $mimes = get_allowed_mime_types(); 330 331 $this->assertInternalType( 'array', $mimes ); 332 $this->assertNotEmpty( $mimes ); 333 334 $callback = function( $mimes ) { 335 return array(); 336 }; 337 338 add_filter( 'upload_mimes', $callback ); 339 $mimes = get_allowed_mime_types(); 340 $this->assertInternalType( 'array', $mimes ); 341 $this->assertEmpty( $mimes ); 342 343 remove_filter( 'upload_mimes', $callback ); 344 $mimes = get_allowed_mime_types(); 345 $this->assertInternalType( 'array', $mimes ); 346 $this->assertNotEmpty( $mimes ); 347 } 348 349 function test_wp_get_mime_types() { 350 $mimes = wp_get_mime_types(); 351 352 $this->assertInternalType( 'array', $mimes ); 353 $this->assertNotEmpty( $mimes ); 354 355 $callback = function( $mimes ) { 356 return array(); 357 }; 358 359 add_filter( 'mime_types', $callback ); 360 $mimes = wp_get_mime_types(); 361 $this->assertInternalType( 'array', $mimes ); 362 $this->assertEmpty( $mimes ); 363 364 remove_filter( 'mime_types', $callback ); 365 $mimes = wp_get_mime_types(); 366 $this->assertInternalType( 'array', $mimes ); 367 $this->assertNotEmpty( $mimes ); 368 369 // upload_mimes shouldn't affect wp_get_mime_types() 370 add_filter( 'upload_mimes', $callback ); 371 $mimes = wp_get_mime_types(); 372 $this->assertInternalType( 'array', $mimes ); 373 $this->assertNotEmpty( $mimes ); 374 375 remove_filter( 'upload_mimes', $callback ); 376 $mimes2 = wp_get_mime_types(); 377 $this->assertInternalType( 'array', $mimes2 ); 378 $this->assertNotEmpty( $mimes2 ); 379 $this->assertEquals( $mimes2, $mimes ); 380 } 327 381 }
Note: See TracChangeset
for help on using the changeset viewer.