mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
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:
parent
3b2264f56f
commit
a6d0b4b844
1 changed files with 16 additions and 7 deletions
|
@ -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="" > </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);
|
||||
|
|
Loading…
Add table
Reference in a new issue