-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests that mock WebP support enabled/disabled
- Loading branch information
1 parent
2620b57
commit 155989b
Showing
4 changed files
with
115 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
/** | ||
* A WP_Image_Editor mock that doesn't support WebP. | ||
* | ||
* @package performance-lab | ||
* @since 1.0.0 | ||
*/ | ||
|
||
/** | ||
* Class WP_Image_Doesnt_Support_WebP mocks a WP_Image_Editor that doesn't support WebP. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
class WP_Image_Doesnt_Support_WebP { | ||
/** | ||
* Checks to see if editor supports the mime-type specified. | ||
* | ||
* @param string $mime_type The mime type to check. | ||
* @return bool | ||
*/ | ||
public static function supports_mime_type( $mime_type ) { | ||
if ( 'image/webp' === $mime_type ) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
/** | ||
* Set support true. | ||
* | ||
* @return bool | ||
*/ | ||
public static function test() { | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
/** | ||
* A WP_Image_Editor mock that supports WebP. | ||
* | ||
* @package performance-lab | ||
* @since 1.0.0 | ||
*/ | ||
|
||
/** | ||
* Class WP_Image_Supports_WebP mocks a WP_Image_Editor that supports WebP. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
class WP_Image_Supports_WebP { | ||
/** | ||
* Checks to see if editor supports the mime-type specified. | ||
* | ||
* @param string $mime_type The mime type to check. | ||
* @return bool | ||
*/ | ||
public static function supports_mime_type( $mime_type ) { | ||
if ( 'image/webp' === $mime_type ) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
/** | ||
* Set support true. | ||
* | ||
* @return bool | ||
*/ | ||
public static function test() { | ||
return true; | ||
} | ||
} |