Make WordPress Core

Changeset 53787


Ignore:
Timestamp:
07/27/2022 03:41:30 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Tests: Don't unnecessarily set the author in some wp_insert_post() tests.

This aims to make the tests more specific. Setting the author appears to be redundant, as the as the authorship is out of scope for these particular tests.

Follow-up to [66/tests], [84/tests], [167/tests], [296/tests], [412/tests], [496/tests], [1026/tests], [1323/tests], [25554], [33041], [34762], [35183].

See #55652.

Location:
trunk/tests/phpunit/tests
Files:
2 edited

Legend:

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

    r53785 r53787  
    148148        self::factory()->post->create(
    149149            array(
    150                 'post_type'   => $post_type,
    151                 'post_author' => self::$editor_id,
     150                'post_type' => $post_type,
    152151            )
    153152        );
     
    168167            3,
    169168            array(
    170                 'post_type'   => $post_type,
    171                 'post_author' => self::$editor_id,
     169                'post_type' => $post_type,
    172170            )
    173171        );
  • trunk/tests/phpunit/tests/post/wpInsertPost.php

    r53785 r53787  
    171171
    172172        $data = array(
    173             'post_author'  => self::$user_ids['editor'],
    174173            'post_status'  => 'publish',
    175174            'post_content' => 'content',
     
    189188        $this->assertSame( $data['post_title'], $post->post_title );
    190189        $this->assertSame( 'future', $post->post_status );
    191         $this->assertEquals( $data['post_author'], $post->post_author );
    192190        $this->assertSame( $data['post_date'], $post->post_date );
    193191
     
    205203
    206204        $data = array(
    207             'post_author'  => self::$user_ids['editor'],
    208205            'post_status'  => 'publish',
    209206            'post_content' => 'content',
     
    248245
    249246        $data = array(
    250             'post_author'  => self::$user_ids['editor'],
    251247            'post_status'  => 'publish',
    252248            'post_content' => 'content',
     
    288284
    289285        $data = array(
    290             'post_author'  => self::$user_ids['editor'],
    291286            'post_status'  => 'draft',
    292287            'post_content' => 'content',
     
    306301        $this->assertSame( $data['post_title'], $post->post_title );
    307302        $this->assertSame( 'draft', $post->post_status );
    308         $this->assertEquals( $data['post_author'], $post->post_author );
    309303        $this->assertSame( $data['post_date'], $post->post_date );
    310304
     
    321315
    322316        $data = array(
    323             'post_author'  => self::$user_ids['editor'],
    324317            'post_status'  => 'publish',
    325318            'post_content' => 'content',
     
    362355
    363356        $data = array(
    364             'post_author'  => self::$user_ids['editor'],
    365357            'post_status'  => 'publish',
    366358            'post_content' => "{$status}_content",
     
    414406
    415407        $data = array(
    416             'post_author'  => self::$user_ids['editor'],
    417408            'post_status'  => 'private',
    418409            'post_content' => 'content',
     
    432423        $this->assertSame( $data['post_title'], $post->post_title );
    433424        $this->assertSame( 'private', $post->post_status );
    434         $this->assertEquals( $data['post_author'], $post->post_author );
    435425        $this->assertSame( $data['post_date'], $post->post_date );
    436426
     
    446436    public function test_vb_insert_invalid_date() {
    447437        $data = array(
    448             'post_author'  => self::$user_ids['editor'],
    449438            'post_status'  => 'publish',
    450439            'post_content' => 'content',
     
    469458
    470459        $data = array(
    471             'post_author'  => self::$user_ids['editor'],
    472460            'post_status'  => 'publish',
    473461            'post_content' => 'content',
     
    589577
    590578        $data = array(
    591             'post_author'  => self::$user_ids['editor'],
    592579            'post_status'  => 'publish',
    593580            'post_content' => 'content',
     
    619606
    620607        $data = array(
    621             'post_author'  => self::$user_ids['editor'],
    622608            'post_status'  => 'publish',
    623609            'post_content' => 'content',
     
    702688        $post_id = self::factory()->post->create(
    703689            array(
    704                 'post_author'  => self::$user_ids['editor'],
    705690                'post_status'  => 'publish',
    706691                'post_content' => 'content',
     
    720705        $post_id = self::factory()->post->create(
    721706            array(
    722                 'post_author'  => self::$user_ids['editor'],
    723707                'post_status'  => 'publish',
    724708                'post_content' => 'content',
     
    742726        $post_id = self::factory()->post->create(
    743727            array(
    744                 'post_author'  => self::$user_ids['editor'],
    745728                'post_status'  => 'publish',
    746729                'post_content' => rand_str(),
     
    766749        $post_id = self::factory()->post->create(
    767750            array(
    768                 'post_author'  => self::$user_ids['editor'],
    769751                'post_status'  => 'publish',
    770752                'post_content' => rand_str(),
     
    832814    public function test_wp_insert_post_should_respect_post_date_gmt() {
    833815        $data = array(
    834             'post_author'   => self::$user_ids['editor'],
    835816            'post_status'   => 'publish',
    836817            'post_content'  => 'content',
     
    846827        $this->assertSame( $data['post_content'], $post->post_content );
    847828        $this->assertSame( $data['post_title'], $post->post_title );
    848         $this->assertEquals( $data['post_author'], $post->post_author );
    849829        $this->assertSame( get_date_from_gmt( $data['post_date_gmt'] ), $post->post_date );
    850830        $this->assertSame( $data['post_date_gmt'], $post->post_date_gmt );
Note: See TracChangeset for help on using the changeset viewer.