Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/29/2015 11:22:24 PM (9 years ago)
Author:
imath
Message:

Add Unittests for the BP_Attachment_Cover_Image class and the bp_attachments_get_allowed_types function

See #6570

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/core/functions.php

    r10092 r10159  
    685685        $bp->active_components = $reset_active_components;
    686686    }
     687
     688    /**
     689     * @group bp_attachments
     690     */
     691    public function test_bp_attachments_get_allowed_types() {
     692        $supported = array( 'jpeg', 'gif', 'png' );
     693
     694        $avatar = bp_attachments_get_allowed_types( 'avatar' );
     695        $this->assertSame( $supported, $avatar );
     696
     697        $cover_image = bp_attachments_get_allowed_types( 'cover_image' );
     698        $this->assertSame( $supported, $cover_image );
     699
     700        $images = bp_attachments_get_allowed_types( 'image/' );
     701
     702        foreach ( $images as $image ) {
     703            if ( 'image' !== wp_ext2type( $image ) ) {
     704                $not_image = $image;
     705            }
     706        }
     707
     708        $this->assertTrue( empty( $not_image ) );
     709    }
    687710}
Note: See TracChangeset for help on using the changeset viewer.