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/taxonomy.php

    r46586 r47122  
    1717     */
    1818    function test_get_unknown_taxonomies() {
    19         // taxonomies for an unknown object type
     19        // Taxonomies for an unknown object type.
    2020        $this->assertEquals( array(), get_object_taxonomies( rand_str() ) );
    2121        $this->assertEquals( array(), get_object_taxonomies( '' ) );
     
    2727        foreach ( get_object_taxonomies( 'post' ) as $taxonomy ) {
    2828            $tax = get_taxonomy( $taxonomy );
    29             // should return an object with the correct taxonomy object type
     29            // Should return an object with the correct taxonomy object type.
    3030            $this->assertTrue( is_object( $tax ) );
    3131            $this->assertTrue( is_array( $tax->object_type ) );
     
    109109        foreach ( get_object_taxonomies( 'link' ) as $taxonomy ) {
    110110            $tax = get_taxonomy( $taxonomy );
    111             // should return an object with the correct taxonomy object type
     111            // Should return an object with the correct taxonomy object type.
    112112            $this->assertTrue( is_object( $tax ) );
    113113            $this->assertTrue( is_array( $tax->object_type ) );
     
    144144    function test_register_taxonomy() {
    145145
    146         // make up a new taxonomy name, and ensure it's unused
     146        // Make up a new taxonomy name, and ensure it's unused.
    147147        $tax = rand_str();
    148148        $this->assertFalse( taxonomy_exists( $tax ) );
     
    152152        $this->assertFalse( is_taxonomy_hierarchical( $tax ) );
    153153
    154         // clean up
     154        // Clean up.
    155155        unset( $GLOBALS['wp_taxonomies'][ $tax ] );
    156156    }
     
    158158    function test_register_hierarchical_taxonomy() {
    159159
    160         // make up a new taxonomy name, and ensure it's unused
     160        // Make up a new taxonomy name, and ensure it's unused.
    161161        $tax = rand_str();
    162162        $this->assertFalse( taxonomy_exists( $tax ) );
     
    166166        $this->assertTrue( is_taxonomy_hierarchical( $tax ) );
    167167
    168         // clean up
     168        // Clean up.
    169169        unset( $GLOBALS['wp_taxonomies'][ $tax ] );
    170170    }
     
    219219     */
    220220    function test_registering_taxonomies_to_object_types() {
    221         // Create a taxonomy to test with
     221        // Create a taxonomy to test with.
    222222        $tax = 'test_tax';
    223223        $this->assertFalse( taxonomy_exists( $tax ) );
    224224        register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
    225225
    226         // Create a post type to test with
     226        // Create a post type to test with.
    227227        $post_type = 'test_cpt';
    228228        $this->assertFalse( get_post_type( $post_type ) );
    229229        $this->assertObjectHasAttribute( 'name', register_post_type( $post_type ) );
    230230
    231         // Core taxonomy, core post type
     231        // Core taxonomy, core post type.
    232232        $this->assertTrue( unregister_taxonomy_for_object_type( 'category', 'post' ) );
    233233        $this->assertFalse( unregister_taxonomy_for_object_type( 'category', 'post' ) );
    234234        $this->assertTrue( register_taxonomy_for_object_type( 'category', 'post' ) );
    235235
    236         // Core taxonomy, non-core post type
     236        // Core taxonomy, non-core post type.
    237237        $this->assertTrue( register_taxonomy_for_object_type( 'category', $post_type ) );
    238238        $this->assertTrue( unregister_taxonomy_for_object_type( 'category', $post_type ) );
     
    240240        $this->assertTrue( register_taxonomy_for_object_type( 'category', $post_type ) );
    241241
    242         // Core taxonomies, non-post object types
     242        // Core taxonomies, non-post object types.
    243243        $this->assertFalse( register_taxonomy_for_object_type( 'category', 'user' ) );
    244244        $this->assertFalse( unregister_taxonomy_for_object_type( 'category', 'user' ) );
    245245
    246         // Non-core taxonomy, core post type
     246        // Non-core taxonomy, core post type.
    247247        $this->assertTrue( unregister_taxonomy_for_object_type( $tax, 'post' ) );
    248248        $this->assertFalse( unregister_taxonomy_for_object_type( $tax, 'post' ) );
    249249        $this->assertTrue( register_taxonomy_for_object_type( $tax, 'post' ) );
    250250
    251         // Non-core taxonomy, non-core post type
     251        // Non-core taxonomy, non-core post type.
    252252        $this->assertTrue( register_taxonomy_for_object_type( $tax, $post_type ) );
    253253        $this->assertTrue( unregister_taxonomy_for_object_type( $tax, $post_type ) );
     
    255255        $this->assertTrue( register_taxonomy_for_object_type( $tax, $post_type ) );
    256256
    257         // Non-core taxonomies, non-post object types
     257        // Non-core taxonomies, non-post object types.
    258258        $this->assertFalse( register_taxonomy_for_object_type( $tax, 'user' ) );
    259259        $this->assertFalse( unregister_taxonomy_for_object_type( $tax, 'user' ) );
     
    397397        $post = self::factory()->post->create_and_get();
    398398
    399         // in_category() returns false when first parameter is empty()
     399        // in_category() returns false when first parameter is empty().
    400400        $this->assertFalse( in_category( '', $post ) );
    401401        $this->assertFalse( in_category( false, $post ) );
    402402        $this->assertFalse( in_category( null, $post ) );
    403403
    404         // Test expected behavior of in_category()
     404        // Test expected behavior of in_category().
    405405        $term = wp_insert_term( 'Test', 'category' );
    406406        wp_set_object_terms( $post->ID, $term['term_id'], 'category' );
     
    948948                'tax_input' => array(
    949949                    $taxonomy_name => array(
    950                         (string) $term_id, // Cast term_id as string to match whats sent in WP Admin.
     950                        (string) $term_id, // Cast term_id as string to match what's sent in WP Admin.
    951951                    ),
    952952                ),
Note: See TracChangeset for help on using the changeset viewer.