Applying patch from ticket #2496, adding test for it

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4893 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
dho 2007-04-28 08:57:34 +00:00
parent 5692e7f344
commit da0dacb013
2 changed files with 4 additions and 1 deletions

View file

@ -300,7 +300,7 @@ class FormHelper extends AppHelper {
$tagName = implode('.', array_filter(array($this->model(), $this->field())));
}
if ($text == null) {
if ($text === null) {
if (strpos($tagName, '/') !== false || strpos($tagName, '.') !== false) {
list( , $text) = preg_split('/[\/\.]+/', $tagName);
} else {

View file

@ -430,6 +430,9 @@ class FormHelperTest extends CakeTestCase {
$result = $this->Form->label('first_name', 'Your first name', array('class' => 'my-class', 'id' => 'LabelID'));
$this->assertEqual($result, '<label for="first_name" class="my-class" id="LabelID">Your first name</label>');
$result = $this->Form->label('first_name', '');
$this->assertEqual($result, '<label for="first_name"></label>');
}
function testTextbox() {