Making WordPress.org


Ignore:
Timestamp:
03/05/2021 12:05:23 AM (4 years ago)
Author:
coffee2code
Message:

Handbooks: Use WPorg_Handbook_Init::get_post_types() as the canonical source for obtaining all handbook post types.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/phpunit/tests/init.php

    r10765 r10768  
    101101    }
    102102
     103    public function test_get_post_types_custom() {
     104        reinit_handbooks( [ 'plugins-handbook', 'themes' ], 'post_types' );
     105
     106        // Note: The automatic appending of '-handbook' is for back-compat.
     107        $this->assertEquals( ['plugins-handbook', 'themes-handbook'], WPorg_Handbook_Init::get_post_types() );
     108    }
     109
    103110    public function test_get_post_types_filtered() {
     111        add_filter( 'handbook_post_types', function ( $post_types ) {
     112            $post_types[] = 'example';
     113            return $post_types;
     114        }, 11 );
    104115        reinit_handbooks( [ 'plugins', 'themes' ], 'post_types' );
    105116
    106117        // Note: The automatic appending of '-handbook' is for back-compat.
    107         $this->assertEquals( ['plugins-handbook', 'themes-handbook'], WPorg_Handbook_Init::get_post_types() );
     118        $this->assertEquals( [ 'plugins-handbook', 'themes-handbook', 'example-handbook' ], WPorg_Handbook_Init::get_post_types() );
    108119    }
    109120
Note: See TracChangeset for help on using the changeset viewer.