luyatests\core\helpers\ArrayHelperTest::testTypeCast PHP Method

testTypeCast() public method

public testTypeCast ( )
    public function testTypeCast()
    {
        $array = [1 => 1, '2' => '2', "3" => "3", "4" => "string", 'sub' => [1 => 1, 2 => '2', 3 => '3', 4 => 'string']];
        $typecasted = ArrayHelper::typeCast($array);
        $this->assertSame(1, $typecasted[1]);
        $this->assertSame(2, $typecasted[2]);
        $this->assertSame(3, $typecasted[3]);
        $this->assertSame('string', $typecasted[4]);
        $this->assertSame(1, $typecasted['sub'][1]);
        $this->assertSame(2, $typecasted['sub'][2]);
        $this->assertSame(3, $typecasted['sub'][3]);
        $this->assertSame('string', $typecasted['sub'][4]);
    }