Skip to content

Commit f5524dc

Browse files
swissspidyCopilot
andauthored
Tests: Improve Windows compatibility (#249)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 7127225 commit f5524dc

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

features/media-import.feature

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,8 @@ Feature: Manage WordPress attachments
325325
my-image.png.png
326326
"""
327327
Scenario: Fail to import from STDIN when no input provided
328-
When I try `wp media import - </dev/null`
328+
When I run `php -r "file_put_contents('empty.txt', '');"`
329+
And I try `wp media import - < empty.txt`
329330
Then STDERR should contain:
330331
"""
331332
Warning: Unable to import file from STDIN. Reason: No input provided.

src/Media_Command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ public function import( $args, $assoc_args = array() ) {
571571
}
572572

573573
// Determine file extension from content
574-
$mimetype = mime_content_type( $tempfile );
574+
$mimetype = function_exists( 'mime_content_type' ) ? mime_content_type( $tempfile ) : '';
575575

576576
// Map MIME type to extension
577577
$ext = '';

0 commit comments

Comments
 (0)