Make WordPress Core

Changeset 26088


Ignore:
Timestamp:
11/11/2013 05:51:29 PM (11 years ago)
Author:
wonderboymusic
Message:

Avoid Out of range value for column 'post_parent' error in Tests_Ajax_MediaEdit::_make_attachment() by setting the default parent id to 0 instead of -1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/ajax/MediaEdit.php

    r25002 r26088  
    2020     */
    2121    protected $_ids = array();
    22    
     22
    2323    /**
    2424     * Set up the test fixture.
     
    4040        foreach ( scandir( $uploads['basedir'] ) as $file )
    4141            _rmdir( $uploads['basedir'] . '/' . $file );
    42        
     42
    4343        parent::tearDown();
    4444    }
    45    
     45
    4646    /**
    4747     * Function snagged from ./tests/post/attachments.php
    4848     */
    49     function _make_attachment($upload, $parent_post_id = -1) {
     49    function _make_attachment($upload, $parent_post_id = 0) {
    5050        $type = '';
    5151        if ( !empty($upload['type']) ) {
     
    8383        $upload = wp_upload_bits(basename($filename), null, $contents);
    8484        $id = $this->_make_attachment($upload);
    85        
     85
    8686        $_REQUEST['action'] = 'image-editor';
    8787        $_REQUEST['context'] = 'edit-attachment';
     
    9090        $_REQUEST['do'] = 'save';
    9191        $_REQUEST['history'] = '[{"c":{"x":5,"y":8,"w":289,"h":322}}]';
    92        
     92
    9393        $media_meta = wp_get_attachment_metadata($id);
    9494        $this->assertArrayHasKey('sizes', $media_meta, 'attachment should have size data');
    9595        $this->assertArrayHasKey('medium', $media_meta['sizes'], 'attachment should have data for medium size');
    9696        $ret = wp_save_image($id);
    97        
     97
    9898        $media_meta = wp_get_attachment_metadata($id);
    9999        $this->assertArrayHasKey('sizes', $media_meta, 'cropped attachment should have size data');
Note: See TracChangeset for help on using the changeset viewer.