mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44:27 +02:00
3.1.13
This commit is contained in:
@@ -4,10 +4,10 @@
|
||||
For installing the PHPUnit test by composer use the following:
|
||||
|
||||
"require-dev": {
|
||||
"smarty/smarty-phpunit": "3.1.12"
|
||||
"smarty/smarty-phpunit": "3.1.13"
|
||||
}
|
||||
|
||||
Replace 3.1.12 with the installed Smarty version number.
|
||||
Replace 3.1.13 with the installed Smarty version number.
|
||||
|
||||
Starting with Smarty version 3.1.22 the "require-dev" section will be added
|
||||
to the composer.json file of the Smarty distribution.
|
||||
|
@@ -351,4 +351,63 @@ class PluginFunctionHtmlCheckboxesTest extends PHPUnit_Smarty
|
||||
|
||||
$this->assertEquals($this->normalizeString($expected), $this->normalizeString($tpl->fetch()));
|
||||
}
|
||||
|
||||
public function testDisabledStrict1()
|
||||
{
|
||||
$n = "\n";
|
||||
$expected = '<label><input type="checkbox" name="id[]" value="1000" disabled="disabled" />Joe Schmoe</label><br />'
|
||||
. $n . '<label><input type="checkbox" name="id[]" value="1001" checked="checked" disabled="disabled" />Jack Smith</label><br />'
|
||||
. $n . '<label><input type="checkbox" name="id[]" value="1002" disabled="disabled" />Jane Johnson</label><br />'
|
||||
. $n . '<label><input type="checkbox" name="id[]" value="1003" disabled="disabled" />Charlie Brown</label><br />';
|
||||
|
||||
$tpl = $this->smarty->createTemplate('eval:{html_checkboxes name="id" options=$cust_radios selected=$customer_id separator="<br />" disabled=true strict=true}');
|
||||
$tpl->assign('customer_id', new _object_toString(1001));
|
||||
$tpl->assign('cust_radios', array(
|
||||
1000 => 'Joe Schmoe',
|
||||
1001 => 'Jack Smith',
|
||||
1002 => 'Jane Johnson',
|
||||
1003 => 'Charlie Brown',
|
||||
));
|
||||
|
||||
$this->assertEquals($this->normalizeString($expected), $this->normalizeString($tpl->fetch()));
|
||||
}
|
||||
public function testDisabledStrict2()
|
||||
{
|
||||
$n = "\n";
|
||||
$expected = '<label><input type="checkbox" name="id[]" value="1000" />Joe Schmoe</label><br />'
|
||||
. $n . '<label><input type="checkbox" name="id[]" value="1001" checked="checked" />Jack Smith</label><br />'
|
||||
. $n . '<label><input type="checkbox" name="id[]" value="1002" />Jane Johnson</label><br />'
|
||||
. $n . '<label><input type="checkbox" name="id[]" value="1003" />Charlie Brown</label><br />';
|
||||
|
||||
$tpl = $this->smarty->createTemplate('eval:{html_checkboxes name="id" options=$cust_radios selected=$customer_id separator="<br />" disabled=1 strict=true}');
|
||||
$tpl->assign('customer_id', new _object_toString(1001));
|
||||
$tpl->assign('cust_radios', array(
|
||||
1000 => 'Joe Schmoe',
|
||||
1001 => 'Jack Smith',
|
||||
1002 => 'Jane Johnson',
|
||||
1003 => 'Charlie Brown',
|
||||
));
|
||||
|
||||
$this->assertEquals($expected, $tpl->fetch());
|
||||
|
||||
}
|
||||
public function testDisabledStrict3()
|
||||
{
|
||||
$n = "\n";
|
||||
$expected = '<label><input type="checkbox" name="id[]" value="1000" disabled="disabled" />Joe Schmoe</label><br />'
|
||||
. $n . '<label><input type="checkbox" name="id[]" value="1001" checked="checked" disabled="disabled" />Jack Smith</label><br />'
|
||||
. $n . '<label><input type="checkbox" name="id[]" value="1002" disabled="disabled" />Jane Johnson</label><br />'
|
||||
. $n . '<label><input type="checkbox" name="id[]" value="1003" disabled="disabled" />Charlie Brown</label><br />';
|
||||
|
||||
$tpl = $this->smarty->createTemplate('eval:{html_checkboxes name="id" options=$cust_radios selected=$customer_id separator="<br />" disabled="disabled" strict=true}');
|
||||
$tpl->assign('customer_id', new _object_toString(1001));
|
||||
$tpl->assign('cust_radios', array(
|
||||
1000 => 'Joe Schmoe',
|
||||
1001 => 'Jack Smith',
|
||||
1002 => 'Jane Johnson',
|
||||
1003 => 'Charlie Brown',
|
||||
));
|
||||
|
||||
$this->assertEquals($this->normalizeString($expected), $this->normalizeString($tpl->fetch()));
|
||||
}
|
||||
}
|
||||
|
@@ -443,4 +443,58 @@ class PluginFunctionHtmlOptionsTest extends PHPUnit_Smarty
|
||||
|
||||
$this->assertEquals($this->normalizeString($expected), $this->normalizeString($tpl->fetch()));
|
||||
}
|
||||
|
||||
public function testDisabledStrict()
|
||||
{
|
||||
$n = "\n";
|
||||
$expected = '<select name="foo">'
|
||||
. $n . '<option value="1800">Joe Schmoe</option>'
|
||||
. $n . '<option value="9904" selected="selected">Jack Smith</option>'
|
||||
. $n . '<option value="2003">Charlie Brown</option>'
|
||||
. $n . '</select>' . $n;
|
||||
|
||||
$tpl = $this->smarty->createTemplate('eval:{html_options name="foo" options=$myOptions selected=$mySelect disabled=1 strict=true}');
|
||||
$tpl->assign('mySelect', new _object_toString(9904));
|
||||
$tpl->assign('myOptions', array(
|
||||
1800 => 'Joe Schmoe',
|
||||
9904 => 'Jack Smith',
|
||||
2003 => 'Charlie Brown',
|
||||
));
|
||||
|
||||
$this->assertEquals($this->normalizeString($expected), $this->normalizeString($tpl->fetch()));
|
||||
|
||||
$n = "\n";
|
||||
$expected = '<select name="foo" disabled="disabled">'
|
||||
. $n . '<option value="1800">Joe Schmoe</option>'
|
||||
. $n . '<option value="9904" selected="selected">Jack Smith</option>'
|
||||
. $n . '<option value="2003">Charlie Brown</option>'
|
||||
. $n . '</select>' . $n;
|
||||
|
||||
$tpl = $this->smarty->createTemplate('eval:{html_options name="foo" options=$myOptions selected=$mySelect disabled=true strict=true}');
|
||||
$tpl->assign('mySelect', new _object_toString(9904));
|
||||
$tpl->assign('myOptions', array(
|
||||
1800 => 'Joe Schmoe',
|
||||
9904 => 'Jack Smith',
|
||||
2003 => 'Charlie Brown',
|
||||
));
|
||||
|
||||
$this->assertEquals($this->normalizeString($expected), $this->normalizeString($tpl->fetch()));
|
||||
|
||||
$n = "\n";
|
||||
$expected = '<select name="foo" disabled="disabled">'
|
||||
. $n . '<option value="1800">Joe Schmoe</option>'
|
||||
. $n . '<option value="9904" selected="selected">Jack Smith</option>'
|
||||
. $n . '<option value="2003">Charlie Brown</option>'
|
||||
. $n . '</select>' . $n;
|
||||
|
||||
$tpl = $this->smarty->createTemplate('eval:{html_options name="foo" options=$myOptions selected=$mySelect disabled="disabled" strict=true}');
|
||||
$tpl->assign('mySelect', new _object_toString(9904));
|
||||
$tpl->assign('myOptions', array(
|
||||
1800 => 'Joe Schmoe',
|
||||
9904 => 'Jack Smith',
|
||||
2003 => 'Charlie Brown',
|
||||
));
|
||||
|
||||
$this->assertEquals($this->normalizeString($expected), $this->normalizeString($tpl->fetch()));
|
||||
}
|
||||
}
|
||||
|
@@ -350,4 +350,58 @@ class PluginFunctionHtmlRadiosTest extends PHPUnit_Smarty
|
||||
|
||||
$this->assertEquals($this->normalizeString($expected), $this->normalizeString($tpl->fetch()));
|
||||
}
|
||||
|
||||
public function testDisabledStrict()
|
||||
{
|
||||
$n = "\n";
|
||||
$expected = '<label><input type="radio" name="id" value="1000" disabled="disabled" />Joe Schmoe</label><br />'
|
||||
. $n . '<label><input type="radio" name="id" value="1001" checked="checked" disabled="disabled" />Jack Smith</label><br />'
|
||||
. $n . '<label><input type="radio" name="id" value="1002" disabled="disabled" />Jane Johnson</label><br />'
|
||||
. $n . '<label><input type="radio" name="id" value="1003" disabled="disabled" />Charlie Brown</label><br />';
|
||||
|
||||
$tpl = $this->smarty->createTemplate('eval:{html_radios name="id" options=$cust_radios selected=$customer_id separator="<br />" disabled=true strict=true}');
|
||||
$tpl->assign('customer_id', new _object_toString(1001));
|
||||
$tpl->assign('cust_radios', array(
|
||||
1000 => 'Joe Schmoe',
|
||||
1001 => 'Jack Smith',
|
||||
1002 => 'Jane Johnson',
|
||||
1003 => 'Charlie Brown',
|
||||
));
|
||||
|
||||
$this->assertEquals($this->normalizeString($expected), $this->normalizeString($tpl->fetch()));
|
||||
|
||||
$n = "\n";
|
||||
$expected = '<label><input type="radio" name="id" value="1000" />Joe Schmoe</label><br />'
|
||||
. $n . '<label><input type="radio" name="id" value="1001" checked="checked" />Jack Smith</label><br />'
|
||||
. $n . '<label><input type="radio" name="id" value="1002" />Jane Johnson</label><br />'
|
||||
. $n . '<label><input type="radio" name="id" value="1003" />Charlie Brown</label><br />';
|
||||
|
||||
$tpl = $this->smarty->createTemplate('eval:{html_radios name="id" options=$cust_radios selected=$customer_id separator="<br />" disabled=1 strict=true}');
|
||||
$tpl->assign('customer_id', new _object_toString(1001));
|
||||
$tpl->assign('cust_radios', array(
|
||||
1000 => 'Joe Schmoe',
|
||||
1001 => 'Jack Smith',
|
||||
1002 => 'Jane Johnson',
|
||||
1003 => 'Charlie Brown',
|
||||
));
|
||||
|
||||
$this->assertEquals($this->normalizeString($expected), $this->normalizeString($tpl->fetch()));
|
||||
|
||||
$n = "\n";
|
||||
$expected = '<label><input type="radio" name="id" value="1000" disabled="disabled" />Joe Schmoe</label><br />'
|
||||
. $n . '<label><input type="radio" name="id" value="1001" checked="checked" disabled="disabled" />Jack Smith</label><br />'
|
||||
. $n . '<label><input type="radio" name="id" value="1002" disabled="disabled" />Jane Johnson</label><br />'
|
||||
. $n . '<label><input type="radio" name="id" value="1003" disabled="disabled" />Charlie Brown</label><br />';
|
||||
|
||||
$tpl = $this->smarty->createTemplate('eval:{html_radios name="id" options=$cust_radios selected=$customer_id separator="<br />" disabled="disabled" strict=true}');
|
||||
$tpl->assign('customer_id', new _object_toString(1001));
|
||||
$tpl->assign('cust_radios', array(
|
||||
1000 => 'Joe Schmoe',
|
||||
1001 => 'Jack Smith',
|
||||
1002 => 'Jane Johnson',
|
||||
1003 => 'Charlie Brown',
|
||||
));
|
||||
|
||||
$this->assertEquals($this->normalizeString($expected), $this->normalizeString($tpl->fetch()));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user