Make WordPress Core

Changeset 40044


Ignore:
Timestamp:
02/05/2017 08:34:12 PM (8 years ago)
Author:
swissspidy
Message:

General: Add tests for wp_parse_slug_list().

Props danielbachhuber.
See #35582.

File:
1 edited

Legend:

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

    r39918 r40044  
    439439            array( array( 1, 2, 3, 4 ), '-1,2,-3,4' ),
    440440            array( array( 1, 2, 3, 4 ), array( -1, 2, '-3', '4' ) ),
     441        );
     442    }
     443
     444    /**
     445     * @dataProvider data_wp_parse_slug_list
     446     */
     447    function test_wp_parse_slug_list( $expected, $actual ) {
     448        $this->assertSame( $expected, array_values( wp_parse_slug_list( $actual ) ) );
     449    }
     450
     451    function data_wp_parse_slug_list() {
     452        return array(
     453            array( array( 'apple', 'banana', 'carrot', 'dog' ), 'apple,banana,carrot,dog' ),
     454            array( array( 'apple', 'banana', 'carrot', 'dog' ), 'apple, banana,,carrot,dog' ),
     455            array( array( 'apple', 'banana', 'carrot', 'dog' ), 'apple banana carrot dog' ),
     456            array( array( 'apple', 'banana-carrot', 'd-o-g' ), array( 'apple ', 'banana carrot', 'd o g' ) ),
    441457        );
    442458    }
Note: See TracChangeset for help on using the changeset viewer.