WordPress.org

Make WordPress Core

Changeset 982 in tests


Ignore:
Timestamp:
08/21/2012 10:19:28 AM (6 years ago)
Author:
SergeyBiryukov
Message:

Remove closures from functions.php. see #101. see #WP21594.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/functions.php

    r976 r982  
    326326    }
    327327
     328    /**
     329     * @ticket 21594
     330     */
    328331    function test_get_allowed_mime_types() {
    329332        $mimes = get_allowed_mime_types();
     
    332335        $this->assertNotEmpty( $mimes );
    333336
    334         $callback = function( $mimes ) {
    335             return array();
    336         };
    337 
    338         add_filter( 'upload_mimes',  $callback );
     337        add_filter( 'upload_mimes', '__return_empty_array' );
    339338        $mimes = get_allowed_mime_types();
    340339        $this->assertInternalType( 'array', $mimes );
    341340        $this->assertEmpty( $mimes );
    342341
    343         remove_filter( 'upload_mimes', $callback );
     342        remove_filter( 'upload_mimes', '__return_empty_array' );
    344343        $mimes = get_allowed_mime_types();
    345344        $this->assertInternalType( 'array', $mimes );
     
    347346    }
    348347
     348    /**
     349     * @ticket 21594
     350     */
    349351    function test_wp_get_mime_types() {
    350352        $mimes = wp_get_mime_types();
     
    353355        $this->assertNotEmpty( $mimes );
    354356
    355         $callback = function( $mimes ) {
    356             return array();
    357         };
    358 
    359         add_filter( 'mime_types',  $callback );
     357        add_filter( 'mime_types', '__return_empty_array' );
    360358        $mimes = wp_get_mime_types();
    361359        $this->assertInternalType( 'array', $mimes );
    362360        $this->assertEmpty( $mimes );
    363361
    364         remove_filter( 'mime_types', $callback );
     362        remove_filter( 'mime_types', '__return_empty_array' );
    365363        $mimes = wp_get_mime_types();
    366364        $this->assertInternalType( 'array', $mimes );
     
    368366
    369367        // upload_mimes shouldn't affect wp_get_mime_types()
    370         add_filter( 'upload_mimes',  $callback );
     368        add_filter( 'upload_mimes', '__return_empty_array' );
    371369        $mimes = wp_get_mime_types();
    372370        $this->assertInternalType( 'array', $mimes );
    373371        $this->assertNotEmpty( $mimes );
    374372
    375         remove_filter( 'upload_mimes', $callback );
     373        remove_filter( 'upload_mimes', '__return_empty_array' );
    376374        $mimes2 = wp_get_mime_types();
    377375        $this->assertInternalType( 'array', $mimes2 );
Note: See TracChangeset for help on using the changeset viewer.