![]() |
Xataface 2.0
Xataface Application Framework
|
00001 <?php 00002 ini_set('include_path', dirname(__FILE__).'/../../..:'.dirname(__FILE__).'/../../../lib:'.ini_get('include_path')); 00003 00004 require_once 'PHPUnit.php'; 00005 00006 require_once 'HTML/QuickForm/table.php'; 00007 require_once 'HTML/QuickForm/text.php'; 00008 00009 00010 class QuickForm_table_test extends PHPUnit_TestCase { 00011 00012 var $el; 00013 00014 function QuickForm_table_test( $name = 'QuickForm_table_test'){ 00015 $this->PHPUnit_TestCase($name); 00016 } 00017 00018 function setUp(){ 00019 $this->el = new HTML_QuickForm_table('test_table','Testing'); 00020 $this->el->addField( new HTML_QuickForm_text('fname','First Name')); 00021 $this->el->addField( new HTML_QuickForm_text('lname','Last Name')); 00022 00023 00024 } 00025 00026 function tearDown(){ 00027 00028 00029 } 00030 00031 function test_Html(){ 00032 $this->assertEquals($this->el->toHtml(), ''); 00033 00034 } 00035 00036 00037 function test_Html_with_values(){ 00038 $el = unserialize(serialize($this->el)); 00039 $el->setName('test_table_2'); 00040 00041 $el->setValue( 00042 array( 00043 array('fname'=>'John','lname'=>'Stamos'), 00044 array('fname'=>'Sally','lname'=>'Field'), 00045 array('fname'=>'Steve','lname'=>'Field') 00046 ) 00047 ); 00048 $this->assertEquals($el->toHtml(), ''); 00049 } 00050 00051 00052 00053 } 00054 00055 $test = new PHPUnit_TestSuite('QuickForm_table_test'); 00056 00057 $result = PHPUnit::run($test); 00058 00059 print $result->toString(); 00060 00061 00062 ?>