Phalcon\Test\Unit\Tag\TagSelectStaticTest::testSelectStaticOptGroupArrayParameterWithId PHP Method

testSelectStaticOptGroupArrayParameterWithId() public method

Tests selectStatic with array as a parameters and id in it
Since: 2014-09-05
Author: Nikolaos Dimopoulos ([email protected])
    public function testSelectStaticOptGroupArrayParameterWithId()
    {
        $this->specify("selectStatic with array parameter with id returns invalid HTML", function () {
            Tag::resetInput();
            $params = ['x_name', 'id' => 'x_id', 'class' => 'x_class'];
            $options = ["Active" => ['A1' => 'A One', 'A2' => 'A Two'], "B" => "B One"];
            $expected = '<select id="x_id" name="x_name" class="x_class">' . PHP_EOL . chr(9) . '<optgroup label="Active">' . PHP_EOL . chr(9) . '<option value="A1">A One</option>' . PHP_EOL . chr(9) . '<option value="A2">A Two</option>' . PHP_EOL . chr(9) . '</optgroup>' . PHP_EOL . chr(9) . '<option value="B">B One</option>' . PHP_EOL . '</select>';
            $actual = Tag::selectStatic($params, $options);
            Tag::resetInput();
            expect($actual)->equals($expected);
        });
    }