/** * @test * @depends selfClosingTagWithBooleanAttributes */ public function selfClosingTagWithUserDefinedBooleanAttributes() { //declarations $qt = Silkworm::DOUBLE_QUOTE; $html = new Silkworm(); $html->setBooleanDisplayStyle("mi"); //does the short version work $html->defineBooleanAttributes("sugar-coated", "optimally-coated"); //regular parameters $html->input("type", "checkbox", "sugar-coated", "optimally-coated"); $this->assertSame("<input type={$qt}checkbox{$qt} sugar-coated optimally-coated>\n", (string) $html, "Failed to define boolean attributes from parameters."); $html = new Silkworm(); $html->setBooleanDisplayStyle("MAXIMIZED"); //does all caps work $html->defineBooleanAttributes(array("sugar-coated", "optimally-coated")); //array of parameters $html->input("type", "checkbox", "sugar-coated", "optimally-coated"); $this->assertSame("<input type={$qt}checkbox{$qt} sugar-coated={$qt}sugar-coated{$qt} optimally-coated={$qt}optimally-coated{$qt}>\n", (string) $html, "Failed to define boolean attributes from array."); $html = new Silkworm(); $html->setBooleanDisplayStyle("boolean"); //does all lowercase work $html->defineBooleanAttributes("sugar-coated, optimally-coated"); //comma delimited $html->input("type", "checkbox", "sugar-coated", "optimally-coated"); $this->assertSame("<input type={$qt}checkbox{$qt} sugar-coated={$qt}true{$qt} optimally-coated={$qt}true{$qt}>\n", (string) $html, "Failed to define boolean attributes from comma delimited list."); $html = new Silkworm(); $html->setBooleanDisplayStyle("boolean"); //does all lowercase work $html->defineBooleanAttributes("sugar-coated, optimally-coated", array("cream-filled", "fully-loaded"), "filled-with-goodness"); $html->input("type", "checkbox", "sugar-coated", "optimally-coated", "cream-filled", "fully-loaded", "filled-with-goodness"); $this->assertSame("<input type={$qt}checkbox{$qt} sugar-coated={$qt}true{$qt} optimally-coated={$qt}true{$qt} cream-filled={$qt}true{$qt} fully-loaded={$qt}true{$qt} filled-with-goodness={$qt}true{$qt}>\n", (string) $html, "Failed to define boolean attributes from mixed types."); }