/** * test parsing attributes. * * @return void */ function testParseAttributeCompact() { $helper = new TestHelper($this->View); $compact = array('compact', 'checked', 'declare', 'readonly', 'disabled', 'selected', 'defer', 'ismap', 'nohref', 'noshade', 'nowrap', 'multiple', 'noresize'); foreach ($compact as $attribute) { foreach (array('true', true, 1, '1', $attribute) as $value) { $attrs = array($attribute => $value); $expected = ' ' . $attribute . '="' . $attribute . '"'; $this->assertEqual($helper->parseAttributes($attrs), $expected, '%s Failed on ' . $value); } } $this->assertEqual($helper->parseAttributes(array('compact')), ' compact="compact"'); $helper = new Html5TestHelper($this->View); $expected = ' require'; $this->assertEqual($helper->parseAttributes(array('require')), $expected); $this->assertEqual($helper->parseAttributes(array('require' => true)), $expected); $this->assertEqual($helper->parseAttributes(array('require' => false)), ''); }