Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

File:
1 edited

Legend:

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

    r46586 r47122  
    2828
    2929    function test_delete_metadata_by_mid() {
    30         // Let's try and delete a non-existing ID, non existing meta
     30        // Let's try and delete a non-existing ID, non existing meta.
    3131        $this->assertFalse( delete_metadata_by_mid( 'user', 0 ) );
    3232        $this->assertFalse( delete_metadata_by_mid( 'non_existing_meta', $this->delete_meta_id ) );
    3333
    34         // Now let's delete the real meta data
     34        // Now let's delete the real meta data.
    3535        $this->assertTrue( delete_metadata_by_mid( 'user', $this->delete_meta_id ) );
    3636
    37         // And make sure it's been deleted
     37        // And make sure it's been deleted.
    3838        $this->assertFalse( get_metadata_by_mid( 'user', $this->delete_meta_id ) );
    3939
    40         // Make sure the caches are cleared
     40        // Make sure the caches are cleared.
    4141        $this->assertFalse( (bool) get_user_meta( $this->author->ID, 'delete_meta_key' ) );
    4242    }
    4343
    4444    function test_update_metadata_by_mid() {
    45         // Setup
     45        // Setup.
    4646        $meta = get_metadata_by_mid( 'user', $this->meta_id );
    4747
    48         // Update the meta value
     48        // Update the meta value.
    4949        $this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, 'meta_new_value' ) );
    5050        $meta = get_metadata_by_mid( 'user', $this->meta_id );
    5151        $this->assertEquals( 'meta_new_value', $meta->meta_value );
    5252
    53         // Update the meta value
     53        // Update the meta value.
    5454        $this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, 'meta_new_value', 'meta_new_key' ) );
    5555        $meta = get_metadata_by_mid( 'user', $this->meta_id );
    5656        $this->assertEquals( 'meta_new_key', $meta->meta_key );
    5757
    58         // Update the key and value
     58        // Update the key and value.
    5959        $this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, 'meta_value', 'meta_key' ) );
    6060        $meta = get_metadata_by_mid( 'user', $this->meta_id );
     
    6262        $this->assertEquals( 'meta_value', $meta->meta_value );
    6363
    64         // Update the value that has to be serialized
     64        // Update the value that has to be serialized.
    6565        $this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, array( 'first', 'second' ) ) );
    6666        $meta = get_metadata_by_mid( 'user', $this->meta_id );
    6767        $this->assertEquals( array( 'first', 'second' ), $meta->meta_value );
    6868
    69         // Let's try some invalid meta data
     69        // Let's try some invalid meta data.
    7070        $this->assertFalse( update_metadata_by_mid( 'user', 0, 'meta_value' ) );
    7171        $this->assertFalse( update_metadata_by_mid( 'user', $this->meta_id, 'meta_value', array( 'invalid', 'key' ) ) );
     
    118118        // Let's see if it returns the correct value when adding a filter.
    119119        add_filter( 'get_user_metadata', '__return_zero' );
    120         $this->assertFalse( metadata_exists( 'user', $this->author->ID, 'meta_key' ) ); // existing meta key
     120        $this->assertFalse( metadata_exists( 'user', $this->author->ID, 'meta_key' ) ); // Existing meta key.
    121121        $this->assertFalse( metadata_exists( 'user', 1234567890, 'meta_key' ) );
    122122        remove_filter( 'get_user_metadata', '__return_zero' );
     
    140140        $this->assertEquals( 1, count( $u ) );
    141141
    142         // User found is not locally defined author (it's the admin)
     142        // User found is not locally defined author (it's the admin).
    143143        $this->assertNotEquals( $this->author->user_login, $u[0]->user_login );
    144144
    145         // Test EXISTS and NOT EXISTS together, no users should be found
     145        // Test EXISTS and NOT EXISTS together, no users should be found.
    146146        $this->assertEquals(
    147147            0,
     
    220220        $this->assertFalse( metadata_exists( 'user', $this->author->ID, $key ) );
    221221
    222         // Test overslashing
     222        // Test overslashing.
    223223        $this->assertInternalType( 'int', add_metadata( 'user', $this->author->ID, $key, $value2 ) );
    224224        $this->assertEquals( $expected2, get_metadata( 'user', $this->author->ID, $key, true ) );
     
    256256        $this->assertEquals( 2, substr_count( $posts->request, 'CAST(' ) );
    257257
    258         // Make sure the newer meta_query syntax behaves in a consistent way
     258        // Make sure the newer meta_query syntax behaves in a consistent way.
    259259        $posts = new WP_Query(
    260260            array(
Note: See TracChangeset for help on using the changeset viewer.