public function testFormElement() { $element = new Text("name"); $element->setLabel('name'); $element->setAttributes(array('class' => 'big-input')); $element->setAttribute('placeholder', 'Type the name'); $this->assertEquals($element->getLabel(), 'name'); $this->assertEquals($element->getAttributes(), array('class' => 'big-input', 'placeholder' => 'Type the name')); $this->assertEquals($element->getAttribute('class'), 'big-input'); $this->assertEquals($element->getAttribute('placeholder', 'the name'), 'Type the name'); $this->assertEquals($element->getAttribute('lang', 'en'), 'en'); }
public function testFormElement() { $this->specify("Form elements do not store attributes/labels properly", function () { $element = new Text("name"); $element->setLabel('name'); $element->setAttributes(array('class' => 'big-input')); $element->setAttribute('placeholder', 'Type the name'); expect($element->getLabel())->equals('name'); expect($element->getAttributes())->equals(array('class' => 'big-input', 'placeholder' => 'Type the name')); expect($element->getAttribute('class'))->equals('big-input'); expect($element->getAttribute('placeholder', 'the name'))->equals('Type the name'); expect($element->getAttribute('lang', 'en'))->equals('en'); }); }