Changeset 1201 in tests
- Timestamp:
- 02/02/2013 01:50:23 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/mock-image-editor.php
r1151 r1201 7 7 public static $load_return = true; 8 8 public static $test_return = true; 9 public static $save_return = array(); 9 10 10 11 public function load() { … … 33 34 } 34 35 public function save( $destfilename = null, $mime_type = null ) { 35 36 return self::$save_return; 36 37 } 37 38 public function stream( $mime_type = null ) { -
trunk/tests/image/functions.php
r1200 r1201 7 7 */ 8 8 class Tests_Image_Functions extends WP_UnitTestCase { 9 10 9 /** 11 10 * Setup test fixture 12 11 */ 13 12 public function setup() { 14 require_once ABSPATH . WPINC . '/class-wp-image-editor.php'; 15 require_once ABSPATH . WPINC . '/class-wp-image-editor-gd.php'; 16 require_once ABSPATH . WPINC . '/class-wp-image-editor-imagick.php'; 13 require_once( ABSPATH . WPINC . '/class-wp-image-editor.php' ); 14 require_once( ABSPATH . WPINC . '/class-wp-image-editor-gd.php' ); 15 require_once( ABSPATH . WPINC . '/class-wp-image-editor-imagick.php' ); 16 17 include_once( DIR_TESTDATA . '/../includes/mock-image-editor.php' ); 17 18 } 18 19 … … 299 300 $this->assertInstanceOf( 'WP_Error', $file ); 300 301 } 302 303 function mock_image_editor( $editors ) { 304 return array( 'WP_Image_Editor_Mock' ); 305 } 306 307 /** 308 * @ticket 23325 309 */ 310 public function test_wp_crop_image_error_on_saving() { 311 WP_Image_Editor_Mock::$save_return = new WP_Error(); 312 add_filter( 'wp_image_editors', array( $this, 'mock_image_editor' ) ); 313 314 $file = wp_crop_image( DIR_TESTDATA . '/images/canola.jpg', 315 0, 0, 100, 100, 100, 100 ); 316 $this->assertInstanceOf( 'WP_Error', $file ); 317 318 remove_filter( 'wp_image_editors', array( $this, 'mock_image_editor' ) ); 319 WP_Image_Editor_Mock::$save_return = array(); 320 } 301 321 }
Note: See TracChangeset
for help on using the changeset viewer.