WordPress.org

Make WordPress Core

Changeset 31310


Ignore:
Timestamp:
01/31/2015 02:01:46 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Add a unit test that expects wp_parse_args() to treat 'true' and 'false' in a query string as strings.

props voldemortensen for initial patch.
see #30753.

File:
1 edited

Legend:

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

    r31052 r31310  
    1414        $this->assertEquals(array(), wp_parse_args($y));
    1515    }
     16
    1617    function test_wp_parse_args_array()  {
    1718        // arrays
     
    2122        $this->assertEquals(array('_baba' => 5, 'yZ' => 'baba', 'a' => array(5, 111, 'x')), wp_parse_args($b));
    2223    }
     24
    2325    function test_wp_parse_args_defaults() {
    2426        $x = new MockClass;
     
    3133        $this->assertEquals(array('_baba' => 5, 'yZ' => 'baba', 'a' => array(5, 111, 'x')), wp_parse_args($x, $e));
    3234    }
     35
    3336    function test_wp_parse_args_other() {
    3437        $b = true;
     
    3942        $this->assertEquals($ss, wp_parse_args($q));
    4043    }
     44
     45    /**
     46     * @ticket 30753
     47     */
     48    function test_wp_parse_args_boolean_strings() {
     49        $args = wp_parse_args( 'foo=false&bar=true', array() );
     50        $this->assertInternalType( 'string', $args['foo'] );
     51        $this->assertInternalType( 'string', $args['bar'] );
     52    }
     53
    4154    function test_size_format() {
    4255        $b  = 1;
Note: See TracChangeset for help on using the changeset viewer.