Skip to content
This repository was archived by the owner on Apr 13, 2020. It is now read-only.

Commit fe9cd1e

Browse files
committed
3.1.13
1 parent 2a29ce7 commit fe9cd1e

File tree

4 files changed

+169
-2
lines changed

4 files changed

+169
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
For installing the PHPUnit test by composer use the following:
55

66
"require-dev": {
7-
"smarty/smarty-phpunit": "3.1.12"
7+
"smarty/smarty-phpunit": "3.1.13"
88
}
99

10-
Replace 3.1.12 with the installed Smarty version number.
10+
Replace 3.1.13 with the installed Smarty version number.
1111

1212
Starting with Smarty version 3.1.22 the "require-dev" section will be added
1313
to the composer.json file of the Smarty distribution.

UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlCheckboxesTest.php

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,4 +351,63 @@ public function testDisabled()
351351

352352
$this->assertEquals($this->normalizeString($expected), $this->normalizeString($tpl->fetch()));
353353
}
354+
355+
public function testDisabledStrict1()
356+
{
357+
$n = "\n";
358+
$expected = '<label><input type="checkbox" name="id[]" value="1000" disabled="disabled" />Joe Schmoe</label><br />'
359+
. $n . '<label><input type="checkbox" name="id[]" value="1001" checked="checked" disabled="disabled" />Jack Smith</label><br />'
360+
. $n . '<label><input type="checkbox" name="id[]" value="1002" disabled="disabled" />Jane Johnson</label><br />'
361+
. $n . '<label><input type="checkbox" name="id[]" value="1003" disabled="disabled" />Charlie Brown</label><br />';
362+
363+
$tpl = $this->smarty->createTemplate('eval:{html_checkboxes name="id" options=$cust_radios selected=$customer_id separator="<br />" disabled=true strict=true}');
364+
$tpl->assign('customer_id', new _object_toString(1001));
365+
$tpl->assign('cust_radios', array(
366+
1000 => 'Joe Schmoe',
367+
1001 => 'Jack Smith',
368+
1002 => 'Jane Johnson',
369+
1003 => 'Charlie Brown',
370+
));
371+
372+
$this->assertEquals($this->normalizeString($expected), $this->normalizeString($tpl->fetch()));
373+
}
374+
public function testDisabledStrict2()
375+
{
376+
$n = "\n";
377+
$expected = '<label><input type="checkbox" name="id[]" value="1000" />Joe Schmoe</label><br />'
378+
. $n . '<label><input type="checkbox" name="id[]" value="1001" checked="checked" />Jack Smith</label><br />'
379+
. $n . '<label><input type="checkbox" name="id[]" value="1002" />Jane Johnson</label><br />'
380+
. $n . '<label><input type="checkbox" name="id[]" value="1003" />Charlie Brown</label><br />';
381+
382+
$tpl = $this->smarty->createTemplate('eval:{html_checkboxes name="id" options=$cust_radios selected=$customer_id separator="<br />" disabled=1 strict=true}');
383+
$tpl->assign('customer_id', new _object_toString(1001));
384+
$tpl->assign('cust_radios', array(
385+
1000 => 'Joe Schmoe',
386+
1001 => 'Jack Smith',
387+
1002 => 'Jane Johnson',
388+
1003 => 'Charlie Brown',
389+
));
390+
391+
$this->assertEquals($expected, $tpl->fetch());
392+
393+
}
394+
public function testDisabledStrict3()
395+
{
396+
$n = "\n";
397+
$expected = '<label><input type="checkbox" name="id[]" value="1000" disabled="disabled" />Joe Schmoe</label><br />'
398+
. $n . '<label><input type="checkbox" name="id[]" value="1001" checked="checked" disabled="disabled" />Jack Smith</label><br />'
399+
. $n . '<label><input type="checkbox" name="id[]" value="1002" disabled="disabled" />Jane Johnson</label><br />'
400+
. $n . '<label><input type="checkbox" name="id[]" value="1003" disabled="disabled" />Charlie Brown</label><br />';
401+
402+
$tpl = $this->smarty->createTemplate('eval:{html_checkboxes name="id" options=$cust_radios selected=$customer_id separator="<br />" disabled="disabled" strict=true}');
403+
$tpl->assign('customer_id', new _object_toString(1001));
404+
$tpl->assign('cust_radios', array(
405+
1000 => 'Joe Schmoe',
406+
1001 => 'Jack Smith',
407+
1002 => 'Jane Johnson',
408+
1003 => 'Charlie Brown',
409+
));
410+
411+
$this->assertEquals($this->normalizeString($expected), $this->normalizeString($tpl->fetch()));
412+
}
354413
}

UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlOptionsTest.php

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,4 +443,58 @@ public function testDisabled()
443443

444444
$this->assertEquals($this->normalizeString($expected), $this->normalizeString($tpl->fetch()));
445445
}
446+
447+
public function testDisabledStrict()
448+
{
449+
$n = "\n";
450+
$expected = '<select name="foo">'
451+
. $n . '<option value="1800">Joe Schmoe</option>'
452+
. $n . '<option value="9904" selected="selected">Jack Smith</option>'
453+
. $n . '<option value="2003">Charlie Brown</option>'
454+
. $n . '</select>' . $n;
455+
456+
$tpl = $this->smarty->createTemplate('eval:{html_options name="foo" options=$myOptions selected=$mySelect disabled=1 strict=true}');
457+
$tpl->assign('mySelect', new _object_toString(9904));
458+
$tpl->assign('myOptions', array(
459+
1800 => 'Joe Schmoe',
460+
9904 => 'Jack Smith',
461+
2003 => 'Charlie Brown',
462+
));
463+
464+
$this->assertEquals($this->normalizeString($expected), $this->normalizeString($tpl->fetch()));
465+
466+
$n = "\n";
467+
$expected = '<select name="foo" disabled="disabled">'
468+
. $n . '<option value="1800">Joe Schmoe</option>'
469+
. $n . '<option value="9904" selected="selected">Jack Smith</option>'
470+
. $n . '<option value="2003">Charlie Brown</option>'
471+
. $n . '</select>' . $n;
472+
473+
$tpl = $this->smarty->createTemplate('eval:{html_options name="foo" options=$myOptions selected=$mySelect disabled=true strict=true}');
474+
$tpl->assign('mySelect', new _object_toString(9904));
475+
$tpl->assign('myOptions', array(
476+
1800 => 'Joe Schmoe',
477+
9904 => 'Jack Smith',
478+
2003 => 'Charlie Brown',
479+
));
480+
481+
$this->assertEquals($this->normalizeString($expected), $this->normalizeString($tpl->fetch()));
482+
483+
$n = "\n";
484+
$expected = '<select name="foo" disabled="disabled">'
485+
. $n . '<option value="1800">Joe Schmoe</option>'
486+
. $n . '<option value="9904" selected="selected">Jack Smith</option>'
487+
. $n . '<option value="2003">Charlie Brown</option>'
488+
. $n . '</select>' . $n;
489+
490+
$tpl = $this->smarty->createTemplate('eval:{html_options name="foo" options=$myOptions selected=$mySelect disabled="disabled" strict=true}');
491+
$tpl->assign('mySelect', new _object_toString(9904));
492+
$tpl->assign('myOptions', array(
493+
1800 => 'Joe Schmoe',
494+
9904 => 'Jack Smith',
495+
2003 => 'Charlie Brown',
496+
));
497+
498+
$this->assertEquals($this->normalizeString($expected), $this->normalizeString($tpl->fetch()));
499+
}
446500
}

UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlRadiosTest.php

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,4 +350,58 @@ public function testDisabled()
350350

351351
$this->assertEquals($this->normalizeString($expected), $this->normalizeString($tpl->fetch()));
352352
}
353+
354+
public function testDisabledStrict()
355+
{
356+
$n = "\n";
357+
$expected = '<label><input type="radio" name="id" value="1000" disabled="disabled" />Joe Schmoe</label><br />'
358+
. $n . '<label><input type="radio" name="id" value="1001" checked="checked" disabled="disabled" />Jack Smith</label><br />'
359+
. $n . '<label><input type="radio" name="id" value="1002" disabled="disabled" />Jane Johnson</label><br />'
360+
. $n . '<label><input type="radio" name="id" value="1003" disabled="disabled" />Charlie Brown</label><br />';
361+
362+
$tpl = $this->smarty->createTemplate('eval:{html_radios name="id" options=$cust_radios selected=$customer_id separator="<br />" disabled=true strict=true}');
363+
$tpl->assign('customer_id', new _object_toString(1001));
364+
$tpl->assign('cust_radios', array(
365+
1000 => 'Joe Schmoe',
366+
1001 => 'Jack Smith',
367+
1002 => 'Jane Johnson',
368+
1003 => 'Charlie Brown',
369+
));
370+
371+
$this->assertEquals($this->normalizeString($expected), $this->normalizeString($tpl->fetch()));
372+
373+
$n = "\n";
374+
$expected = '<label><input type="radio" name="id" value="1000" />Joe Schmoe</label><br />'
375+
. $n . '<label><input type="radio" name="id" value="1001" checked="checked" />Jack Smith</label><br />'
376+
. $n . '<label><input type="radio" name="id" value="1002" />Jane Johnson</label><br />'
377+
. $n . '<label><input type="radio" name="id" value="1003" />Charlie Brown</label><br />';
378+
379+
$tpl = $this->smarty->createTemplate('eval:{html_radios name="id" options=$cust_radios selected=$customer_id separator="<br />" disabled=1 strict=true}');
380+
$tpl->assign('customer_id', new _object_toString(1001));
381+
$tpl->assign('cust_radios', array(
382+
1000 => 'Joe Schmoe',
383+
1001 => 'Jack Smith',
384+
1002 => 'Jane Johnson',
385+
1003 => 'Charlie Brown',
386+
));
387+
388+
$this->assertEquals($this->normalizeString($expected), $this->normalizeString($tpl->fetch()));
389+
390+
$n = "\n";
391+
$expected = '<label><input type="radio" name="id" value="1000" disabled="disabled" />Joe Schmoe</label><br />'
392+
. $n . '<label><input type="radio" name="id" value="1001" checked="checked" disabled="disabled" />Jack Smith</label><br />'
393+
. $n . '<label><input type="radio" name="id" value="1002" disabled="disabled" />Jane Johnson</label><br />'
394+
. $n . '<label><input type="radio" name="id" value="1003" disabled="disabled" />Charlie Brown</label><br />';
395+
396+
$tpl = $this->smarty->createTemplate('eval:{html_radios name="id" options=$cust_radios selected=$customer_id separator="<br />" disabled="disabled" strict=true}');
397+
$tpl->assign('customer_id', new _object_toString(1001));
398+
$tpl->assign('cust_radios', array(
399+
1000 => 'Joe Schmoe',
400+
1001 => 'Jack Smith',
401+
1002 => 'Jane Johnson',
402+
1003 => 'Charlie Brown',
403+
));
404+
405+
$this->assertEquals($this->normalizeString($expected), $this->normalizeString($tpl->fetch()));
406+
}
353407
}

0 commit comments

Comments
 (0)