Make WordPress Core


Ignore:
Timestamp:
10/28/2014 06:12:30 PM (12 years ago)
Author:
boonebgorges
Message:

Introduce orderby=include support for get_terms().

Props wpsmith.
Fixes #23261.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/term/getTerms.php

    r30042 r30052  
    797797        }
    798798
     799        /**
     800         * @ticket 23261
     801         */
     802        public function test_orderby_include() {
     803                $tax = 'wptests_tax';
     804                register_taxonomy( $tax, 'post' );
     805
     806                $t1 = $this->factory->term->create( array( 'taxonomy' => $tax ) );
     807                $t2 = $this->factory->term->create( array( 'taxonomy' => $tax ) );
     808                $t3 = $this->factory->term->create( array( 'taxonomy' => $tax ) );
     809                $t4 = $this->factory->term->create( array( 'taxonomy' => $tax ) );
     810
     811                $found = get_terms( $tax, array(
     812                        'fields' => 'ids',
     813                        'include' => array( $t4, $t1, $t2 ),
     814                        'orderby' => 'include',
     815                        'hide_empty' => false,
     816                ) );
     817
     818                _unregister_taxonomy( 'wptests_tax' );
     819
     820                $this->assertEquals( array( $t4, $t1, $t2 ), $found );
     821        }
     822
    799823        protected function create_hierarchical_terms_and_posts() {
    800824
Note: See TracChangeset for help on using the changeset viewer.