Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (7 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/query.php

    r46586 r47122  
    4646                $query = new WP_Meta_Query(
    4747                        array(
    48                                 'foo', // empty string
    49                                 5, // int
     48                                'foo', // Empty string.
     49                                5,     // int
    5050                                false, // bool
    5151                                array(),
    … …  
    7777                $this->assertEquals( 1, substr_count( $sql['join'], 'INNER JOIN' ) );
    7878
    79                 // also check mixing key and key => value
     79                // Also check mixing key and key => value.
    8080
    8181                $query = new WP_Meta_Query(
    … …  
    175175                $query = new WP_Meta_Query();
    176176
    177                 // just meta_value
     177                // Just meta_value.
    178178                $expected = array(
    179179                        'relation' => 'OR',
    … …  
    189189                $this->assertEquals( $expected, $query->queries );
    190190
    191                 // meta_key & meta_value
     191                // meta_key & meta_value.
    192192                $expected = array(
    193193                        'relation' => 'OR',
    … …  
    205205                $this->assertEquals( $expected, $query->queries );
    206206
    207                 // meta_compare
     207                // meta_compare.
    208208                $expected = array(
    209209                        'relation' => 'OR',
    … …  
    563563                                'relation' => 'OR',
    564564
    565                                 // Empty 'compare'
     565                                // Empty 'compare'.
    566566                                array(
    567567                                        'key' => 'foo',
    568568                                ),
    569569
    570                                 // Non-empty 'compare'
     570                                // Non-empty 'compare'.
    571571                                array(
    572572                                        'key'     => 'bar',
    … …  
    574574                                ),
    575575
    576                                 // NOT EXISTS
     576                                // NOT EXISTS.
    577577                                array(
    578578                                        'key'     => 'baz',
    … …  
    580580                                ),
    581581
    582                                 // Has a value
     582                                // Has a value.
    583583                                array(
    584584                                        'key'   => 'barry',
    … …  
    586586                                ),
    587587
    588                                 // Has no key
     588                                // Has no key.
    589589                                array(
    590590                                        'value' => 'bar',
    … …  
    595595                $sql = $query1->get_sql( 'post', $wpdb->posts, 'ID', $this );
    596596
    597                 // 'foo' and 'bar' should be queried against the non-aliased table
     597                // 'foo' and 'bar' should be queried against the non-aliased table.
    598598                $this->assertSame( 1, substr_count( $sql['where'], "$wpdb->postmeta.meta_key = 'foo'" ) );
    599599                $this->assertSame( 1, substr_count( $sql['where'], "$wpdb->postmeta.meta_key = 'bar'" ) );
    600600
    601                 // NOT EXISTS compare queries are not key-only so should not be non-aliased
     601                // NOT EXISTS compare queries are not key-only so should not be non-aliased.
    602602                $this->assertSame( 0, substr_count( $sql['where'], "$wpdb->postmeta.meta_key = 'baz'" ) );
    603603
    604                 // 'AND' queries don't have key-only queries
     604                // 'AND' queries don't have key-only queries.
    605605                $query2 = new WP_Meta_Query(
    606606                        array(
    607607                                'relation' => 'AND',
    608608
    609                                 // Empty 'compare'
     609                                // Empty 'compare'.
    610610                                array(
    611611                                        'key' => 'foo',
    612612                                ),
    613613
    614                                 // Non-empty 'compare'
     614                                // Non-empty 'compare'.
    615615                                array(
    616616                                        'key'     => 'bar',
    … …  
    622622                $sql = $query2->get_sql( 'post', $wpdb->posts, 'ID', $this );
    623623
    624                 // Only 'foo' should be queried against the non-aliased table
     624                // Only 'foo' should be queried against the non-aliased table.
    625625                $this->assertSame( 1, substr_count( $sql['where'], "$wpdb->postmeta.meta_key = 'foo'" ) );
    626626                $this->assertSame( 0, substr_count( $sql['where'], "$wpdb->postmeta.meta_key = 'bar'" ) );
Note: See TracChangeset for help on using the changeset viewer.