Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r30258 r29120  
    255255        }
    256256
    257         /**
    258          * @ticket 29646
    259          */
    260         function test_update_orphan_attachment_parent() {
    261                 $filename = ( DIR_TESTDATA . '/images/test-image.jpg' );
    262                 $contents = file_get_contents( $filename );
    263 
    264                 $upload = wp_upload_bits( basename( $filename ), null, $contents );
    265                 $this->assertTrue( empty( $upload['error'] ) );
    266 
    267                 $attachment_id = $this->_make_attachment( $upload );
    268 
    269                 // Assert that the attachment is an orphan
    270                 $attachment = get_post( $attachment_id );
    271                 $this->assertEquals( $attachment->post_parent, 0 );
    272 
    273                 $post_id = wp_insert_post( array( 'post_content' => rand_str(), 'post_title' => rand_str() ) );
    274 
    275                 // Assert that the attachment has a parent
    276                 wp_insert_attachment( $attachment, '', $post_id );
    277                 $attachment = get_post( $attachment_id );
    278                 $this->assertEquals( $attachment->post_parent, $post_id );
    279         }
    280 
    281257}
Note: See TracChangeset for help on using the changeset viewer.