Fixing up test for HtmlHelper::selectTag() (Deprecated methods will still be tested until they are removed)

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4599 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2007-03-08 00:44:25 +00:00
parent 3b2264f56f
commit a6d0b4b844

View file

@ -47,12 +47,21 @@ class HtmlHelperTest extends UnitTestCase {
ClassRegistry::addObject('view', $view);
}
/* commented out because selectTag is deprecated
function testSelectTag() {
$result = $this->html->selectTag('Model/field', array());
$expected = '<select name="data[Model][field]" id="ModelField">'."\n".'<option value="" >&nbsp;</option>'."\n".'</select>';
$this->assertEqual($result, $expected, "Badness! Expected '{$expected}', got '{$result}'.");
}*/
@$result = $this->html->selectTag('Model/field', array());
$this->assertPattern('/^<select [^<>]+>\n<option [^<>]+>/', $result);
$this->assertPattern('/<option value="" ><\/option>/', $result);
$this->assertPattern('/<\/select>$/', $result);
$this->assertPattern('/<select[^<>]+name="data\[Model\]\[field\]"[^<>]*>/', $result);
$this->assertPattern('/<select[^<>]+id="ModelField"[^<>]*>/', $result);
$this->html->data = array('Model' => array('field' => 'value'));
@$result = $this->html->selectTag('Model/field', array('value' => 'good', 'other' => 'bad'));
$this->assertPattern('/option value=""/', $result);
$this->assertPattern('/option value="value"/', $result);
$this->assertPattern('/option value="other"/', $result);
debug($result, true);
}
function tearDown() {
unset($this->html);