Make WordPress Core

Changeset 1261 in tests


Ignore:
Timestamp:
04/19/2013 07:11:23 PM (14 years ago)
Author:
wonderboymusic
Message:

Add initial tests for . See #23570

File:
1 edited

Legend:

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

    r1258 r1261  
    490490                $this->assertEquals( $stanzas, $expected );
    491491        }
     492
     493        /**
     494         * @ticket 23570
     495         */
     496        function test_get_content_url() {
     497                $link = 'http://nytimes.com';
     498                $commentary = 'This is my favorite link';
     499                $link_with_commentary =<<<DATA
     500$link
     501
     502$commentary
     503DATA;
     504
     505                $link_post_id = $this->factory->post->create( array( 'post_content' => $link ) );
     506                $content_link = get_content_url( get_post_field( 'post_content', $link_post_id ) );
     507                $this->assertEquals( $content_link, $link );
     508
     509                $link_with_post_id = $this->factory->post->create( array( 'post_content' => $link_with_commentary ) );
     510                $content_link = get_content_url( get_post_field( 'post_content', $link_with_post_id ) );
     511                $this->assertEquals( $content_link, $link );
     512
     513                update_post_meta( $link_post_id, '_format_url', $link );
     514                $content_link = get_content_url( get_post_field( 'post_content', $link_post_id ) );
     515                $this->assertEquals( $content_link, $link );
     516
     517                update_post_meta( $link_with_post_id, '_format_url', $link );
     518                $content_link = get_content_url( get_post_field( 'post_content', $link_with_post_id ) );
     519                $this->assertEquals( $content_link, $link );
     520
     521                $empty_post_id = $this->factory->post->create( array( 'post_content' => '' ) );
     522                update_post_meta( $empty_post_id, '_format_url', $link );
     523                $content_link = get_content_url( get_post_field( 'post_content', $empty_post_id ) );
     524                $this->assertEquals( $content_link, '' );
     525
     526                $comm_post_id = $this->factory->post->create( array( 'post_content' => $commentary ) );
     527                update_post_meta( $comm_post_id, '_format_url', $link );
     528                $content_link = get_content_url( get_post_field( 'post_content', $comm_post_id ) );
     529                $this->assertEquals( $content_link, '' );
     530        }
    492531}
Note: See TracChangeset for help on using the changeset viewer.