| [ Index ] |
PHP Cross Reference of Limb3 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * Limb PHP Framework 4 * 5 * @link http://limb-project.com 6 * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com) 7 * @license LGPL http://www.gnu.org/copyleft/lesser.html 8 */ 9 10 11 class WactFormErrorsTagTest extends WactTemplateTestCase 12 { 13 function testProperNesting() 14 { 15 $template = '<form:errors target="errors"/><list:list id="errors"></list>'; 16 17 $this->registerTestingTemplate('/form/form_errors/proper_nesting.html', $template); 18 19 try 20 { 21 $page = $this->initTemplate('/form/form_errors/proper_nesting.html'); 22 $this->assertTrue(false); 23 } 24 catch(WactException $e){} 25 } 26 27 function testTargetAttributeOrNestingListTagIsRequired() 28 { 29 $template = '<form runat="server"><form:errors/><list:list id="errors"></list:list></form>'; 30 31 $this->registerTestingTemplate('/form/form_errors/target_required.html', $template); 32 33 try 34 { 35 $page = $this->initTemplate('/form/form_errors/target_required.html'); 36 $this->assertTrue(false); 37 } 38 catch(WactException $e){} 39 } 40 41 function testErrorsPassedToListListTag() 42 { 43 $template = '<form id="my_form" runat="server"><form:errors target="errors"/>'. 44 '<list:list id="errors"><list:item>{$message}</list:item></list:list>'. 45 '</form>'; 46 47 $this->registerTestingTemplate('/form/form_errors/passed_to_list.html', $template); 48 49 $page = $this->initTemplate('/form/form_errors/passed_to_list.html'); 50 51 $error_list = new WactFormErrorList(); 52 $error_list->addError('Error1 text'); 53 $error_list->addError('Error2 text'); 54 55 $form = $page->getChild("my_form"); 56 $form->setErrors($error_list); 57 58 $this->assertEqual($page->capture(), '<form id="my_form">Error1 textError2 text</form>'); 59 } 60 61 function testErrorsPassedToListListTagIfInsideFormErrorsTag() 62 { 63 $template = '<form id="my_form" runat="server"><form:errors>'. 64 '<list:list><list:item>{$message}</list:item></list:list></form:errors>'. 65 '</form>'; 66 67 $this->registerTestingTemplate('/form/form_errors/passed_to_nested_list.html', $template); 68 69 $page = $this->initTemplate('/form/form_errors/passed_to_nested_list.html'); 70 71 $error_list = new WactFormErrorList(); 72 $error_list->addError('Error1 text'); 73 $error_list->addError('Error2 text'); 74 75 $form = $page->getChild("my_form"); 76 $form->setErrors($error_list); 77 78 $this->assertEqual($page->capture(), '<form id="my_form">Error1 textError2 text</form>'); 79 } 80 } 81 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Jan 8 04:06:23 2009 | Cross-referenced by PHPXref 0.7 |