Make WordPress Core

Ticket #48014: 48014.2.diff

File 48014.2.diff, 1.3 KB (added by whyisjake, 7 years ago)
  • src/wp-includes/post.php

     
    68006800        }
    68016801
    68026802        if ( get_option( 'default_pingback_flag' ) ) {
    6803                 add_post_meta( $post_id, '_pingme', '1' );
     6803                add_post_meta( $post_id, '_pingme', '1', true );
    68046804        }
    6805         add_post_meta( $post_id, '_encloseme', '1' );
     6805        add_post_meta( $post_id, '_encloseme', '1', true );
    68066806
    68076807        $to_ping = get_to_ping( $post_id );
    68086808        if ( ! empty( $to_ping ) ) {
  • tests/phpunit/tests/post.php

     
    14301430                $post = get_post( $post_id );
    14311431                self::assertEquals( strtotime( gmdate( 'Y-m-d H:i:s' ) ), strtotime( $post->post_date_gmt ), 'The dates should be equal', 2 );
    14321432        }
     1433
     1434        /**
     1435         * @ticket 48014
     1436         */
     1437        public function test_publish_post_hook() {
     1438                $post_id = self::factory()->post->create();
     1439
     1440                $enclosed = get_post_meta( $post_id, '_encloseme' );
     1441
     1442                $post  = get_post( $post_id );
     1443                $post1 = wp_update_post( $post );
     1444
     1445                $enclosed1 = get_post_meta( $post_id, '_encloseme' );
     1446
     1447                $this->assertEquals( '1', count( $enclosed ) );
     1448                $this->assertEquals( '1', count( $enclosed1 ) );
     1449
     1450        }
    14331451}