Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/13/2022 12:16:46 PM (20 months ago)
Author:
imath
Message:

Media: add support for the .webp image file type

NB: this support will only be available when the community site uses WP >= 5.8.

Props dcavins

Fixes #8643

File:
1 edited

Legend:

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

    r13314 r13315  
    258258        add_filter( 'bp_core_get_allowed_avatar_types', array( $this, 'avatar_types_filter_add_type' ) );
    259259
    260         $this->assertEquals( array( 'jpeg', 'gif', 'png' ), bp_core_get_allowed_avatar_types() );
     260        $this->assertEquals( array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'webp' ), bp_core_get_allowed_avatar_types() );
    261261
    262262        remove_filter( 'bp_core_get_allowed_avatar_types', array( $this, 'avatar_types_filter_add_type' ) );
     
    264264        add_filter( 'bp_core_get_allowed_avatar_types', array( $this, 'avatar_types_filter_remove_type' ) );
    265265
    266         $this->assertEquals( array( 'gif', 'png' ), bp_core_get_allowed_avatar_types() );
     266        $this->assertEquals( array( 'jpeg', 'jpe', 'gif', 'png', 'webp' ), bp_core_get_allowed_avatar_types() );
    267267
    268268        remove_filter( 'bp_core_get_allowed_avatar_types', array( $this, 'avatar_types_filter_remove_type' ) );
     
    270270        add_filter( 'bp_core_get_allowed_avatar_types', '__return_empty_array' );
    271271
    272         $this->assertEquals( array( 'jpeg', 'gif', 'png' ), bp_core_get_allowed_avatar_types() );
     272        $this->assertEquals( array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'webp' ), bp_core_get_allowed_avatar_types() );
    273273
    274274        remove_filter( 'bp_core_get_allowed_avatar_types', '__return_empty_array' );
     
    282282        $mimes = bp_core_get_allowed_avatar_mimes();
    283283
    284         $this->assertEqualSets( array( 'jpeg', 'gif', 'png', 'jpg' ), array_keys( $mimes ) );
    285         $this->assertEqualSets( array( 'image/jpeg', 'image/gif', 'image/png', 'image/jpeg' ), array_values( $mimes ) );
     284        $this->assertEqualSets( array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'webp' ), array_keys( $mimes ) );
     285        $this->assertEqualSets( array( 'image/jpeg', 'image/jpeg', 'image/jpeg', 'image/gif', 'image/png', 'image/webp' ), array_values( $mimes ) );
    286286
    287287        add_filter( 'bp_core_get_allowed_avatar_types', array( $this, 'avatar_types_filter_add_type' ) );
    288288
    289         $this->assertEqualSets( array( 'image/jpeg', 'image/gif', 'image/png', 'image/jpeg' ), array_values( bp_core_get_allowed_avatar_mimes() ) );
     289        $this->assertEqualSets( array( 'image/jpeg', 'image/jpeg', 'image/jpeg', 'image/gif', 'image/png', 'image/webp' ), array_values( bp_core_get_allowed_avatar_mimes() ) );
    290290
    291291        remove_filter( 'bp_core_get_allowed_avatar_types', array( $this, 'avatar_types_filter_add_type' ) );
     
    293293        add_filter( 'bp_core_get_allowed_avatar_types', array( $this, 'avatar_types_filter_remove_type' ) );
    294294
    295         $this->assertEqualSets( array( 'image/gif', 'image/png' ), array_values( bp_core_get_allowed_avatar_mimes() ) );
     295        $this->assertEqualSets( array( 'image/jpeg', 'image/jpeg', 'image/gif', 'image/png', 'image/webp', 'image/jpeg' ), array_values( bp_core_get_allowed_avatar_mimes() ) );
    296296
    297297        remove_filter( 'bp_core_get_allowed_avatar_types', array( $this, 'avatar_types_filter_remove_type' ) );
     
    299299        add_filter( 'bp_core_get_allowed_avatar_types', '__return_empty_array' );
    300300
    301         $this->assertEqualSets( array( 'image/jpeg', 'image/gif', 'image/png', 'image/jpeg' ), array_values( bp_core_get_allowed_avatar_mimes() ) );
     301        $this->assertEqualSets( array( 'image/jpeg', 'image/jpeg', 'image/jpeg', 'image/gif', 'image/png', 'image/webp' ), array_values( bp_core_get_allowed_avatar_mimes() ) );
    302302
    303303        remove_filter( 'bp_core_get_allowed_avatar_types', '__return_empty_array' );
Note: See TracChangeset for help on using the changeset viewer.