Make WordPress Core


Ignore:
Timestamp:
08/29/2013 06:58:40 PM (13 years ago)
Author:
nacin
Message:

Basic tests for wp_parse_id_list() to ensure positive integers. see [25169].

File:
1 edited

Legend:

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

    r25002 r25170  
    337337                update_option( 'blog_charset', $orig_blog_charset );
    338338        }
     339
     340        /**
     341         * @dataProvider data_wp_parse_id_list
     342         */
     343        function test_wp_parse_id_list( $expected, $actual ) {
     344                $this->assertSame( $expected, array_values( wp_parse_id_list( $actual ) ) );
     345        }
     346
     347        function data_wp_parse_id_list() {
     348                return array(
     349                        array( array( 1, 2, 3, 4 ), '1,2,3,4' ),
     350                        array( array( 1, 2, 3, 4 ), '1, 2,,3,4' ),
     351                        array( array( 1, 2, 3, 4 ), '1,2,2,3,4' ),
     352                        array( array( 1, 2, 3, 4 ), array( '1', '2', '3', '4', '3' ) ),
     353                        array( array( 1, 2, 3, 4 ), array( 1, '2', 3, '4' ) ),
     354                        array( array( 1, 2, 3, 4 ), '-1,2,-3,4' ),
     355                        array( array( 1, 2, 3, 4 ), array( -1, 2, '-3', '4' ) ),
     356                );
     357        }
    339358}
Note: See TracChangeset for help on using the changeset viewer.