Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/22/2024 08:51:48 PM (14 months ago)
Author:
imath
Message:

14.2.1 version bumps (branch 14.0)

File:
1 edited

Legend:

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

    r13417 r14051  
    88    protected $allowed_image_types = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'webp' );
    99    protected $allowed_image_mimes = array( 'image/jpeg', 'image/jpeg', 'image/jpeg', 'image/gif', 'image/png', 'image/webp' );
     10    protected $capture = array();
    1011
    1112    public function set_up() {
     
    424425        $this->assertFalse( is_dir( $avatar_dir1 ) );
    425426    }
     427
     428    public function set_capture( $return, $data ) {
     429        $this->capture = $data;
     430        return false;
     431    }
     432
     433    /**
     434     * @group bp_avatar_handle_capture
     435     */
     436    public function test_bp_avatar_handle_capture() {
     437        $u = self::factory()->user->create();
     438        $data = 'hello world';
     439
     440        add_filter( 'bp_core_pre_avatar_handle_crop', array( $this, 'set_capture' ), 10, 2 );
     441
     442        bp_avatar_handle_capture( $data, $u . '/../../../../../../foobar', 'array' );
     443
     444        remove_filter( 'bp_core_pre_avatar_handle_crop', array( $this, 'set_capture' ), 10, 2 );
     445
     446        $expected = '/avatars/' . $u . '/webcam-capture-' . $u . '.png';
     447
     448        $this->assertEquals( $expected, $this->capture['original_file'] );
     449    }
    426450}
Note: See TracChangeset for help on using the changeset viewer.