@@ -810,5 +810,60 @@ public function testSetRadioDefault()
810810 $this->assertEquals(' checked="checked"', set_radio('code', 'alpha', true));
811811 $this->assertEquals('', set_radio('code', 'beta', false));
812812 }
813+
814+
815+ // ------------------------------------------------------------------------
816+ public function testFormParseFormAttributesTrue()
817+ {
818+ $expected = 'readonly ';
819+ $this->assertEquals($expected, parse_form_attributes(['readonly' => true]));
820+ }
821+
822+
823+ // ------------------------------------------------------------------------
824+ public function testFormParseFormAttributesFalse()
825+ {
826+ $expected = 'disabled ';
827+ $this->assertEquals($expected, parse_form_attributes(['disabled' => false]));
828+ }
829+
830+
831+ // ------------------------------------------------------------------------
832+ public function testFormParseFormAttributesNull()
833+ {
834+ $expected = 'bar="" ';
835+ $this->assertEquals($expected, parse_form_attributes(['bar' => null]));
836+ }
837+
838+
839+ // ------------------------------------------------------------------------
840+ public function testFormParseFormAttributesStringEmpty()
841+ {
842+ $expected = 'bar="" ';
843+ $this->assertEquals($expected, parse_form_attributes(['bar' => '']));
844+ }
845+
846+
847+ // ------------------------------------------------------------------------
848+ public function testFormParseFormAttributesStringFoo()
849+ {
850+ $expected = 'bar="foo" ';
851+ $this->assertEquals($expected, parse_form_attributes(['bar' => 'foo']));
852+ }
813853
854+
855+ // ------------------------------------------------------------------------
856+ public function testFormParseFormAttributesInt0()
857+ {
858+ $expected = 'ok="0" ';
859+ $this->assertEquals($expected, parse_form_attributes(['ok' => 0]));
860+ }
861+
862+
863+ // ------------------------------------------------------------------------
864+ public function testFormParseFormAttributesInt1()
865+ {
866+ $expected = 'ok="1" ';
867+ $this->assertEquals($expected, parse_form_attributes(['ok' => 1]));
868+ }
814869}
0 commit comments