Make WordPress Core

Changeset 25364


Ignore:
Timestamp:
09/11/2013 09:47:14 PM (11 years ago)
Author:
wonderboymusic
Message:

Add a $post_id fixture to Tests_Comment_Query. Comments created without passing comment_post_ID produce an undefined variable notice in wp_insert_comment().

See #25282.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/comment/query.php

    r25002 r25364  
    77 */
    88class Tests_Comment_Query extends WP_UnitTestCase {
    9     var $comment_id;
     9    protected $post_id;
     10    protected $comment_id;
    1011
    1112    function setUp() {
    1213        parent::setUp();
     14
     15        $this->post_id = $this->factory->post->create();
    1316    }
    1417
     
    1720     */
    1821    function test_get_comment_comment_approved_0() {
    19         $comment_id = $this->factory->comment->create();
     22        $comment_id = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );
    2023        $comments_approved_0 = get_comments( array( 'status' => 'hold' ) );
    2124        $this->assertEquals( 0, count( $comments_approved_0 ) );
     
    2629     */
    2730    function test_get_comment_comment_approved_1() {
    28         $comment_id = $this->factory->comment->create();
     31        $comment_id = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );
    2932        $comments_approved_1 = get_comments( array( 'status' => 'approve' ) );
    3033
     
    8184     */
    8285    function test_orderby_meta() {
    83         $comment_id = $this->factory->comment->create();
    84         $comment_id2 = $this->factory->comment->create();
    85         $comment_id3 = $this->factory->comment->create();
     86        $comment_id = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );
     87        $comment_id2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );
     88        $comment_id3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );
    8689
    8790        add_comment_meta( $comment_id, 'key', 'value1', true );
Note: See TracChangeset for help on using the changeset viewer.