/** * @group crop */ public function test_bp_attachment_crop() { $crop_args = array('original_file' => $this->image_file, 'crop_x' => 0, 'crop_y' => 0, 'crop_w' => 150, 'crop_h' => 150, 'dst_w' => 150, 'dst_h' => 150); $attachment_class = new BPTest_Attachment_Extension(array('action' => 'attachment_action', 'file_input' => 'attachment_file_input', 'base_dir' => 'attachment_base_dir')); $cropped = $attachment_class->crop($crop_args); // Image must come from the upload basedir $this->assertTrue(is_wp_error($cropped)); $crop_args['original_file'] = $attachment_class->upload_path . '/mystery-man.jpg'; // Image must stay in the upload basedir $crop_args['dst_file'] = BP_TESTS_DIR . 'assets/error.jpg'; $cropped = $attachment_class->crop($crop_args); // Image must stay in the upload basedir $this->assertTrue(is_wp_error($cropped)); // clean up! $this->clean_files(); }