- Timestamp:
- 05/17/2015 11:14:39 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/core/class-bp-attachment.php
r9831 r9874 14 14 parent::setUp(); 15 15 add_filter( 'bp_attachment_upload_overrides', array( $this, 'filter_overrides' ), 10, 1 ); 16 add_filter( 'bp_attachment_upload_dir', array( $this, 'filter_upload_dir' ), 10, 1 ); 17 add_filter( 'xprofile_avatar_upload_dir', array( $this, 'filter_upload_dir' ), 10, 1 ); 18 add_filter( 'groups_avatar_upload_dir', array( $this, 'filter_upload_dir' ), 10, 1 ); 16 add_filter( 'upload_dir', array( $this, 'filter_upload_dir' ), 20, 1 ); 19 17 $this->upload_results = array(); 20 18 $this->image_file = trailingslashit( buddypress()->plugin_dir ) . 'bp-core/images/mystery-man.jpg'; … … 24 22 parent::tearDown(); 25 23 remove_filter( 'bp_attachment_upload_overrides', array( $this, 'filter_overrides' ), 10, 1 ); 26 remove_filter( 'bp_attachment_upload_dir', array( $this, 'filter_upload_dir' ), 10, 1 ); 27 remove_filter( 'xprofile_avatar_upload_dir', array( $this, 'filter_upload_dir' ), 10, 1 ); 28 remove_filter( 'groups_avatar_upload_dir', array( $this, 'filter_upload_dir' ), 10, 1 ); 24 remove_filter( 'upload_dir', array( $this, 'filter_upload_dir' ), 20, 1 ); 29 25 $this->upload_results = array(); 30 26 $this->image_file = ''; … … 176 172 /** 177 173 * @group upload 174 */ 175 public function test_bp_attachment_upload_no_base_dir_specific_time() { 176 $reset_files = $_FILES; 177 $reset_post = $_POST; 178 179 $attachment_class = new BPTest_Attachment_Extension( array( 180 'action' => 'attachment_action', 181 'file_input' => 'attachment_file_input', 182 ) ); 183 184 $_POST['action'] = $attachment_class->action; 185 $_FILES[ $attachment_class->file_input ] = array( 186 'tmp_name' => $this->image_file, 187 'name' => 'mystery-man.jpg', 188 'type' => 'image/jpeg', 189 'error' => 0, 190 'size' => filesize( $this->image_file ), 191 ); 192 193 $time = '2015/01'; 194 195 $upload = $attachment_class->upload( $_FILES, '', $time ); 196 197 // If no base_dir was provided, default WordPress uploads dir should be used. 198 $this->assertEquals( $upload['file'], $attachment_class->upload_path . '/' . $time . '/mystery-man.jpg' ); 199 200 // clean up! 201 $_FILES = $reset_files; 202 $_POST = $reset_post; 203 } 204 205 /** 206 * @group upload 178 207 * @group avatar 179 208 */
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)