Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/06/2021 08:39:28 PM (4 years ago)
Author:
imath
Message:

PHPUnit: fix failing tests about media

Since WP 50170 revision, errors about getimagesize() and exif_read_data() are not silenced anymore. We must now make sure to write media files where they should be for these two functions.

Tests involving exif_read_data() will be skipped from now on when testing against PHP 5.6 as no matter the image you use, you'll always get an Illegal IDF size error. It appears to be a bug with this version of PHP.

Fixes #8432 (7.0 branch)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/7.0/tests/phpunit/testcases/core/class-bp-attachment.php

    r12555 r12841  
    378378     */
    379379    public function test_bp_attachment_avatar_shrink() {
    380         if ( false === _wp_image_editor_choose() ) {
    381             $this->markTestSkipped( 'This test requires PHP to have a valid image editor that is compatible with WordPress.' );
     380        if ( false === _wp_image_editor_choose() || version_compare( phpversion(), '7.0' , '<' ) ) {
     381            $this->markTestSkipped( 'This test requires PHP >= 7.0 and to have a valid image editor that is compatible with WordPress.' );
    382382        }
    383383
     
    430430        }
    431431
    432         $image = BP_TESTS_DIR . 'assets/upside-down.jpg';
     432        $image = BP_TESTS_DIR . 'assets/test-image-large.jpg';
    433433
    434434        $cover_image_class = new BP_Attachment_Cover_Image();
    435435
    436         $abs_path_copy = $cover_image_class->upload_path . '/upside-down.jpg';
     436        $abs_path_copy = $cover_image_class->upload_path . '/test-image-large.jpg';
    437437
    438438        copy( $image, $abs_path_copy );
     
    465465     */
    466466    public function test_bp_attachment_get_image_data() {
    467         if ( ! is_callable( 'exif_read_data' ) ) {
    468             $this->markTestSkipped( 'This test requires PHP to be compiled with EXIF support.' );
     467        if ( ! is_callable( 'exif_read_data' ) || version_compare( phpversion(), '7.0' , '<' ) ) {
     468            $this->markTestSkipped( 'This test requires PHP >= 7.0 and to be compiled with EXIF support.' );
    469469        }
    470470
Note: See TracChangeset for help on using the changeset viewer.