Changeset 14051 for branches/14.0/tests/phpunit/testcases/core/avatars.php
- Timestamp:
- 10/22/2024 08:51:48 PM (14 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/14.0/tests/phpunit/testcases/core/avatars.php
r13417 r14051 8 8 protected $allowed_image_types = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'webp' ); 9 9 protected $allowed_image_mimes = array( 'image/jpeg', 'image/jpeg', 'image/jpeg', 'image/gif', 'image/png', 'image/webp' ); 10 protected $capture = array(); 10 11 11 12 public function set_up() { … … 424 425 $this->assertFalse( is_dir( $avatar_dir1 ) ); 425 426 } 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 } 426 450 }
Note: See TracChangeset
for help on using the changeset viewer.