WordPress.org

Make WordPress Core

Changeset 1278 in tests


Ignore:
Timestamp:
05/07/2013 02:02:45 PM (5 years ago)
Author:
markoheijnen
Message:

Add test to check if guid isn't empty when not provided. See #18310

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/post/attachments.php

    r1161 r1278  
    212212    }
    213213
     214    /**
     215     * GUID should never be empty
     216     * @ticket 18310
     217     */
     218    function test_insert_image_without_guid() {
     219        // this image is smaller than the thumbnail size so it won't have one
     220        $filename = ( DIR_TESTDATA.'/images/test-image.jpg' );
     221        $contents = file_get_contents($filename);
     222
     223        $upload = wp_upload_bits(basename($filename), null, $contents);
     224        $this->assertTrue( empty($upload['error']) );
     225
     226        $upload['url'] = '';
     227        $id = $this->_make_attachment( $upload );
     228
     229        $guid = get_the_guid( $id );
     230        $this->assertFalse( empty( $guid ) );
     231    }
     232
    214233}
Note: See TracChangeset for help on using the changeset viewer.