Make WordPress Core


Ignore:
Timestamp:
07/10/2021 11:15:44 AM (3 years ago)
Author:
SergeyBiryukov
Message:

Tests: Use more appropriate assertions in various tests.

This replaces instances of assertTrue( isset( ... ) ) with assertArrayHasKey() to use native PHPUnit functionality.

Follow-up to [51335], [51337], [51367].

See #53363.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/user/multisite.php

    r51331 r51397  
    7373            foreach ( $blogs_of_user as $blog_id => $blog ) {
    7474                $this->assertSame( $blog_id, $blog->userblog_id );
    75                 $this->assertTrue( isset( $blog->userblog_id ) );
    76                 $this->assertTrue( isset( $blog->blogname ) );
    77                 $this->assertTrue( isset( $blog->domain ) );
    78                 $this->assertTrue( isset( $blog->path ) );
    79                 $this->assertTrue( isset( $blog->site_id ) );
    80                 $this->assertTrue( isset( $blog->siteurl ) );
    81                 $this->assertTrue( isset( $blog->archived ) );
    82                 $this->assertTrue( isset( $blog->spam ) );
    83                 $this->assertTrue( isset( $blog->deleted ) );
     75                $this->assertObjectHasAttribute( 'userblog_id', $blog );
     76                $this->assertObjectHasAttribute( 'blogname', $blog );
     77                $this->assertObjectHasAttribute( 'domain', $blog );
     78                $this->assertObjectHasAttribute( 'path', $blog );
     79                $this->assertObjectHasAttribute( 'site_id', $blog );
     80                $this->assertObjectHasAttribute( 'siteurl', $blog );
     81                $this->assertObjectHasAttribute( 'archived', $blog );
     82                $this->assertObjectHasAttribute( 'spam', $blog );
     83                $this->assertObjectHasAttribute( 'deleted', $blog );
    8484            }
    8585
Note: See TracChangeset for help on using the changeset viewer.