public function setAttribute($key, $value) { $key = strtolower($key); if (!is_array($value)) { $value = ['value' => $value, 'doubleQuote' => true]; } $this->attr[$key] = $value; return $this; }
public function testSetAttributeNoArray() { $tag = new Tag('a'); $tag->setAttribute('href', 'http://google.com'); $attribute = $tag->getAttribute('href'); $this->assertEquals('http://google.com', $attribute['value']); }