| | 222 | |
| | 223 | /** |
| | 224 | * Try loading a directory |
| | 225 | * @ticket 17814 |
| | 226 | */ |
| | 227 | public function test_load_directory() { |
| | 228 | // First, test with deprecated wp_load_image function |
| | 229 | $editor = wp_load_image( DIR_TESTDATA ); |
| | 230 | $this->assertNotInternalType( 'resource', $editor ); |
| | 231 | |
| | 232 | // Then, test with editors. |
| | 233 | $classes = array('WP_Image_Editor_GD', 'WP_Image_Editor_Imagick'); |
| | 234 | foreach ( $classes as $class ) { |
| | 235 | if ( !$class::test() ) { |
| | 236 | continue; |
| | 237 | } |
| | 238 | $filter = create_function( '', "return '$class';" ); |
| | 239 | add_filter( 'image_editor_class', $filter ); |
| | 240 | $editor = WP_Image_Editor::get_instance( DIR_TESTDATA ); |
| | 241 | $this->assertInstanceOf( 'WP_Error', $editor ); |
| | 242 | $this->assertEquals( 'error_loading_image', $editor->get_error_code() ); |
| | 243 | } |
| | 244 | } |