| [ Index ] |
PHP Cross Reference of Web Application Component Toolkit |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package WACT_TESTS 4 * @version $Id: formview.test.php,v 1.10 2004/11/12 21:25:20 jeffmoore Exp $ 5 */ 6 /** 7 * Include class to test 8 */ 9 require_once WACT_ROOT . 'view/formview.inc.php'; 10 require_once WACT_ROOT . 'util/dataspace.inc.php'; 11 require_once WACT_ROOT . 'template/template.inc.php'; 12 require_once WACT_ROOT . 'template/components/form/form.inc.php'; 13 require_once WACT_ROOT . 'validation/validator.inc.php'; 14 15 Mock::generate('DataSpace','MockDataSpace'); 16 Mock::generate('Template','MockTemplate'); 17 Mock::generate('FormComponent','MockFormComponent'); 18 Mock::generate('Validator','MockValidator'); 19 20 Mock::generatePartial('FormView','FormViewTestVersion',array('FormView','findForm')); 21 22 /** 23 * @package WACT_TESTS 24 */ 25 class FormViewTestCase extends UnitTestCase { 26 function FormViewTestCase($name = 'FormView test cases') { 27 $this->UnitTestCase($name); 28 } 29 function testDisplay() { 30 $file ='test.html'; 31 $View =& new FormViewTestVersion($file); 32 $View->Template = & new MockTemplate($this); 33 $View->Template->expectOnce('display'); 34 $View->display(); 35 $View->Template->tally(); 36 } 37 function testSetModel() { 38 $file ='test.html'; 39 $View =& new FormViewTestVersion($file); 40 $View->Form = & new MockFormComponent($this); 41 $View->Form->expectOnce('registerDataSource'); 42 $MockDS = & new MockDataSpace($this); 43 $View->setModel($MockDS); 44 $View->Form->tally(); 45 } 46 function testPreserveState() { 47 $file ='test.html'; 48 $preserve = array ('red','green','blue'); 49 $View =& new FormViewTestVersion($file); 50 $View->Form = & new MockFormComponent($this); 51 $View->Form->expectCallCount('preserveState',3); 52 $View->preserveState($preserve); 53 $View->Form->tally(); 54 } 55 function testSetErrors() { 56 $file ='test.html'; 57 $View =& new FormViewTestVersion($file); 58 $View->Form = & new MockFormComponent($this); 59 $View->Form->expectOnce('setErrors'); 60 $Validator = & new MockValidator($this); 61 $Validator->expectOnce('getErrorList'); 62 $View->setErrors($Validator); 63 $View->Form->tally(); 64 $Validator->tally(); 65 $View->tally(); 66 } 67 function testCanClientValidate() { 68 $file ='test.html'; 69 $View =& new FormViewTestVersion($file); 70 $this->assertTrue($View->canClientValidate()); 71 } 72 } 73 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sun Nov 28 19:36:09 2004 | Cross-referenced by PHPXref 0.5 |