Last change
on this file since 37475 was
30873,
checked in by johnbillion, 10 years ago
|
Add tests which ensure the wp_editor_set_quality and jpeg_quality filters only apply if they are added before the corresponding WP_Image_Editor is instantiated.
Props DH-Shredder
See #29856
|
File size:
1.0 KB
|
Line | |
---|
1 | <?php |
---|
2 | |
---|
3 | if (class_exists( 'WP_Image_Editor' ) ) : |
---|
4 | |
---|
5 | class WP_Image_Editor_Mock extends WP_Image_Editor { |
---|
6 | |
---|
7 | public static $load_return = true; |
---|
8 | public static $test_return = true; |
---|
9 | public static $save_return = array(); |
---|
10 | |
---|
11 | // Allow testing of jpeg_quality filter. |
---|
12 | public function set_mime_type( $mime_type = null ) { |
---|
13 | $this->mime_type = $mime_type; |
---|
14 | } |
---|
15 | |
---|
16 | public function load() { |
---|
17 | return self::$load_return; |
---|
18 | } |
---|
19 | public static function test( $args = array() ) { |
---|
20 | return self::$test_return; |
---|
21 | } |
---|
22 | public static function supports_mime_type( $mime_type ) { |
---|
23 | return true; |
---|
24 | } |
---|
25 | public function resize( $max_w, $max_h, $crop = false ) { |
---|
26 | |
---|
27 | } |
---|
28 | public function multi_resize( $sizes ) { |
---|
29 | |
---|
30 | } |
---|
31 | public function crop( $src_x, $src_y, $src_w, $src_h, $dst_w = null, $dst_h = null, $src_abs = false ) { |
---|
32 | |
---|
33 | } |
---|
34 | public function rotate( $angle ) { |
---|
35 | |
---|
36 | } |
---|
37 | public function flip( $horz, $vert ) { |
---|
38 | |
---|
39 | } |
---|
40 | public function save( $destfilename = null, $mime_type = null ) { |
---|
41 | return self::$save_return; |
---|
42 | } |
---|
43 | public function stream( $mime_type = null ) { |
---|
44 | |
---|
45 | } |
---|
46 | } |
---|
47 | |
---|
48 | endif; |
---|
Note: See
TracBrowser
for help on using the repository browser.