public function test_label_tag() { $actual = FormTagHelper::label_tag('foo[1]', 'Foo'); $matcher = array('tag' => 'label', 'content' => 'Foo', 'attributes' => array('for' => 'foo_1')); $this->assertTag($matcher, $actual, 'Default attributes'); $actual = FormTagHelper::label_tag('foo', 'Foo', array('class' => 'bar')); $this->assertRegexp('/class="bar"/', $actual, "Additional attributes"); }
public function label($name, $text = null, $html_attributes = array()) { if (!$text) { $text = Inflector::humanize($name); } return FormTagHelper::label_tag($this->get_field_name($name), $text, $html_attributes); }