cvs: pear /HTML_Table/tests 1.phpt 10.phpt 11.phpt 12.phpt 13.phpt 14.phpt 15.phpt 16.phpt 17.phpt 2.phpt 3.phpt 4.phpt 5.phpt 6.phpt 7.phpt 8.phpt
9.phpt

From: Date: Tue, 25 Oct 2005 15:18:48 +0000
Subject: cvs: pear /HTML_Table/tests 1.phpt 10.phpt 11.phpt 12.phpt 13.phpt 14.phpt 15.phpt 16.phpt 17.phpt 2.phpt 3.phpt 4.phpt 5.phpt 6.phpt 7.phpt 8.phpt
9.phpt
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-35852@lists.php.net to get a copy of this message
dufuz Tue Oct 25 11:18:48 2005 EDT Added files: /pear/HTML_Table/tests 10.phpt 11.phpt 12.phpt 13.phpt 14.phpt 15.phpt 16.phpt 17.phpt 1.phpt 2.phpt 3.phpt 4.phpt 5.phpt 6.phpt 7.phpt 8.phpt 9.phpt Log: Should test most of the old behviour.

http://cvs.php.net/co.php/pear/HTML_Table/tests/10.phpt?r=1.1&p=1 Index: pear/HTML_Table/tests/10.phpt +++ pear/HTML_Table/tests/10.phpt --TEST-- 10.phpt: 6 row 3 column, setAllAttributes --FILE-- <?php // $Id: 10.phpt,v 1.1 2005/10/25 15:18:47 dufuz Exp $ require_once 'HTML/Table.php'; $table =& new HTML_Table('width="400"'); $data[0][] = 'Foo'; $data[0][] = 'Bar'; $data[0][] = 'Test'; $data[1][] = 'Foo'; $data[1][] = 'Bar'; $data[1][] = 'Test'; $data[2][] = 'Foo'; $data[2][] = 'Bar'; $data[2][] = 'Test'; $data[3][] = 'Foo'; $data[3][] = 'Bar'; $data[3][] = 'Test'; $data[4][] = 'Foo'; $data[4][] = 'Bar'; $data[4][] = 'Test'; $data[5][] = 'Foo'; $data[5][] = 'Bar'; $data[5][] = 'Test'; foreach($data as $key => $value) { $table->addRow($value, 'bgcolor = "yellow" align = "right"'); } // This overwrites attrs thus removing align="right" $table->setColAttributes(0, 'bgcolor = "pink"'); // This updates attrs thus keeping aligh="right" but change bgcolor $table->updateColAttributes(2, array('bgcolor = "blue"', 'bgcolor="green"', 'bgcolor="red"')); // this overwrites $table->setAllAttributes('bgcolor="pink"'); // output echo $table->toHTML(); ?> --EXPECT-- <table width="400"> <tr> <td bgcolor="pink">Foo</td> <td bgcolor="pink">Bar</td> <td bgcolor="pink">Test</td> </tr> <tr> <td bgcolor="pink">Foo</td> <td bgcolor="pink">Bar</td> <td bgcolor="pink">Test</td> </tr> <tr> <td bgcolor="pink">Foo</td> <td bgcolor="pink">Bar</td> <td bgcolor="pink">Test</td> </tr> <tr> <td bgcolor="pink">Foo</td> <td bgcolor="pink">Bar</td> <td bgcolor="pink">Test</td> </tr> <tr> <td bgcolor="pink">Foo</td> <td bgcolor="pink">Bar</td> <td bgcolor="pink">Test</td> </tr> <tr> <td bgcolor="pink">Foo</td> <td bgcolor="pink">Bar</td> <td bgcolor="pink">Test</td> </tr> </table> http://cvs.php.net/co.php/pear/HTML_Table/tests/11.phpt?r=1.1&p=1 Index: pear/HTML_Table/tests/11.phpt +++ pear/HTML_Table/tests/11.phpt --TEST-- 11.phpt: 2 row 1 column, setAutoFill / getAutoFill --FILE-- <?php // $Id: 11.phpt,v 1.1 2005/10/25 15:18:47 dufuz Exp $ require_once 'HTML/Table.php'; $table =& new HTML_Table(); $table->setAutoFill('N/A'); $data[0][] = 'Test'; $data[1][] = ''; foreach($data as $key => $value) { $table->addRow($value); } echo $table->getAutoFill() . "\n"; // output echo $table->toHTML(); ?> --EXPECT-- N/A <table> <tr> <td>Test</td> </tr> <tr> <td>N/A</td> </tr> </table> http://cvs.php.net/co.php/pear/HTML_Table/tests/12.phpt?r=1.1&p=1 Index: pear/HTML_Table/tests/12.phpt +++ pear/HTML_Table/tests/12.phpt --TEST-- 12.phpt: 2 row 2 column, setAutoGrow / getAutoGrow --FILE-- <?php // $Id: 12.phpt,v 1.1 2005/10/25 15:18:47 dufuz Exp $ require_once 'HTML/Table.php'; $table =& new HTML_Table(); $table->setAutoGrow(true); $data[0][] = 'Test'; $data[1][] = ''; $data[1][] = 'Test'; foreach($data as $key => $value) { $table->addRow($value); } var_dump($table->getAutoGrow()); // output echo $table->toHTML(); ?> --EXPECT-- bool(true) <table> <tr> <td>Test</td> <td>&nbsp;</td> </tr> <tr> <td>&nbsp;</td> <td>Test</td> </tr> </table> http://cvs.php.net/co.php/pear/HTML_Table/tests/13.phpt?r=1.1&p=1 Index: pear/HTML_Table/tests/13.phpt +++ pear/HTML_Table/tests/13.phpt --TEST-- 13.phpt: 2 row 1 column, setCellContents / getCellContents --FILE-- <?php // $Id: 13.phpt,v 1.1 2005/10/25 15:18:47 dufuz Exp $ require_once 'HTML/Table.php'; $table =& new HTML_Table(); $data[0][] = 'Test'; $data[1][] = ''; foreach($data as $key => $value) { $table->addRow($value); } echo $table->getCellContents(0, 0) . "\n"; $table->setCellContents(0, 0, 'FOOBAR'); echo $table->getCellContents(0, 0) . "\n"; // output echo $table->toHTML(); ?> --EXPECT-- Test FOOBAR <table> <tr> <td>FOOBAR</td> </tr> <tr> <td>&nbsp;</td> </tr> </table> http://cvs.php.net/co.php/pear/HTML_Table/tests/14.phpt?r=1.1&p=1 Index: pear/HTML_Table/tests/14.phpt +++ pear/HTML_Table/tests/14.phpt --TEST-- 14.phpt: 3 row 3 column, setColCount / getColCount / setRowCount / getRowCount --FILE-- <?php // $Id: 14.phpt,v 1.1 2005/10/25 15:18:47 dufuz Exp $ require_once 'HTML/Table.php'; $table =& new HTML_Table('width="400"'); $data[0][] = 'Foo'; $data[0][] = 'Bar'; $data[0][] = 'Test'; $data[1][] = 'Foo'; $data[1][] = 'Bar'; $data[1][] = 'Test'; $data[2][] = 'Foo'; $data[2][] = 'Bar'; $data[2][] = 'Test'; foreach($data as $key => $value) { $table->addRow($value, 'bgcolor = "yellow"'); } echo $table->getRowCount() . "\n"; echo $table->getColCount() . "\n"; echo $table->setRowCount(2); echo $table->setColCount(2); echo $table->getRowCount() . "\n"; echo $table->getColCount() . "\n"; // output echo $table->toHTML(); ?> --EXPECT-- 3 3 2 2 <table width="400"> <tr> <td bgcolor="yellow">Foo</td> <td bgcolor="yellow">Bar</td> </tr> <tr> <td bgcolor="yellow">Foo</td> <td bgcolor="yellow">Bar</td> </tr> </table> http://cvs.php.net/co.php/pear/HTML_Table/tests/15.phpt?r=1.1&p=1 Index: pear/HTML_Table/tests/15.phpt +++ pear/HTML_Table/tests/15.phpt --TEST-- 15.phpt: 2 row 2 column, setHeaderContents --FILE-- <?php // $Id: 15.phpt,v 1.1 2005/10/25 15:18:47 dufuz Exp $ require_once 'HTML/Table.php'; $table =& new HTML_Table('width="400"'); $data[0][] = 'Test'; $data[0][] = 'Test'; $data[1][] = 'Test'; $data[1][] = 'Test'; foreach($data as $key => $value) { $table->addRow($value, 'bgcolor = "yellow" align = "right"'); } $table->setHeaderContents(0, 0, 'Header', 'bgcolor="blue"'); // output echo $table->toHTML(); ?> --EXPECT-- <table width="400"> <tr> <th bgcolor="blue" align="right">Header</th> <td bgcolor="yellow" align="right">Test</td> </tr> <tr> <td bgcolor="yellow" align="right">Test</td> <td bgcolor="yellow" align="right">Test</td> </tr> </table> http://cvs.php.net/co.php/pear/HTML_Table/tests/16.phpt?r=1.1&p=1 Index: pear/HTML_Table/tests/16.phpt +++ pear/HTML_Table/tests/16.phpt --TEST-- 16.phpt: 2 row 2 column, setCaption --FILE-- <?php // $Id: 16.phpt,v 1.1 2005/10/25 15:18:47 dufuz Exp $ require_once 'HTML/Table.php'; $table =& new HTML_Table('width="400"'); $data[0][] = 'Test'; $data[0][] = 'Test'; $data[1][] = 'Test'; $data[1][] = 'Test'; foreach($data as $key => $value) { $table->addRow($value, 'bgcolor = "yellow" align = "right"'); } $table->setCaption('Foobar', 'bgcolor="green"'); // output echo $table->toHTML(); ?> --EXPECT-- <table width="400"> <caption bgcolor="green">Foobar</caption> <tr> <td bgcolor="yellow" align="right">Test</td> <td bgcolor="yellow" align="right">Test</td> </tr> <tr> <td bgcolor="yellow" align="right">Test</td> <td bgcolor="yellow" align="right">Test</td> </tr> </table> http://cvs.php.net/co.php/pear/HTML_Table/tests/17.phpt?r=1.1&p=1 Index: pear/HTML_Table/tests/17.phpt +++ pear/HTML_Table/tests/17.phpt --TEST-- 17.phpt: 3 row 2 column, setCaption --FILE-- <?php // $Id: 17.phpt,v 1.1 2005/10/25 15:18:47 dufuz Exp $ require_once 'HTML/Table.php'; $table =& new HTML_Table('width="400"'); $data[0][] = 'Test'; $data[0][] = 'Test'; $data[1][] = 'Test'; $data[1][] = 'Test'; $data[2][] = 'Test'; $data[2][] = 'Test'; foreach($data as $key => $value) { $table->addRow($value, 'bgcolor = "yellow" align = "right"'); } $table->setColType(0, 'TH'); $table->setRowType(1, 'TD'); $table->setRowType(2, 'TH'); // output echo $table->toHTML(); ?> --EXPECT-- <table width="400"> <tr> <th bgcolor="yellow" align="right">Test</th> <td bgcolor="yellow" align="right">Test</td> </tr> <tr> <td bgcolor="yellow" align="right">Test</td> <td bgcolor="yellow" align="right">Test</td> </tr> <tr> <th bgcolor="yellow" align="right">Test</th> <th bgcolor="yellow" align="right">Test</th> </tr> </table> http://cvs.php.net/co.php/pear/HTML_Table/tests/1.phpt?r=1.1&p=1 Index: pear/HTML_Table/tests/1.phpt +++ pear/HTML_Table/tests/1.phpt --TEST-- 1.phpt: 1 row 1 column with no extra options --FILE-- <?php // $Id: 1.phpt,v 1.1 2005/10/25 15:18:47 dufuz Exp $ require_once 'HTML/Table.php'; $table =& new HTML_Table(); $data[0][] = 'Test'; foreach($data as $key => $value) { $table->addRow($value); } // output echo $table->toHTML(); ?> --EXPECT-- <table> <tr> <td>Test</td> </tr> </table> http://cvs.php.net/co.php/pear/HTML_Table/tests/2.phpt?r=1.1&p=1 Index: pear/HTML_Table/tests/2.phpt +++ pear/HTML_Table/tests/2.phpt --TEST-- 2.phpt: 1 row 2 column with no extra options --FILE-- <?php // $Id: 2.phpt,v 1.1 2005/10/25 15:18:47 dufuz Exp $ require_once 'HTML/Table.php'; $table =& new HTML_Table(); $data[0][] = 'Test'; $data[0][] = 'Test'; foreach($data as $key => $value) { $table->addRow($value); } // output echo $table->toHTML(); ?> --EXPECT-- <table> <tr> <td>Test</td> <td>Test</td> </tr> </table> http://cvs.php.net/co.php/pear/HTML_Table/tests/3.phpt?r=1.1&p=1 Index: pear/HTML_Table/tests/3.phpt +++ pear/HTML_Table/tests/3.phpt --TEST-- 3.phpt: 2 row 2 column with no extra options --FILE-- <?php // $Id: 3.phpt,v 1.1 2005/10/25 15:18:47 dufuz Exp $ require_once 'HTML/Table.php'; $table =& new HTML_Table(); $data[0][] = 'Test'; $data[0][] = 'Test'; $data[1][] = 'Test'; $data[1][] = 'Test'; foreach($data as $key => $value) { $table->addRow($value); } // output echo $table->toHTML(); ?> --EXPECT-- <table> <tr> <td>Test</td> <td>Test</td> </tr> <tr> <td>Test</td> <td>Test</td> </tr> </table> http://cvs.php.net/co.php/pear/HTML_Table/tests/4.phpt?r=1.1&p=1 Index: pear/HTML_Table/tests/4.phpt +++ pear/HTML_Table/tests/4.phpt --TEST-- 4.phpt: 2 row 2 column with various options --FILE-- <?php // $Id: 4.phpt,v 1.1 2005/10/25 15:18:47 dufuz Exp $ require_once 'HTML/Table.php'; $table =& new HTML_Table('width="400"'); $data[0][] = 'Test'; $data[0][] = 'Test'; $data[1][] = 'Test'; $data[1][] = 'Test'; foreach($data as $key => $value) { $table->addRow($value, 'bgcolor = "yellow" align = "right"'); } // output echo $table->toHTML(); ?> --EXPECT-- <table width="400"> <tr> <td bgcolor="yellow" align="right">Test</td> <td bgcolor="yellow" align="right">Test</td> </tr> <tr> <td bgcolor="yellow" align="right">Test</td> <td bgcolor="yellow" align="right">Test</td> </tr> </table> http://cvs.php.net/co.php/pear/HTML_Table/tests/5.phpt?r=1.1&p=1 Index: pear/HTML_Table/tests/5.phpt +++ pear/HTML_Table/tests/5.phpt --TEST-- 5.phpt: 3 row 3 column, setColAttributes / updateColAttributes --FILE-- <?php // $Id: 5.phpt,v 1.1 2005/10/25 15:18:47 dufuz Exp $ require_once 'HTML/Table.php'; $table =& new HTML_Table('width="400"'); $data[0][] = 'Foo'; $data[0][] = 'Bar'; $data[0][] = 'Test'; $data[1][] = 'Foo'; $data[1][] = 'Bar'; $data[1][] = 'Test'; $data[2][] = 'Foo'; $data[2][] = 'Bar'; $data[2][] = 'Test'; foreach($data as $key => $value) { $table->addRow($value, 'bgcolor = "yellow" align = "right"'); } // This overwrites attrs thus removing align="right" $table->setColAttributes(0, 'bgcolor = "purple"'); // This updates attrs thus keeping aligh="right" but change bgcolor $table->updateColAttributes(2, 'bgcolor = "blue"'); // output echo $table->toHTML(); ?> --EXPECT-- <table width="400"> <tr> <td bgcolor="purple">Foo</td> <td bgcolor="yellow" align="right">Bar</td> <td bgcolor="blue" align="right">Test</td> </tr> <tr> <td bgcolor="purple">Foo</td> <td bgcolor="yellow" align="right">Bar</td> <td bgcolor="blue" align="right">Test</td> </tr> <tr> <td bgcolor="purple">Foo</td> <td bgcolor="yellow" align="right">Bar</td> <td bgcolor="blue" align="right">Test</td> </tr> </table> http://cvs.php.net/co.php/pear/HTML_Table/tests/6.phpt?r=1.1&p=1 Index: pear/HTML_Table/tests/6.phpt +++ pear/HTML_Table/tests/6.phpt --TEST-- 6.phpt: 6 row 3 column, setColAttributes / updateColAttributes (switching colors on each row) --FILE-- <?php // $Id: 6.phpt,v 1.1 2005/10/25 15:18:47 dufuz Exp $ require_once 'HTML/Table.php'; $table =& new HTML_Table('width="400"'); $data[0][] = 'Foo'; $data[0][] = 'Bar'; $data[0][] = 'Test'; $data[1][] = 'Foo'; $data[1][] = 'Bar'; $data[1][] = 'Test'; $data[2][] = 'Foo'; $data[2][] = 'Bar'; $data[2][] = 'Test'; $data[3][] = 'Foo'; $data[3][] = 'Bar'; $data[3][] = 'Test'; $data[4][] = 'Foo'; $data[4][] = 'Bar'; $data[4][] = 'Test'; $data[5][] = 'Foo'; $data[5][] = 'Bar'; $data[5][] = 'Test'; foreach($data as $key => $value) { $table->addRow($value, 'bgcolor = "yellow" align = "right"'); } // This overwrites attrs thus removing align="right" $table->setColAttributes(0, 'bgcolor = "purple"'); // This updates attrs thus keeping aligh="right" but change bgcolor $table->updateColAttributes(2, array('bgcolor = "blue"', 'bgcolor="green"', 'bgcolor="red"')); // output echo $table->toHTML(); ?> --EXPECT-- <table width="400"> <tr> <td bgcolor="purple">Foo</td> <td bgcolor="yellow" align="right">Bar</td> <td bgcolor="blue" align="right">Test</td> </tr> <tr> <td bgcolor="purple">Foo</td> <td bgcolor="yellow" align="right">Bar</td> <td bgcolor="green" align="right">Test</td> </tr> <tr> <td bgcolor="purple">Foo</td> <td bgcolor="yellow" align="right">Bar</td> <td bgcolor="red" align="right">Test</td> </tr> <tr> <td bgcolor="purple">Foo</td> <td bgcolor="yellow" align="right">Bar</td> <td bgcolor="blue" align="right">Test</td> </tr> <tr> <td bgcolor="purple">Foo</td> <td bgcolor="yellow" align="right">Bar</td> <td bgcolor="green" align="right">Test</td> </tr> <tr> <td bgcolor="purple">Foo</td> <td bgcolor="yellow" align="right">Bar</td> <td bgcolor="red" align="right">Test</td> </tr> </table> http://cvs.php.net/co.php/pear/HTML_Table/tests/7.phpt?r=1.1&p=1 Index: pear/HTML_Table/tests/7.phpt +++ pear/HTML_Table/tests/7.phpt --TEST-- 7.phpt: 3 row 3 column, getCellAttributes / getRowAttributes --FILE-- <?php // $Id: 7.phpt,v 1.1 2005/10/25 15:18:47 dufuz Exp $ require_once 'HTML/Table.php'; $table =& new HTML_Table('width="400"'); $data[0][] = 'Foo'; $data[0][] = 'Bar'; $data[0][] = 'Test'; $data[1][] = 'Foo'; $data[1][] = 'Bar'; $data[1][] = 'Test'; $data[2][] = 'Foo'; $data[2][] = 'Bar'; $data[2][] = 'Test'; foreach($data as $key => $value) { $table->addRow($value, 'bgcolor = "yellow" align = "right"'); } // This overwrites attrs thus removing align="right" $table->setColAttributes(0, 'bgcolor = "purple"'); // This updates attrs, change bgcolor, but in tr $table->updateRowAttributes(2, 'bgcolor = "blue"', true); // output // row 2, cell 2 var_dump($table->getCellAttributes(2, 2)); var_dump($table->getRowAttributes(2)); ?> --EXPECT-- array(2) { ["bgcolor"]=> string(6) "yellow" ["align"]=> string(5) "right" } array(1) { ["bgcolor"]=> string(4) "blue" } http://cvs.php.net/co.php/pear/HTML_Table/tests/8.phpt?r=1.1&p=1 Index: pear/HTML_Table/tests/8.phpt +++ pear/HTML_Table/tests/8.phpt --TEST-- 8.phpt: testing taboffset --FILE-- <?php // $Id: 8.phpt,v 1.1 2005/10/25 15:18:47 dufuz Exp $ require_once 'HTML/Table.php'; $table =& new HTML_Table('', 1); $data[0][] = 'Test'; foreach($data as $key => $value) { $table->addRow($value); } // output echo $table->toHTML(); ?> --EXPECT-- <table> <tr> <td>Test</td> </tr> </table> http://cvs.php.net/co.php/pear/HTML_Table/tests/9.phpt?r=1.1&p=1 Index: pear/HTML_Table/tests/9.phpt +++ pear/HTML_Table/tests/9.phpt --TEST-- 9.phpt: 6 row 3 column, updateAllAttributes --FILE-- <?php // $Id: 9.phpt,v 1.1 2005/10/25 15:18:47 dufuz Exp $ require_once 'HTML/Table.php'; $table =& new HTML_Table('width="400"'); $data[0][] = 'Foo'; $data[0][] = 'Bar'; $data[0][] = 'Test'; $data[1][] = 'Foo'; $data[1][] = 'Bar'; $data[1][] = 'Test'; $data[2][] = 'Foo'; $data[2][] = 'Bar'; $data[2][] = 'Test'; $data[3][] = 'Foo'; $data[3][] = 'Bar'; $data[3][] = 'Test'; $data[4][] = 'Foo'; $data[4][] = 'Bar'; $data[4][] = 'Test'; $data[5][] = 'Foo'; $data[5][] = 'Bar'; $data[5][] = 'Test'; foreach($data as $key => $value) { $table->addRow($value, 'bgcolor = "yellow" align = "right"'); } // This overwrites attrs thus removing align="right" $table->setColAttributes(0, 'bgcolor = "pink"'); // This updates attrs thus keeping aligh="right" but change bgcolor $table->updateColAttributes(2, array('bgcolor = "blue"', 'bgcolor="green"', 'bgcolor="red"')); // this updates $table->updateAllAttributes('bgcolor="pink"'); // output echo $table->toHTML(); ?> --EXPECT-- <table width="400"> <tr> <td bgcolor="pink">Foo</td> <td bgcolor="pink" align="right">Bar</td> <td bgcolor="pink" align="right">Test</td> </tr> <tr> <td bgcolor="pink">Foo</td> <td bgcolor="pink" align="right">Bar</td> <td bgcolor="pink" align="right">Test</td> </tr> <tr> <td bgcolor="pink">Foo</td> <td bgcolor="pink" align="right">Bar</td> <td bgcolor="pink" align="right">Test</td> </tr> <tr> <td bgcolor="pink">Foo</td> <td bgcolor="pink" align="right">Bar</td> <td bgcolor="pink" align="right">Test</td> </tr> <tr> <td bgcolor="pink">Foo</td> <td bgcolor="pink" align="right">Bar</td> <td bgcolor="pink" align="right">Test</td> </tr> <tr> <td bgcolor="pink">Foo</td> <td bgcolor="pink" align="right">Bar</td> <td bgcolor="pink" align="right">Test</td> </tr> </table>
« previous php.pear.cvs (#35852) next »