Make WordPress Core


Ignore:
Timestamp:
07/11/2021 12:41:48 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Tests: Use more appropriate assertions in various tests.

This replaces instances of assertTrue( empty( ... ) ) with assertEmpty() to use native PHPUnit functionality.

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

See #53363.

File:
1 edited

Legend:

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

    r49024 r51403  
    1919
    2020        $upload = wp_upload_bits( $filename, null, $contents );
    21         $this->assertTrue( empty( $upload['error'] ) );
     21        $this->assertEmpty( $upload['error'] );
    2222    }
    2323
     
    2929
    3030        $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    31         $this->assertTrue( empty( $upload['error'] ) );
     31        $this->assertEmpty( $upload['error'] );
    3232
    3333        $id = $this->_make_attachment( $upload );
     
    6666
    6767        $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    68         $this->assertTrue( empty( $upload['error'] ) );
     68        $this->assertEmpty( $upload['error'] );
    6969
    7070        $id = $this->_make_attachment( $upload );
     
    120120
    121121        $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    122         $this->assertTrue( empty( $upload['error'] ) );
     122        $this->assertEmpty( $upload['error'] );
    123123
    124124        $id      = $this->_make_attachment( $upload );
     
    177177
    178178        $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    179         $this->assertTrue( empty( $upload['error'] ) );
     179        $this->assertEmpty( $upload['error'] );
    180180
    181181        $id      = $this->_make_attachment( $upload );
     
    220220
    221221        $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    222         $this->assertTrue( empty( $upload['error'] ) );
     222        $this->assertEmpty( $upload['error'] );
    223223
    224224        $upload['url'] = '';
     
    226226
    227227        $guid = get_the_guid( $id );
    228         $this->assertFalse( empty( $guid ) );
     228        $this->assertNotEmpty( $guid );
    229229    }
    230230
     
    237237
    238238        $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    239         $this->assertTrue( empty( $upload['error'] ) );
     239        $this->assertEmpty( $upload['error'] );
    240240
    241241        $id = $this->_make_attachment( $upload );
     
    263263
    264264        $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    265         $this->assertTrue( empty( $upload['error'] ) );
     265        $this->assertEmpty( $upload['error'] );
    266266
    267267        $attachment_id = $this->_make_attachment( $upload );
     
    295295
    296296        $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    297         $this->assertTrue( empty( $upload['error'] ) );
     297        $this->assertEmpty( $upload['error'] );
    298298
    299299        // Set attachment ID.
     
    320320
    321321        $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    322         $this->assertTrue( empty( $upload['error'] ) );
     322        $this->assertEmpty( $upload['error'] );
    323323
    324324        // Set attachment ID.
     
    345345
    346346        $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    347         $this->assertTrue( empty( $upload['error'] ) );
     347        $this->assertEmpty( $upload['error'] );
    348348
    349349        // Set attachment ID.
     
    373373
    374374        $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    375         $this->assertTrue( empty( $upload['error'] ) );
     375        $this->assertEmpty( $upload['error'] );
    376376
    377377        // Set attachment ID.
     
    401401
    402402        $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    403         $this->assertTrue( empty( $upload['error'] ) );
     403        $this->assertEmpty( $upload['error'] );
    404404
    405405        // Set attachment ID.
     
    428428
    429429        $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    430         $this->assertTrue( empty( $upload['error'] ) );
     430        $this->assertEmpty( $upload['error'] );
    431431
    432432        // Set attachment ID.
Note: See TracChangeset for help on using the changeset viewer.