cvs: pear /HTML_Progress/tests HTML_Progress_TestCase_DM.php HTML_Progress_TestCase_DM_setIncrement.php HTML_Progress_TestCase_DM_setMaximum.php
HTML_Progress_TestCase_DM_setMinimum.php HTML_Progress_TestCase_DM_setValue.php HTML_Progress_TestCase_UI_getBorderAttributes.php
HTML_Progress_TestCase_UI_getCellAttributes.php HTML_Progress_TestCase_UI_getProgressAttributes.php HTML_Progress_TestCase_UI_getStringAttributes.php
HTML_Progress_TestCase_UI_setCellAttributes.php HTML_Progress_TestCase_UI_setCellCoordinates.php HTML_Progress_TestCase_UI_setCellCount.php
HTML_Progress_TestCase_UI_setFillWay.php HTML_Progress_TestCase_UI_setOrientation.php HTML_Progress_TestCase_UI_setScript.php
HTML_Progress_TestCase_addListener.php HTML_Progress_TestCase_getDM.php HTML_Progress_TestCase_getString.php HTML_Progress_TestCase_getUI.php
HTML_Progress_TestCase_removeListener.php HTML_Progress_TestCase_setAnimSpeed.php HTML_Progress_TestCase_setBorderPainted.php
HTML_Progress_TestCase_setDM.php HTML_Progress_TestCase_setIndeterminate.php HTML_Progress_TestCase_setModel.php HTML_Progress_TestCase_setString.php
HTML_Progress_TestCase_setStringPainted.php HTML_Progress_TestCase_setUI.php ancestor.ini testsuite.php
| From: | Laurent Laville | Date: | Wed, 05 May 2004 18:24:06 +0000 |
| Subject: | cvs: pear /HTML_Progress/tests HTML_Progress_TestCase_DM.php HTML_Progress_TestCase_DM_setIncrement.php HTML_Progress_TestCase_DM_setMaximum.php HTML_Progress_TestCase_DM_setMinimum.php HTML_Progress_TestCase_DM_setValue.php HTML_Progress_TestCase_UI_getBorderAttributes.php HTML_Progress_TestCase_UI_getCellAttributes.php HTML_Progress_TestCase_UI_getProgressAttributes.php HTML_Progress_TestCase_UI_getStringAttributes.php HTML_Progress_TestCase_UI_setCellAttributes.php HTML_Progress_TestCase_UI_setCellCoordinates.php HTML_Progress_TestCase_UI_setCellCount.php HTML_Progress_TestCase_UI_setFillWay.php HTML_Progress_TestCase_UI_setOrientation.php HTML_Progress_TestCase_UI_setScript.php HTML_Progress_TestCase_addListener.php HTML_Progress_TestCase_getDM.php HTML_Progress_TestCase_getString.php HTML_Progress_TestCase_getUI.php HTML_Progress_TestCase_removeListener.php HTML_Progress_TestCase_setAnimSpeed.php HTML_Progress_TestCase_setBorderPainted.php HTML_Progress_TestCase_setDM.php HTML_Progress_TestCase_setIndeterminate.php HTML_Progress_TestCase_setModel.php HTML_Progress_TestCase_setString.php HTML_Progress_TestCase_setStringPainted.php HTML_Progress_TestCase_setUI.php ancestor.ini testsuite.php |
||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-19237@lists.php.net to get a copy of this message | ||
farell Wed May 5 14:24:06 2004 EDT
Added files:
/pear/HTML_Progress/tests ancestor.ini
HTML_Progress_TestCase_DM_setIncrement.php
HTML_Progress_TestCase_DM_setMaximum.php
HTML_Progress_TestCase_DM_setMinimum.php
HTML_Progress_TestCase_DM_setValue.php
HTML_Progress_TestCase_setAnimSpeed.php
HTML_Progress_TestCase_setModel.php
HTML_Progress_TestCase_setString.php
HTML_Progress_TestCase_UI_getBorderAttributes.php
HTML_Progress_TestCase_UI_getCellAttributes.php
HTML_Progress_TestCase_UI_getProgressAttributes.php
HTML_Progress_TestCase_UI_getStringAttributes.php
HTML_Progress_TestCase_UI_setCellCoordinates.php
Modified files:
/pear/HTML_Progress/tests HTML_Progress_TestCase_addListener.php
HTML_Progress_TestCase_DM.php
HTML_Progress_TestCase_getDM.php
HTML_Progress_TestCase_getString.php
HTML_Progress_TestCase_getUI.php
HTML_Progress_TestCase_removeListener.php
HTML_Progress_TestCase_setBorderPainted.php
HTML_Progress_TestCase_setDM.php
HTML_Progress_TestCase_setIndeterminate.php
HTML_Progress_TestCase_setStringPainted.php
HTML_Progress_TestCase_setUI.php
HTML_Progress_TestCase_UI_setCellAttributes.php
HTML_Progress_TestCase_UI_setCellCount.php
HTML_Progress_TestCase_UI_setFillWay.php
HTML_Progress_TestCase_UI_setOrientation.php
HTML_Progress_TestCase_UI_setScript.php
testsuite.php
Log:
all UnitTests are now fully compatible with PEAR_ErrorStack
http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_addListener.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_addListener.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_addListener.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_addListener.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_addListener.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_addListener.php Wed May 5 14:24:06 2004 @@ -1,9 +1,8 @@ <?php - /** * API addListener Unit tests for HTML_Progress class. * - * @version $Id: HTML_Progress_TestCase_addListener.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_addListener.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -24,12 +23,11 @@ function setUp() { - error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); + error_reporting(E_ALL & ~E_NOTICE); - $this->progress = new HTML_Progress(); - Error_Raise::setContextGrabber($this->progress->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $this->progress = new HTML_Progress($logger); } function tearDown() @@ -51,10 +49,21 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } } /** @@ -86,11 +95,14 @@ require_once ('HTML/Progress/observer.php'); +class logit +{ +} + class log_progress extends HTML_Progress_Observer { function log_progress() { } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_DM.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_DM.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_DM.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_DM.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_DM.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_DM.php Wed May 5 14:24:06 2004 @@ -3,7 +3,7 @@ /** * API Unit tests for HTML_Progress_DM class. * - * @version $Id: HTML_Progress_TestCase_DM.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_DM.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -28,13 +28,16 @@ $this->errorThrown = false; set_error_handler(array(&$this, 'errorHandler')); - $this->dataModel = new HTML_Progress_DM(25,200,10); - Error_Raise::setContextGrabber($this->dataModel->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $this->progress = new HTML_Progress(25,200,$logger); + $this->progress->setIncrement(10); + $this->dataModel =& $this->progress->getDM(); } function tearDown() { - unset($this->dataModel); + unset($this->progress); } function _stripWhitespace($str) @@ -51,10 +54,26 @@ return false; } + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } + } + function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + $this->errorOccured = true; + $this->assertTrue(false, "$errstr at line $errline"); } /** @@ -67,6 +86,7 @@ return; } $this->dataModel->setMinimum(''); + $this->_getResult(); } function test_setMinimum_fail_no_positive() @@ -75,6 +95,7 @@ return; } $this->dataModel->setMinimum(-1); + $this->_getResult(); } function test_setMinimum_fail_greater_max() @@ -83,6 +104,7 @@ return; } $this->dataModel->setMinimum(500); + $this->_getResult(); } function test_setMinimum() @@ -91,8 +113,7 @@ return; } $this->dataModel->setMinimum(10); - - $this->assertFalse($this->errorThrown, 'error thrown'); + $this->_getResult(); } /** @@ -105,6 +126,7 @@ return; } $this->dataModel->setMaximum(''); + $this->_getResult(); } function test_setMaximum_fail_no_positive() @@ -113,6 +135,7 @@ return; } $this->dataModel->setMaximum(-1); + $this->_getResult(); } function test_setMaximum_fail_less_min() @@ -121,6 +144,7 @@ return; } $this->dataModel->setMaximum(10); + $this->_getResult(); } function test_setMaximum() @@ -129,8 +153,7 @@ return; } $this->dataModel->setMaximum(60); - - $this->assertFalse($this->errorThrown, 'error thrown'); + $this->_getResult(); } /** @@ -143,6 +166,7 @@ return; } $this->dataModel->setIncrement(''); + $this->_getResult(); } function test_setIncrement_fail_no_zero() @@ -151,6 +175,7 @@ return; } $this->dataModel->setIncrement(0); + $this->_getResult(); } function test_setIncrement() @@ -159,8 +184,7 @@ return; } $this->dataModel->setIncrement(-10); - - $this->assertFalse($this->errorThrown, 'error thrown'); + $this->_getResult(); } /** @@ -173,6 +197,7 @@ return; } $this->dataModel->setValue(''); + $this->_getResult(); } function test_setValue_fail_less_min() @@ -181,6 +206,7 @@ return; } $this->dataModel->setValue(5); + $this->_getResult(); } function test_setValue_fail_greater_max() @@ -189,6 +215,7 @@ return; } $this->dataModel->setValue(1500); + $this->_getResult(); } function test_setValue() @@ -197,8 +224,7 @@ return; } $this->dataModel->setValue(30); - - $this->assertFalse($this->errorThrown, 'error thrown'); + $this->_getResult(); } } http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_getDM.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_getDM.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_getDM.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_getDM.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_getDM.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_getDM.php Wed May 5 14:24:06 2004 @@ -3,7 +3,7 @@ /** * API getDM Unit tests for HTML_Progress class. * - * @version $Id: HTML_Progress_TestCase_getDM.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_getDM.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -25,11 +25,10 @@ function setUp() { error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); - $this->progress = new HTML_Progress(); - Error_Raise::setContextGrabber($this->progress->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $this->progress = new HTML_Progress($logger); } function tearDown() @@ -51,12 +50,23 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } } - + /** * TestCases for method getDM. * @@ -81,5 +91,4 @@ $this->assertSame($this->progress->_DM, $dm); } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_getString.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_getString.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_getString.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_getString.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_getString.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_getString.php Wed May 5 14:24:06 2004 @@ -3,7 +3,7 @@ /** * API getString Unit tests for HTML_Progress class. * - * @version $Id: HTML_Progress_TestCase_getString.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_getString.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -25,11 +25,10 @@ function setUp() { error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); - $this->progress = new HTML_Progress(); - Error_Raise::setContextGrabber($this->progress->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $this->progress = new HTML_Progress($logger); } function tearDown() @@ -51,12 +50,23 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } } - + /** * TestCases for method getString. * @@ -83,5 +93,4 @@ $this->assertEquals("0 %", $percent); } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_getUI.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_getUI.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_getUI.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_getUI.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_getUI.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_getUI.php Wed May 5 14:24:06 2004 @@ -3,7 +3,7 @@ /** * API getUI Unit tests for HTML_Progress class. * - * @version $Id: HTML_Progress_TestCase_getUI.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_getUI.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -25,11 +25,10 @@ function setUp() { error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); - $this->progress = new HTML_Progress(); - Error_Raise::setContextGrabber($this->progress->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $this->progress = new HTML_Progress($logger); } function tearDown() @@ -51,12 +50,23 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } } - + /** * TestCases for method getUI. * @@ -81,5 +91,4 @@ $this->assertSame($this->progress->_UI, $ui); } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_removeListener.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_removeListener.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_removeListener.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_removeListener.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_removeListener.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_removeListener.php Wed May 5 14:24:06 2004 @@ -3,7 +3,7 @@ /** * API removeListener Unit tests for HTML_Progress class. * - * @version $Id: HTML_Progress_TestCase_removeListener.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_removeListener.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -24,12 +24,11 @@ function setUp() { - error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); + error_reporting(E_ALL & ~E_NOTICE); - $this->progress = new HTML_Progress(); - Error_Raise::setContextGrabber($this->progress->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $this->progress = new HTML_Progress($logger); } function tearDown() @@ -51,10 +50,21 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } } /** @@ -66,7 +76,7 @@ if (!$this->_methodExists('removeListener')) { return; } - $observer = 'log_progress'; + $observer = 'log_progress2'; $monitor = $this->progress->removeListener(new $observer); $this->assertTrue($monitor, $observer .' is not a valid listener or is not yet attached '); @@ -77,7 +87,7 @@ if (!$this->_methodExists('removeListener')) { return; } - $observer = 'logit'; + $observer = 'logit2'; $monitor = $this->progress->addListener(new $observer); $monitor = $this->progress->removeListener(new $observer); @@ -87,11 +97,14 @@ require_once ('HTML/Progress/observer.php'); -class logit extends HTML_Progress_Observer +class logit2 extends HTML_Progress_Observer { - function logit() + function logit2() { } } +class log_progress2 +{ +} ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_setBorderPainted.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_setBorderPainted.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_setBorderPainted.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_setBorderPainted.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_setBorderPainted.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_setBorderPainted.php Wed May 5 14:24:06 2004 @@ -1,9 +1,8 @@ <?php - /** * API setBorderPainted Unit tests for HTML_Progress class. * - * @version $Id: HTML_Progress_TestCase_setBorderPainted.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_setBorderPainted.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -24,12 +23,12 @@ function setUp() { - error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); + error_reporting(E_ALL & ~E_NOTICE); - $this->progress = new HTML_Progress(); - Error_Raise::setContextGrabber($this->progress->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown + $this->progress = new HTML_Progress($logger); } function tearDown() @@ -51,10 +50,26 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _pushCallback($err) + { + // don't die if the error is an exception (as default callback) + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } } /** @@ -67,6 +82,7 @@ return; } $this->progress->setBorderPainted(''); + $this->_getResult(); } function test_setBorderPainted() @@ -75,9 +91,7 @@ return; } $this->progress->setBorderPainted(true); - - $this->assertFalse($this->errorThrown, 'error thrown'); + $this->_getResult(); } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_setDM.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_setDM.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_setDM.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_setDM.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_setDM.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_setDM.php Wed May 5 14:24:06 2004 @@ -1,9 +1,8 @@ <?php - /** * API setDM Unit tests for HTML_Progress class. * - * @version $Id: HTML_Progress_TestCase_setDM.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_setDM.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -24,12 +23,11 @@ function setUp() { - error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); + error_reporting(E_ALL & ~E_NOTICE); - $this->progress = new HTML_Progress(); - Error_Raise::setContextGrabber($this->progress->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $this->progress = new HTML_Progress($logger); } function tearDown() @@ -51,12 +49,23 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } } - + /** * TestCases for method setDM. * @@ -67,6 +76,7 @@ return; } $this->progress->setDM('timer'); + $this->_getResult(); } function test_setDM() @@ -75,8 +85,7 @@ return; } $this->progress->setDM('download'); - - $this->assertFalse($this->errorThrown, 'error thrown'); + $this->_getResult(); } } @@ -93,5 +102,4 @@ { } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_setIndeterminate.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_setIndeterminate.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_setIndeterminate.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_setIndeterminate.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_setIndeterminate.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_setIndeterminate.php Wed May 5 14:24:06 2004 @@ -1,9 +1,8 @@ <?php - /** * API setIndeterminate Unit tests for HTML_Progress class. * - * @version $Id: HTML_Progress_TestCase_setIndeterminate.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_setIndeterminate.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -24,12 +23,12 @@ function setUp() { - error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); + error_reporting(E_ALL & ~E_NOTICE); - $this->progress = new HTML_Progress(); - Error_Raise::setContextGrabber($this->progress->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown + $this->progress = new HTML_Progress($logger); } function tearDown() @@ -51,11 +50,28 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _pushCallback($err) + { + // don't die if the error is an exception (as default callback) } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } + } + /** * TestCases for method setIndeterminate. @@ -67,6 +83,7 @@ return; } $this->progress->setIndeterminate(''); + $this->_getResult(); } function test_setIndeterminate() @@ -75,9 +92,7 @@ return; } $this->progress->setIndeterminate(true); - - $this->assertFalse($this->errorThrown, 'error thrown'); + $this->_getResult(); } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_setStringPainted.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_setStringPainted.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_setStringPainted.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_setStringPainted.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_setStringPainted.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_setStringPainted.php Wed May 5 14:24:06 2004 @@ -1,9 +1,8 @@ <?php - /** * API setStringPainted Unit tests for HTML_Progress class. * - * @version $Id: HTML_Progress_TestCase_setStringPainted.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_setStringPainted.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -24,12 +23,12 @@ function setUp() { - error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); + error_reporting(E_ALL & ~E_NOTICE); - $this->progress = new HTML_Progress(); - Error_Raise::setContextGrabber($this->progress->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown + $this->progress = new HTML_Progress($logger); } function tearDown() @@ -51,10 +50,26 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _pushCallback($err) + { + // don't die if the error is an exception (as default callback) + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } } /** @@ -67,6 +82,7 @@ return; } $this->progress->setStringPainted(''); + $this->_getResult(); } function test_setStringPainted() @@ -75,9 +91,7 @@ return; } $this->progress->setStringPainted(true); - - $this->assertFalse($this->errorThrown, 'error thrown'); + $this->_getResult(); } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_setUI.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_setUI.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_setUI.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_setUI.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_setUI.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_setUI.php Wed May 5 14:24:06 2004 @@ -1,9 +1,8 @@ <?php - /** * API setUI Unit tests for HTML_Progress class. * - * @version $Id: HTML_Progress_TestCase_setUI.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_setUI.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -24,12 +23,11 @@ function setUp() { - error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); + error_reporting(E_ALL & ~E_NOTICE); - $this->progress = new HTML_Progress(); - Error_Raise::setContextGrabber($this->progress->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $this->progress = new HTML_Progress($logger); } function tearDown() @@ -51,12 +49,23 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } } - + /** * TestCases for method setUI. * @@ -67,6 +76,7 @@ return; } $this->progress->setUI('progress360'); + $this->_getResult(); } function test_setUI() @@ -75,8 +85,7 @@ return; } $this->progress->setUI('progress180'); - - $this->assertFalse($this->errorThrown, 'error thrown'); + $this->_getResult(); } } @@ -93,5 +102,4 @@ { } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellAttributes.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellAttributes.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellAttributes.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellAttributes.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellAttributes.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellAttributes.php Wed May 5 14:24:06 2004 @@ -1,9 +1,8 @@ <?php - /** * API setCellAttributes Unit tests for HTML_Progress_UI class. * - * @version $Id: HTML_Progress_TestCase_UI_setCellAttributes.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_UI_setCellAttributes.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -11,10 +10,11 @@ class HTML_Progress_TestCase_UI_setCellAttributes extends PHPUnit_TestCase { /** - * HTML_Progress_UI instance + * HTML_Progress instance * * @var object */ + var $progress; var $ui; function HTML_Progress_TestCase_UI_setCellAttributes($name) @@ -24,17 +24,18 @@ function setUp() { - error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); + error_reporting(E_ALL & ~E_NOTICE); - $this->ui = new HTML_Progress_UI(); - Error_Raise::setContextGrabber($this->ui->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown + $this->progress = new HTML_Progress($logger); + $this->ui =& $this->progress->getUI(); } function tearDown() { - unset($this->ui); + unset($this->progress); } function _stripWhitespace($str) @@ -51,12 +52,28 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _pushCallback($err) + { + // don't die if the error is an exception (as default callback) } - + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } + } + /** * TestCases for method setCellAttributes. * @@ -67,6 +84,7 @@ return; } $this->ui->setCellAttributes('',''); + $this->_getResult(); } function test_setCellAttributes_fail_no_positive() @@ -75,6 +93,7 @@ return; } $this->ui->setCellAttributes('',-1); + $this->_getResult(); } function test_setCellAttributes_fail_invalid_cellindex() @@ -83,6 +102,7 @@ return; } $this->ui->setCellAttributes('',11); + $this->_getResult(); } function test_setCellAttributes() @@ -91,9 +111,7 @@ return; } $this->ui->setCellAttributes('color = #FF0000'); - - $this->assertFalse($this->errorThrown, 'error thrown'); + $this->_getResult(); } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellCount.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellCount.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellCount.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellCount.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellCount.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellCount.php Wed May 5 14:24:06 2004 @@ -1,9 +1,8 @@ <?php - /** * API setCellCount Unit tests for HTML_Progress_UI class. * - * @version $Id: HTML_Progress_TestCase_UI_setCellCount.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_UI_setCellCount.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -11,10 +10,11 @@ class HTML_Progress_TestCase_UI_setCellCount extends PHPUnit_TestCase { /** - * HTML_Progress_UI instance + * HTML_Progress instance * * @var object */ + var $progress; var $ui; function HTML_Progress_TestCase_UI_setCellCount($name) @@ -24,17 +24,18 @@ function setUp() { - error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); + error_reporting(E_ALL & ~E_NOTICE); - $this->ui = new HTML_Progress_UI(); - Error_Raise::setContextGrabber($this->ui->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown + $this->progress = new HTML_Progress($logger); + $this->ui =& $this->progress->getUI(); } function tearDown() { - unset($this->ui); + unset($this->progress); } function _stripWhitespace($str) @@ -51,10 +52,26 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _pushCallback($err) + { + // don't die if the error is an exception (as default callback) + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } } /** @@ -67,6 +84,7 @@ return; } $this->ui->setCellCount(''); + $this->_getResult(); } function test_setCellCount_fail_less_1() @@ -75,6 +93,7 @@ return; } $this->ui->setCellCount(0); + $this->_getResult(); } function test_setCellCount_horizontal_valid_width() @@ -110,5 +129,4 @@ $this->assertFalse($this->errorThrown, 'error thrown'); } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setFillWay.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setFillWay.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setFillWay.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setFillWay.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setFillWay.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setFillWay.php Wed May 5 14:24:06 2004 @@ -1,9 +1,8 @@ <?php - /** * API setFillWay Unit tests for HTML_Progress_UI class. * - * @version $Id: HTML_Progress_TestCase_UI_setFillWay.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_UI_setFillWay.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -11,10 +10,11 @@ class HTML_Progress_TestCase_UI_setFillWay extends PHPUnit_TestCase { /** - * HTML_Progress_UI instance + * HTML_Progress instance * * @var object */ + var $progress; var $ui; function HTML_Progress_TestCase_UI_setFillWay($name) @@ -24,17 +24,18 @@ function setUp() { - error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); + error_reporting(E_ALL & ~E_NOTICE); - $this->ui = new HTML_Progress_UI(); - Error_Raise::setContextGrabber($this->ui->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown + $this->progress = new HTML_Progress($logger); + $this->ui =& $this->progress->getUI(); } function tearDown() { - unset($this->ui); + unset($this->progress); } function _stripWhitespace($str) @@ -51,10 +52,26 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _pushCallback($err) + { + // don't die if the error is an exception (as default callback) + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } } /** @@ -67,6 +84,7 @@ return; } $this->ui->setFillWay(0); + $this->_getResult(); } function test_setFillWay_fail_invalid_value() @@ -75,6 +93,7 @@ return; } $this->ui->setFillWay('right'); + $this->_getResult(); } function test_setFillWay_natural() @@ -83,9 +102,7 @@ return; } $this->ui->setFillWay('natural'); - - $this->assertFalse($this->errorThrown, 'error thrown'); + $this->_getResult(); } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setOrientation.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setOrientation.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setOrientation.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setOrientation.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setOrientation.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setOrientation.php Wed May 5 14:24:06 2004 @@ -1,9 +1,8 @@ <?php - /** * API setOrientation Unit tests for HTML_Progress_UI class. * - * @version $Id: HTML_Progress_TestCase_UI_setOrientation.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_UI_setOrientation.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -11,10 +10,11 @@ class HTML_Progress_TestCase_UI_setOrientation extends PHPUnit_TestCase { /** - * HTML_Progress_UI instance + * HTML_Progress instance * * @var object */ + var $progress; var $ui; function HTML_Progress_TestCase_UI_setOrientation($name) @@ -24,17 +24,18 @@ function setUp() { - error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); + error_reporting(E_ALL & ~E_NOTICE); - $this->ui = new HTML_Progress_UI(); - Error_Raise::setContextGrabber($this->ui->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown + $this->progress = new HTML_Progress($logger); + $this->ui =& $this->progress->getUI(); } function tearDown() { - unset($this->ui); + unset($this->progress); } function _stripWhitespace($str) @@ -51,10 +52,26 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _pushCallback($err) + { + // don't die if the error is an exception (as default callback) + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } } /** @@ -67,6 +84,7 @@ return; } $this->ui->setOrientation(''); + $this->_getResult(); } function test_setOrientation_fail_invalid_value() @@ -75,6 +93,7 @@ return; } $this->ui->setOrientation(0); + $this->_getResult(); } function test_setOrientation_vertical_valid_width() @@ -127,9 +146,7 @@ return; } $this->ui->setOrientation(HTML_PROGRESS_BAR_VERTICAL); - - $this->assertFalse($this->errorThrown, 'error thrown'); + $this->_getResult(); } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setScript.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setScript.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setScript.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setScript.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setScript.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setScript.php Wed May 5 14:24:06 2004 @@ -1,9 +1,8 @@ <?php - /** * API setScript Unit tests for HTML_Progress_UI class. * - * @version $Id: HTML_Progress_TestCase_UI_setScript.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_UI_setScript.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -11,10 +10,11 @@ class HTML_Progress_TestCase_UI_setScript extends PHPUnit_TestCase { /** - * HTML_Progress_UI instance + * HTML_Progress instance * * @var object */ + var $progress; var $ui; function HTML_Progress_TestCase_UI_setScript($name) @@ -24,17 +24,18 @@ function setUp() { - error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); + error_reporting(E_ALL & ~E_NOTICE); - $this->ui = new HTML_Progress_UI(); - Error_Raise::setContextGrabber($this->ui->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown + $this->progress = new HTML_Progress($logger); + $this->ui =& $this->progress->getUI(); } function tearDown() { - unset($this->ui); + unset($this->progress); } function _stripWhitespace($str) @@ -51,10 +52,26 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _pushCallback($err) + { + // don't die if the error is an exception (as default callback) + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } } /** @@ -67,6 +84,7 @@ return; } $this->ui->setScript(100); + $this->_getResult(); } function test_setScript_fail_no_file() @@ -75,6 +93,7 @@ return; } $this->ui->setScript('progress1.js'); + $this->_getResult(); } function test_setScript() @@ -83,9 +102,7 @@ return; } $this->ui->setScript('progress3.js'); - - $this->assertFalse($this->errorThrown, 'error thrown'); + $this->_getResult(); } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/testsuite.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/testsuite.php diff -u pear/HTML_Progress/tests/testsuite.php:1.1 pear/HTML_Progress/tests/testsuite.php:1.2 --- pear/HTML_Progress/tests/testsuite.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/testsuite.php Wed May 5 14:24:06 2004 @@ -3,7 +3,7 @@ /** * HTML output for PHPUnit suite tests. * - * @version $Id: testsuite.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: testsuite.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -45,22 +45,31 @@ <h2>Tests</h2> <?php $testcases = array( - 'HTML_Progress_TestCase_DM', - 'HTML_Progress_TestCase_UI_setOrientation', - 'HTML_Progress_TestCase_UI_setFillWay', - 'HTML_Progress_TestCase_UI_setCellCount', - 'HTML_Progress_TestCase_UI_setCellAttributes', - 'HTML_Progress_TestCase_UI_setScript', 'HTML_Progress_TestCase_setIndeterminate', 'HTML_Progress_TestCase_setBorderPainted', 'HTML_Progress_TestCase_setStringPainted', - 'HTML_Progress_TestCase_getString', - 'HTML_Progress_TestCase_getDM', 'HTML_Progress_TestCase_setDM', - 'HTML_Progress_TestCase_getUI', 'HTML_Progress_TestCase_setUI', + 'HTML_Progress_TestCase_setModel', + 'HTML_Progress_TestCase_setAnimSpeed', 'HTML_Progress_TestCase_addListener', - 'HTML_Progress_TestCase_removeListener' + 'HTML_Progress_TestCase_removeListener', + + 'HTML_Progress_TestCase_UI_setOrientation', + 'HTML_Progress_TestCase_UI_setFillWay', + 'HTML_Progress_TestCase_UI_setCellCount', + 'HTML_Progress_TestCase_UI_getCellAttributes', + 'HTML_Progress_TestCase_UI_setCellAttributes', + 'HTML_Progress_TestCase_UI_setCellCoordinates', + 'HTML_Progress_TestCase_UI_getBorderAttributes', + 'HTML_Progress_TestCase_UI_getStringAttributes', + 'HTML_Progress_TestCase_UI_getProgressAttributes', + 'HTML_Progress_TestCase_UI_setScript', + + 'HTML_Progress_TestCase_DM_setMinimum', + 'HTML_Progress_TestCase_DM_setMaximum', + 'HTML_Progress_TestCase_DM_setIncrement', + 'HTML_Progress_TestCase_DM_setValue' ); http://cvs.php.net/co.php/pear/HTML_Progress/tests/ancestor.ini?r=1.1&p=1 Index: pear/HTML_Progress/tests/ancestor.ini +++ pear/HTML_Progress/tests/ancestor.ini ; ; Ancestor UI model properties ; ; @version $Id: ancestor.ini,v 1.1 2004/05/05 18:24:06 farell Exp $ ; @author Laurent Laville <pear@laurent-laville.org> ; @package HTML_Progress ; [orientation] ; 1=horizontal 2=vertical 3=polygonal shape=1 fillway=natural [cell] id=progressCell%01s class=cell active-color=#006600 inactive-color=#CCCCCC font-family=Courier, Verdana font-size=8 color=#000000 width=15 height=20 spacing=2 [border] class=progressBarBorder width=0 style=solid color=#FFFFFF [string] id=installationProgress width=60 font-family=Verdana, Arial, Helvetica, sans-serif font-size=14 color=#000000 background-color=#FFFFFF align=center valign=right [progress] class=progressBar background-color=#FFFFFF auto-size=true http://cvs.php.net/co.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_DM_setIncrement.php?r=1.1&p=1 Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_DM_setIncrement.php +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_DM_setIncrement.php <?php /** * API setIncrement Unit tests for HTML_Progress_DM class. * * @version $Id: HTML_Progress_TestCase_DM_setIncrement.php,v 1.1 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ class HTML_Progress_TestCase_DM_setIncrement extends PHPUnit_TestCase { /** * HTML_Progress instance * * @var object */ var $progress; var $dm; function HTML_Progress_TestCase_DM_setIncrement($name) { $this->PHPUnit_TestCase($name); } function setUp() { error_reporting(E_ALL & ~E_NOTICE); $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown $this->progress = new HTML_Progress($logger); $this->dm =& $this->progress->getDM(); } function tearDown() { unset($this->progress); } function _stripWhitespace($str) { return preg_replace('/\\s+/', '', $str); } function _methodExists($name) { if (in_array(strtolower($name), get_class_methods($this->dm))) { return true; } $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->dm)); return false; } function _msgCallback(&$stack, $err) { $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); return $message; } function _pushCallback($err) { // don't die if the error is an exception (as default callback) } function _getResult() { $s = &PEAR_ErrorStack::singleton('HTML_Progress'); if ($s->hasErrors()) { $err = $s->pop(); $this->assertTrue(false, $err['message']); } else { $this->assertTrue(true); } } /** * TestCases for method setIncrement. * */ function test_setIncrement_fail_no_integer() { if (!$this->_methodExists('setIncrement')) { return; } $this->dm->setIncrement(''); $this->_getResult(); } function test_setIncrement_fail_zero() { if (!$this->_methodExists('setIncrement')) { return; } $this->dm->setIncrement(0); $this->_getResult(); } function test_setIncrement() { if (!$this->_methodExists('setIncrement')) { return; } $this->dm->setIncrement(5); $this->_getResult(); } } ?> http://cvs.php.net/co.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_DM_setMaximum.php?r=1.1&p=1 Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_DM_setMaximum.php +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_DM_setMaximum.php <?php /** * API setMaximum Unit tests for HTML_Progress_DM class. * * @version $Id: HTML_Progress_TestCase_DM_setMaximum.php,v 1.1 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ class HTML_Progress_TestCase_DM_setMaximum extends PHPUnit_TestCase { /** * HTML_Progress instance * * @var object */ var $progress; var $dm; function HTML_Progress_TestCase_DM_setMaximum($name) { $this->PHPUnit_TestCase($name); } function setUp() { error_reporting(E_ALL & ~E_NOTICE); $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown $this->progress = new HTML_Progress($logger); $this->dm =& $this->progress->getDM(); $this->dm->setMinimum(10); $this->dm->setMaximum(100); } function tearDown() { unset($this->progress); } function _stripWhitespace($str) { return preg_replace('/\\s+/', '', $str); } function _methodExists($name) { if (in_array(strtolower($name), get_class_methods($this->dm))) { return true; } $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->dm)); return false; } function _msgCallback(&$stack, $err) { $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); return $message; } function _pushCallback($err) { // don't die if the error is an exception (as default callback) } function _getResult() { $s = &PEAR_ErrorStack::singleton('HTML_Progress'); if ($s->hasErrors()) { $err = $s->pop(); $this->assertTrue(false, $err['message']); } else { $this->assertTrue(true); } } /** * TestCases for method setMaximum. * */ function test_setMaximum_fail_no_integer() { if (!$this->_methodExists('setMaximum')) { return; } $this->dm->setMaximum(''); $this->_getResult(); } function test_setMaximum_fail_no_positive() { if (!$this->_methodExists('setMaximum')) { return; } $this->dm->setMaximum(-1); $this->_getResult(); } function test_setMaximum_fail_less_min() { if (!$this->_methodExists('setMaximum')) { return; } $this->dm->setMaximum(1); $this->_getResult(); } function test_setMaximum() { if (!$this->_methodExists('setMaximum')) { return; } $this->dm->setMaximum(10); $this->_getResult(); } } ?> http://cvs.php.net/co.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_DM_setMinimum.php?r=1.1&p=1 Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_DM_setMinimum.php +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_DM_setMinimum.php <?php /** * API setMinimum Unit tests for HTML_Progress_DM class. * * @version $Id: HTML_Progress_TestCase_DM_setMinimum.php,v 1.1 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ class HTML_Progress_TestCase_DM_setMinimum extends PHPUnit_TestCase { /** * HTML_Progress instance * * @var object */ var $progress; var $dm; function HTML_Progress_TestCase_DM_setMinimum($name) { $this->PHPUnit_TestCase($name); } function setUp() { error_reporting(E_ALL & ~E_NOTICE); $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown $this->progress = new HTML_Progress($logger); $this->dm =& $this->progress->getDM(); } function tearDown() { unset($this->progress); } function _stripWhitespace($str) { return preg_replace('/\\s+/', '', $str); } function _methodExists($name) { if (in_array(strtolower($name), get_class_methods($this->dm))) { return true; } $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->dm)); return false; } function _msgCallback(&$stack, $err) { $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); return $message; } function _pushCallback($err) { // don't die if the error is an exception (as default callback) } function _getResult() { $s = &PEAR_ErrorStack::singleton('HTML_Progress'); if ($s->hasErrors()) { $err = $s->pop(); $this->assertTrue(false, $err['message']); } else { $this->assertTrue(true); } } /** * TestCases for method setMinimum. * */ function test_setMinimum_fail_no_integer() { if (!$this->_methodExists('setMinimum')) { return; } $this->dm->setMinimum(''); $this->_getResult(); } function test_setMinimum_fail_no_positive() { if (!$this->_methodExists('setMinimum')) { return; } $this->dm->setMinimum(-1); $this->_getResult(); } function test_setMinimum_fail_greater_max() { if (!$this->_methodExists('setMinimum')) { return; } $this->dm->setMinimum(500); $this->_getResult(); } function test_setMinimum() { if (!$this->_methodExists('setMinimum')) { return; } $this->dm->setMinimum(10); $this->_getResult(); } } ?> http://cvs.php.net/co.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_DM_setValue.php?r=1.1&p=1 Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_DM_setValue.php +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_DM_setValue.php <?php /** * API setValue Unit tests for HTML_Progress_DM class. * * @version $Id: HTML_Progress_TestCase_DM_setValue.php,v 1.1 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ class HTML_Progress_TestCase_DM_setValue extends PHPUnit_TestCase { /** * HTML_Progress instance * * @var object */ var $progress; var $dm; function HTML_Progress_TestCase_DM_setValue($name) { $this->PHPUnit_TestCase($name); } function setUp() { error_reporting(E_ALL & ~E_NOTICE); $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown $this->progress = new HTML_Progress($logger); $this->dm =& $this->progress->getDM(); $this->dm->setMinimum(10); $this->dm->setMaximum(100); } function tearDown() { unset($this->progress); } function _stripWhitespace($str) { return preg_replace('/\\s+/', '', $str); } function _methodExists($name) { if (in_array(strtolower($name), get_class_methods($this->dm))) { return true; } $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->dm)); return false; } function _msgCallback(&$stack, $err) { $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); return $message; } function _pushCallback($err) { // don't die if the error is an exception (as default callback) } function _getResult() { $s = &PEAR_ErrorStack::singleton('HTML_Progress'); if ($s->hasErrors()) { $err = $s->pop(); $this->assertTrue(false, $err['message']); } else { $this->assertTrue(true); } } /** * TestCases for method setValue. * */ function test_setValue_fail_no_integer() { if (!$this->_methodExists('setValue')) { return; } $this->dm->setValue(''); $this->_getResult(); } function test_setValue_fail_less_than_min() { if (!$this->_methodExists('setValue')) { return; } $this->dm->setValue(1); $this->_getResult(); } function test_setValue_fail_greater_than_max() { if (!$this->_methodExists('setValue')) { return; } $this->dm->setValue(200); $this->_getResult(); } function test_setValue() { if (!$this->_methodExists('setValue')) { return; } $this->dm->setValue(15); $this->_getResult(); } } ?> http://cvs.php.net/co.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_setAnimSpeed.php?r=1.1&p=1 Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_setAnimSpeed.php +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_setAnimSpeed.php <?php /** * API setAnimSpeed Unit tests for HTML_Progress class. * * @version $Id: HTML_Progress_TestCase_setAnimSpeed.php,v 1.1 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ class HTML_Progress_TestCase_setAnimSpeed extends PHPUnit_TestCase { /** * HTML_Progress instance * * @var object */ var $progress; function HTML_Progress_TestCase_setAnimSpeed($name) { $this->PHPUnit_TestCase($name); } function setUp() { error_reporting(E_ALL & ~E_NOTICE); $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown $this->progress = new HTML_Progress($logger); } function tearDown() { unset($this->progress); } function _stripWhitespace($str) { return preg_replace('/\\s+/', '', $str); } function _methodExists($name) { if (in_array(strtolower($name), get_class_methods($this->progress))) { return true; } $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->progress)); return false; } function _msgCallback(&$stack, $err) { $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); return $message; } function _pushCallback($err) { // don't die if the error is an exception (as default callback) } function _getResult() { $s = &PEAR_ErrorStack::singleton('HTML_Progress'); if ($s->hasErrors()) { $err = $s->pop(); $this->assertTrue(false, $err['message']); } else { $this->assertTrue(true); } } /** * TestCases for method setAnimSpeed. * */ function test_setAnimSpeed_fail_no_integer() { if (!$this->_methodExists('setAnimSpeed')) { return; } $this->progress->setAnimSpeed(''); $this->_getResult(); } function test_setAnimSpeed_fail_no_positive() { if (!$this->_methodExists('setAnimSpeed')) { return; } $this->progress->setAnimSpeed(-1); $this->_getResult(); } function test_setAnimSpeed_fail_greater_max_allowed() { if (!$this->_methodExists('setAnimSpeed')) { return; } $this->progress->setAnimSpeed(1500); $this->_getResult(); } function test_setAnimSpeed() { if (!$this->_methodExists('setAnimSpeed')) { return; } $this->progress->setAnimSpeed(100); $this->_getResult(); } } ?> http://cvs.php.net/co.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_setModel.php?r=1.1&p=1 Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_setModel.php +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_setModel.php <?php /** * API setModel Unit tests for HTML_Progress class. * * @version $Id: HTML_Progress_TestCase_setModel.php,v 1.1 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ class HTML_Progress_TestCase_setModel extends PHPUnit_TestCase { /** * HTML_Progress instance * * @var object */ var $progress; function HTML_Progress_TestCase_setModel($name) { $this->PHPUnit_TestCase($name); } function setUp() { error_reporting(E_ALL & ~E_NOTICE); $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message $this->progress = new HTML_Progress($logger); } function tearDown() { unset($this->progress); } function _stripWhitespace($str) { return preg_replace('/\\s+/', '', $str); } function _methodExists($name) { if (in_array(strtolower($name), get_class_methods($this->progress))) { return true; } $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->progress)); return false; } function _msgCallback(&$stack, $err) { $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); return $message; } function _getResult() { $s = &PEAR_ErrorStack::singleton('HTML_Progress'); if ($s->hasErrors()) { $err = $s->pop(); $this->assertTrue(false, $err['message']); } else { $this->assertTrue(true); } } /** * TestCases for method setModel. * */ function test_setModel_fail_no_file() { if (!$this->_methodExists('setModel')) { return; } $this->progress->setModel('progress360.php', 'phpArray'); $this->_getResult(); } function test_setModel_fail_invalid_filetype() { if (!$this->_methodExists('setModel')) { return; } $this->progress->setModel('ancestor.ini', 'simpleXML'); $this->_getResult(); } function test_setModel() { if (!$this->_methodExists('setModel')) { return; } $this->progress->setModel('ancestor.ini', 'iniCommented'); $this->_getResult(); } } ?> http://cvs.php.net/co.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_setString.php?r=1.1&p=1 Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_setString.php +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_setString.php <?php /** * API setString Unit tests for HTML_Progress class. * * @version $Id: HTML_Progress_TestCase_setString.php,v 1.1 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ class HTML_Progress_TestCase_setString extends PHPUnit_TestCase { /** * HTML_Progress instance * * @var object */ var $progress; function HTML_Progress_TestCase_setString($name) { $this->PHPUnit_TestCase($name); } function setUp() { error_reporting(E_ALL); $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message $this->progress = new HTML_Progress($logger); } function tearDown() { unset($this->progress); } function _stripWhitespace($str) { return preg_replace('/\\s+/', '', $str); } function _methodExists($name) { if (in_array(strtolower($name), get_class_methods($this->progress))) { return true; } $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->progress)); return false; } function _msgCallback(&$stack, $err) { $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); return $message; } function _getResult() { $s = &PEAR_ErrorStack::singleton('HTML_Progress'); if ($s->hasErrors()) { $err = $s->pop(); $this->assertTrue(false, $err['message']); } else { $this->assertTrue(true); } } /** * TestCases for method setString. * */ function test_setString_fail() { if (!$this->_methodExists('setString')) { return; } $this->progress->setStringPainted(false); $str = '"Receiving 1 out of 5"'; $this->progress->setString($str); $percent = $this->progress->getString(); $this->assertEquals($str, '"'.$percent.'"'); } function test_setString() { if (!$this->_methodExists('setString')) { return; } $this->progress->setStringPainted(true); $str = '"Receiving 1 out of 5"'; $this->progress->setString($str); $percent = $this->progress->getString(); $this->assertEquals($str, $percent); } } ?> http://cvs.php.net/co.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_getBorderAttributes.php?r=1.1&p=1 Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_getBorderAttributes.php +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_getBorderAttributes.php <?php /** * API getBorderAttributes Unit tests for HTML_Progress_UI class. * * @version $Id: HTML_Progress_TestCase_UI_getBorderAttributes.php,v 1.1 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ class HTML_Progress_TestCase_UI_getBorderAttributes extends PHPUnit_TestCase { /** * HTML_Progress instance * * @var object */ var $progress; var $ui; function HTML_Progress_TestCase_UI_getBorderAttributes($name) { $this->PHPUnit_TestCase($name); } function setUp() { error_reporting(E_ALL & ~E_NOTICE); $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown $this->progress = new HTML_Progress($logger); $this->ui =& $this->progress->getUI(); } function tearDown() { unset($this->progress); } function _stripWhitespace($str) { return preg_replace('/\\s+/', '', $str); } function _methodExists($name) { if (in_array(strtolower($name), get_class_methods($this->ui))) { return true; } $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->ui)); return false; } function _msgCallback(&$stack, $err) { $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); return $message; } function _pushCallback($err) { // don't die if the error is an exception (as default callback) } function _getResult() { $s = &PEAR_ErrorStack::singleton('HTML_Progress'); if ($s->hasErrors()) { $err = $s->pop(); $this->assertTrue(false, $err['message']); } else { $this->assertTrue(true); } } /** * TestCases for method getBorderAttributes. * */ function test_getBorderAttributes_fail_no_boolean() { if (!$this->_methodExists('getBorderAttributes')) { return; } $this->ui->getBorderAttributes(''); $this->_getResult(); } function test_getBorderAttributes() { if (!$this->_methodExists('getBorderAttributes')) { return; } $this->ui->getBorderAttributes(true); $this->_getResult(); } } ?> http://cvs.php.net/co.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_getCellAttributes.php?r=1.1&p=1 Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_getCellAttributes.php +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_getCellAttributes.php <?php /** * API getCellAttributes Unit tests for HTML_Progress_UI class. * * @version $Id: HTML_Progress_TestCase_UI_getCellAttributes.php,v 1.1 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ class HTML_Progress_TestCase_UI_getCellAttributes extends PHPUnit_TestCase { /** * HTML_Progress instance * * @var object */ var $progress; var $ui; function HTML_Progress_TestCase_UI_getCellAttributes($name) { $this->PHPUnit_TestCase($name); } function setUp() { error_reporting(E_ALL & ~E_NOTICE); $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown $this->progress = new HTML_Progress($logger); $this->ui =& $this->progress->getUI(); } function tearDown() { unset($this->progress); } function _stripWhitespace($str) { return preg_replace('/\\s+/', '', $str); } function _methodExists($name) { if (in_array(strtolower($name), get_class_methods($this->ui))) { return true; } $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->ui)); return false; } function _msgCallback(&$stack, $err) { $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); return $message; } function _pushCallback($err) { // don't die if the error is an exception (as default callback) } function _getResult() { $s = &PEAR_ErrorStack::singleton('HTML_Progress'); if ($s->hasErrors()) { $err = $s->pop(); $this->assertTrue(false, $err['message']); } else { $this->assertTrue(true); } } /** * TestCases for method getCellAttributes. * */ function test_getCellAttributes_fail_no_boolean() { if (!$this->_methodExists('getCellAttributes')) { return; } $this->ui->getCellAttributes(''); $this->_getResult(); } function test_getCellAttributes() { if (!$this->_methodExists('getCellAttributes')) { return; } $this->ui->getCellAttributes(true); $this->_getResult(); } } ?> http://cvs.php.net/co.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_getProgressAttributes.php?r=1.1&p=1 Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_getProgressAttributes.php +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_getProgressAttributes.php <?php /** * API getProgressAttributes Unit tests for HTML_Progress_UI class. * * @version $Id: HTML_Progress_TestCase_UI_getProgressAttributes.php,v 1.1 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ class HTML_Progress_TestCase_UI_getProgressAttributes extends PHPUnit_TestCase { /** * HTML_Progress instance * * @var object */ var $progress; var $ui; function HTML_Progress_TestCase_UI_getProgressAttributes($name) { $this->PHPUnit_TestCase($name); } function setUp() { error_reporting(E_ALL & ~E_NOTICE); $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown $this->progress = new HTML_Progress($logger); $this->ui =& $this->progress->getUI(); } function tearDown() { unset($this->progress); } function _stripWhitespace($str) { return preg_replace('/\\s+/', '', $str); } function _methodExists($name) { if (in_array(strtolower($name), get_class_methods($this->ui))) { return true; } $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->ui)); return false; } function _msgCallback(&$stack, $err) { $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); return $message; } function _pushCallback($err) { // don't die if the error is an exception (as default callback) } function _getResult() { $s = &PEAR_ErrorStack::singleton('HTML_Progress'); if ($s->hasErrors()) { $err = $s->pop(); $this->assertTrue(false, $err['message']); } else { $this->assertTrue(true); } } /** * TestCases for method getProgressAttributes. * */ function test_getProgressAttributes_fail_no_boolean() { if (!$this->_methodExists('getProgressAttributes')) { return; } $this->ui->getProgressAttributes(''); $this->_getResult(); } function test_getProgressAttributes() { if (!$this->_methodExists('getProgressAttributes')) { return; } $this->ui->getProgressAttributes(true); $this->_getResult(); } } ?> http://cvs.php.net/co.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_getStringAttributes.php?r=1.1&p=1 Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_getStringAttributes.php +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_getStringAttributes.php <?php /** * API getStringAttributes Unit tests for HTML_Progress_UI class. * * @version $Id: HTML_Progress_TestCase_UI_getStringAttributes.php,v 1.1 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ class HTML_Progress_TestCase_UI_getStringAttributes extends PHPUnit_TestCase { /** * HTML_Progress instance * * @var object */ var $progress; var $ui; function HTML_Progress_TestCase_UI_getStringAttributes($name) { $this->PHPUnit_TestCase($name); } function setUp() { error_reporting(E_ALL & ~E_NOTICE); $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown $this->progress = new HTML_Progress($logger); $this->ui =& $this->progress->getUI(); } function tearDown() { unset($this->progress); } function _stripWhitespace($str) { return preg_replace('/\\s+/', '', $str); } function _methodExists($name) { if (in_array(strtolower($name), get_class_methods($this->ui))) { return true; } $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->ui)); return false; } function _msgCallback(&$stack, $err) { $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); return $message; } function _pushCallback($err) { // don't die if the error is an exception (as default callback) } function _getResult() { $s = &PEAR_ErrorStack::singleton('HTML_Progress'); if ($s->hasErrors()) { $err = $s->pop(); $this->assertTrue(false, $err['message']); } else { $this->assertTrue(true); } } /** * TestCases for method getStringAttributes. * */ function test_getStringAttributes_fail_no_boolean() { if (!$this->_methodExists('getStringAttributes')) { return; } $this->ui->getStringAttributes(''); $this->_getResult(); } function test_getStringAttributes() { if (!$this->_methodExists('getStringAttributes')) { return; } $this->ui->getStringAttributes(true); $this->_getResult(); } } ?> http://cvs.php.net/co.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellCoordinates.php?r=1.1&p=1 Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellCoordinates.php +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellCoordinates.php <?php /** * API setCellCoordinates Unit tests for HTML_Progress_UI class. * * @version $Id: HTML_Progress_TestCase_UI_setCellCoordinates.php,v 1.1 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ class HTML_Progress_TestCase_UI_setCellCoordinates extends PHPUnit_TestCase { /** * HTML_Progress instance * * @var object */ var $progress; var $ui; function HTML_Progress_TestCase_UI_setCellCoordinates($name) { $this->PHPUnit_TestCase($name); } function setUp() { error_reporting(E_ALL & ~E_NOTICE); $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown $this->progress = new HTML_Progress($logger); $this->ui =& $this->progress->getUI(); } function tearDown() { unset($this->progress); } function _stripWhitespace($str) { return preg_replace('/\\s+/', '', $str); } function _methodExists($name) { if (in_array(strtolower($name), get_class_methods($this->ui))) { return true; } $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->ui)); return false; } function _msgCallback(&$stack, $err) { $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); return $message; } function _pushCallback($err) { // don't die if the error is an exception (as default callback) } function _getResult() { $s = &PEAR_ErrorStack::singleton('HTML_Progress'); if ($s->hasErrors()) { $err = $s->pop(); $this->assertTrue(false, $err['message']); } else { $this->assertTrue(true); } } /** * TestCases for method setCellCoordinates. * */ function test_setCellCoordinates_fail_no_integer() { if (!$this->_methodExists('setCellCoordinates')) { return; } $this->ui->setCellCoordinates('',2); $this->_getResult(); } function test_setCellCoordinates_fail_no_positive() { if (!$this->_methodExists('setCellCoordinates')) { return; } $this->ui->setCellCoordinates(-1,4); $this->_getResult(); } function test_setCellCoordinates_fail_too_small() { if (!$this->_methodExists('setCellCoordinates')) { return; } $this->ui->setCellCoordinates(1,2); $this->_getResult(); } function test_setCellCoordinates() { if (!$this->_methodExists('setCellCoordinates')) { return; } $this->ui->setCellCoordinates(5,5); $this->_getResult(); } } ?>
http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_addListener.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_addListener.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_addListener.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_addListener.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_addListener.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_addListener.php Wed May 5 14:24:06 2004 @@ -1,9 +1,8 @@ <?php - /** * API addListener Unit tests for HTML_Progress class. * - * @version $Id: HTML_Progress_TestCase_addListener.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_addListener.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -24,12 +23,11 @@ function setUp() { - error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); + error_reporting(E_ALL & ~E_NOTICE); - $this->progress = new HTML_Progress(); - Error_Raise::setContextGrabber($this->progress->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $this->progress = new HTML_Progress($logger); } function tearDown() @@ -51,10 +49,21 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } } /** @@ -86,11 +95,14 @@ require_once ('HTML/Progress/observer.php'); +class logit +{ +} + class log_progress extends HTML_Progress_Observer { function log_progress() { } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_DM.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_DM.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_DM.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_DM.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_DM.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_DM.php Wed May 5 14:24:06 2004 @@ -3,7 +3,7 @@ /** * API Unit tests for HTML_Progress_DM class. * - * @version $Id: HTML_Progress_TestCase_DM.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_DM.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -28,13 +28,16 @@ $this->errorThrown = false; set_error_handler(array(&$this, 'errorHandler')); - $this->dataModel = new HTML_Progress_DM(25,200,10); - Error_Raise::setContextGrabber($this->dataModel->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $this->progress = new HTML_Progress(25,200,$logger); + $this->progress->setIncrement(10); + $this->dataModel =& $this->progress->getDM(); } function tearDown() { - unset($this->dataModel); + unset($this->progress); } function _stripWhitespace($str) @@ -51,10 +54,26 @@ return false; } + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } + } + function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + $this->errorOccured = true; + $this->assertTrue(false, "$errstr at line $errline"); } /** @@ -67,6 +86,7 @@ return; } $this->dataModel->setMinimum(''); + $this->_getResult(); } function test_setMinimum_fail_no_positive() @@ -75,6 +95,7 @@ return; } $this->dataModel->setMinimum(-1); + $this->_getResult(); } function test_setMinimum_fail_greater_max() @@ -83,6 +104,7 @@ return; } $this->dataModel->setMinimum(500); + $this->_getResult(); } function test_setMinimum() @@ -91,8 +113,7 @@ return; } $this->dataModel->setMinimum(10); - - $this->assertFalse($this->errorThrown, 'error thrown'); + $this->_getResult(); } /** @@ -105,6 +126,7 @@ return; } $this->dataModel->setMaximum(''); + $this->_getResult(); } function test_setMaximum_fail_no_positive() @@ -113,6 +135,7 @@ return; } $this->dataModel->setMaximum(-1); + $this->_getResult(); } function test_setMaximum_fail_less_min() @@ -121,6 +144,7 @@ return; } $this->dataModel->setMaximum(10); + $this->_getResult(); } function test_setMaximum() @@ -129,8 +153,7 @@ return; } $this->dataModel->setMaximum(60); - - $this->assertFalse($this->errorThrown, 'error thrown'); + $this->_getResult(); } /** @@ -143,6 +166,7 @@ return; } $this->dataModel->setIncrement(''); + $this->_getResult(); } function test_setIncrement_fail_no_zero() @@ -151,6 +175,7 @@ return; } $this->dataModel->setIncrement(0); + $this->_getResult(); } function test_setIncrement() @@ -159,8 +184,7 @@ return; } $this->dataModel->setIncrement(-10); - - $this->assertFalse($this->errorThrown, 'error thrown'); + $this->_getResult(); } /** @@ -173,6 +197,7 @@ return; } $this->dataModel->setValue(''); + $this->_getResult(); } function test_setValue_fail_less_min() @@ -181,6 +206,7 @@ return; } $this->dataModel->setValue(5); + $this->_getResult(); } function test_setValue_fail_greater_max() @@ -189,6 +215,7 @@ return; } $this->dataModel->setValue(1500); + $this->_getResult(); } function test_setValue() @@ -197,8 +224,7 @@ return; } $this->dataModel->setValue(30); - - $this->assertFalse($this->errorThrown, 'error thrown'); + $this->_getResult(); } } http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_getDM.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_getDM.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_getDM.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_getDM.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_getDM.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_getDM.php Wed May 5 14:24:06 2004 @@ -3,7 +3,7 @@ /** * API getDM Unit tests for HTML_Progress class. * - * @version $Id: HTML_Progress_TestCase_getDM.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_getDM.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -25,11 +25,10 @@ function setUp() { error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); - $this->progress = new HTML_Progress(); - Error_Raise::setContextGrabber($this->progress->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $this->progress = new HTML_Progress($logger); } function tearDown() @@ -51,12 +50,23 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } } - + /** * TestCases for method getDM. * @@ -81,5 +91,4 @@ $this->assertSame($this->progress->_DM, $dm); } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_getString.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_getString.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_getString.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_getString.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_getString.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_getString.php Wed May 5 14:24:06 2004 @@ -3,7 +3,7 @@ /** * API getString Unit tests for HTML_Progress class. * - * @version $Id: HTML_Progress_TestCase_getString.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_getString.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -25,11 +25,10 @@ function setUp() { error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); - $this->progress = new HTML_Progress(); - Error_Raise::setContextGrabber($this->progress->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $this->progress = new HTML_Progress($logger); } function tearDown() @@ -51,12 +50,23 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } } - + /** * TestCases for method getString. * @@ -83,5 +93,4 @@ $this->assertEquals("0 %", $percent); } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_getUI.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_getUI.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_getUI.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_getUI.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_getUI.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_getUI.php Wed May 5 14:24:06 2004 @@ -3,7 +3,7 @@ /** * API getUI Unit tests for HTML_Progress class. * - * @version $Id: HTML_Progress_TestCase_getUI.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_getUI.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -25,11 +25,10 @@ function setUp() { error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); - $this->progress = new HTML_Progress(); - Error_Raise::setContextGrabber($this->progress->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $this->progress = new HTML_Progress($logger); } function tearDown() @@ -51,12 +50,23 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } } - + /** * TestCases for method getUI. * @@ -81,5 +91,4 @@ $this->assertSame($this->progress->_UI, $ui); } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_removeListener.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_removeListener.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_removeListener.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_removeListener.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_removeListener.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_removeListener.php Wed May 5 14:24:06 2004 @@ -3,7 +3,7 @@ /** * API removeListener Unit tests for HTML_Progress class. * - * @version $Id: HTML_Progress_TestCase_removeListener.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_removeListener.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -24,12 +24,11 @@ function setUp() { - error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); + error_reporting(E_ALL & ~E_NOTICE); - $this->progress = new HTML_Progress(); - Error_Raise::setContextGrabber($this->progress->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $this->progress = new HTML_Progress($logger); } function tearDown() @@ -51,10 +50,21 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } } /** @@ -66,7 +76,7 @@ if (!$this->_methodExists('removeListener')) { return; } - $observer = 'log_progress'; + $observer = 'log_progress2'; $monitor = $this->progress->removeListener(new $observer); $this->assertTrue($monitor, $observer .' is not a valid listener or is not yet attached '); @@ -77,7 +87,7 @@ if (!$this->_methodExists('removeListener')) { return; } - $observer = 'logit'; + $observer = 'logit2'; $monitor = $this->progress->addListener(new $observer); $monitor = $this->progress->removeListener(new $observer); @@ -87,11 +97,14 @@ require_once ('HTML/Progress/observer.php'); -class logit extends HTML_Progress_Observer +class logit2 extends HTML_Progress_Observer { - function logit() + function logit2() { } } +class log_progress2 +{ +} ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_setBorderPainted.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_setBorderPainted.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_setBorderPainted.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_setBorderPainted.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_setBorderPainted.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_setBorderPainted.php Wed May 5 14:24:06 2004 @@ -1,9 +1,8 @@ <?php - /** * API setBorderPainted Unit tests for HTML_Progress class. * - * @version $Id: HTML_Progress_TestCase_setBorderPainted.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_setBorderPainted.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -24,12 +23,12 @@ function setUp() { - error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); + error_reporting(E_ALL & ~E_NOTICE); - $this->progress = new HTML_Progress(); - Error_Raise::setContextGrabber($this->progress->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown + $this->progress = new HTML_Progress($logger); } function tearDown() @@ -51,10 +50,26 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _pushCallback($err) + { + // don't die if the error is an exception (as default callback) + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } } /** @@ -67,6 +82,7 @@ return; } $this->progress->setBorderPainted(''); + $this->_getResult(); } function test_setBorderPainted() @@ -75,9 +91,7 @@ return; } $this->progress->setBorderPainted(true); - - $this->assertFalse($this->errorThrown, 'error thrown'); + $this->_getResult(); } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_setDM.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_setDM.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_setDM.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_setDM.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_setDM.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_setDM.php Wed May 5 14:24:06 2004 @@ -1,9 +1,8 @@ <?php - /** * API setDM Unit tests for HTML_Progress class. * - * @version $Id: HTML_Progress_TestCase_setDM.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_setDM.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -24,12 +23,11 @@ function setUp() { - error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); + error_reporting(E_ALL & ~E_NOTICE); - $this->progress = new HTML_Progress(); - Error_Raise::setContextGrabber($this->progress->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $this->progress = new HTML_Progress($logger); } function tearDown() @@ -51,12 +49,23 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } } - + /** * TestCases for method setDM. * @@ -67,6 +76,7 @@ return; } $this->progress->setDM('timer'); + $this->_getResult(); } function test_setDM() @@ -75,8 +85,7 @@ return; } $this->progress->setDM('download'); - - $this->assertFalse($this->errorThrown, 'error thrown'); + $this->_getResult(); } } @@ -93,5 +102,4 @@ { } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_setIndeterminate.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_setIndeterminate.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_setIndeterminate.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_setIndeterminate.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_setIndeterminate.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_setIndeterminate.php Wed May 5 14:24:06 2004 @@ -1,9 +1,8 @@ <?php - /** * API setIndeterminate Unit tests for HTML_Progress class. * - * @version $Id: HTML_Progress_TestCase_setIndeterminate.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_setIndeterminate.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -24,12 +23,12 @@ function setUp() { - error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); + error_reporting(E_ALL & ~E_NOTICE); - $this->progress = new HTML_Progress(); - Error_Raise::setContextGrabber($this->progress->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown + $this->progress = new HTML_Progress($logger); } function tearDown() @@ -51,11 +50,28 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _pushCallback($err) + { + // don't die if the error is an exception (as default callback) } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } + } + /** * TestCases for method setIndeterminate. @@ -67,6 +83,7 @@ return; } $this->progress->setIndeterminate(''); + $this->_getResult(); } function test_setIndeterminate() @@ -75,9 +92,7 @@ return; } $this->progress->setIndeterminate(true); - - $this->assertFalse($this->errorThrown, 'error thrown'); + $this->_getResult(); } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_setStringPainted.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_setStringPainted.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_setStringPainted.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_setStringPainted.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_setStringPainted.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_setStringPainted.php Wed May 5 14:24:06 2004 @@ -1,9 +1,8 @@ <?php - /** * API setStringPainted Unit tests for HTML_Progress class. * - * @version $Id: HTML_Progress_TestCase_setStringPainted.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_setStringPainted.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -24,12 +23,12 @@ function setUp() { - error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); + error_reporting(E_ALL & ~E_NOTICE); - $this->progress = new HTML_Progress(); - Error_Raise::setContextGrabber($this->progress->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown + $this->progress = new HTML_Progress($logger); } function tearDown() @@ -51,10 +50,26 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _pushCallback($err) + { + // don't die if the error is an exception (as default callback) + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } } /** @@ -67,6 +82,7 @@ return; } $this->progress->setStringPainted(''); + $this->_getResult(); } function test_setStringPainted() @@ -75,9 +91,7 @@ return; } $this->progress->setStringPainted(true); - - $this->assertFalse($this->errorThrown, 'error thrown'); + $this->_getResult(); } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_setUI.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_setUI.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_setUI.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_setUI.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_setUI.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_setUI.php Wed May 5 14:24:06 2004 @@ -1,9 +1,8 @@ <?php - /** * API setUI Unit tests for HTML_Progress class. * - * @version $Id: HTML_Progress_TestCase_setUI.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_setUI.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -24,12 +23,11 @@ function setUp() { - error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); + error_reporting(E_ALL & ~E_NOTICE); - $this->progress = new HTML_Progress(); - Error_Raise::setContextGrabber($this->progress->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $this->progress = new HTML_Progress($logger); } function tearDown() @@ -51,12 +49,23 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } } - + /** * TestCases for method setUI. * @@ -67,6 +76,7 @@ return; } $this->progress->setUI('progress360'); + $this->_getResult(); } function test_setUI() @@ -75,8 +85,7 @@ return; } $this->progress->setUI('progress180'); - - $this->assertFalse($this->errorThrown, 'error thrown'); + $this->_getResult(); } } @@ -93,5 +102,4 @@ { } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellAttributes.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellAttributes.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellAttributes.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellAttributes.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellAttributes.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellAttributes.php Wed May 5 14:24:06 2004 @@ -1,9 +1,8 @@ <?php - /** * API setCellAttributes Unit tests for HTML_Progress_UI class. * - * @version $Id: HTML_Progress_TestCase_UI_setCellAttributes.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_UI_setCellAttributes.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -11,10 +10,11 @@ class HTML_Progress_TestCase_UI_setCellAttributes extends PHPUnit_TestCase { /** - * HTML_Progress_UI instance + * HTML_Progress instance * * @var object */ + var $progress; var $ui; function HTML_Progress_TestCase_UI_setCellAttributes($name) @@ -24,17 +24,18 @@ function setUp() { - error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); + error_reporting(E_ALL & ~E_NOTICE); - $this->ui = new HTML_Progress_UI(); - Error_Raise::setContextGrabber($this->ui->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown + $this->progress = new HTML_Progress($logger); + $this->ui =& $this->progress->getUI(); } function tearDown() { - unset($this->ui); + unset($this->progress); } function _stripWhitespace($str) @@ -51,12 +52,28 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _pushCallback($err) + { + // don't die if the error is an exception (as default callback) } - + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } + } + /** * TestCases for method setCellAttributes. * @@ -67,6 +84,7 @@ return; } $this->ui->setCellAttributes('',''); + $this->_getResult(); } function test_setCellAttributes_fail_no_positive() @@ -75,6 +93,7 @@ return; } $this->ui->setCellAttributes('',-1); + $this->_getResult(); } function test_setCellAttributes_fail_invalid_cellindex() @@ -83,6 +102,7 @@ return; } $this->ui->setCellAttributes('',11); + $this->_getResult(); } function test_setCellAttributes() @@ -91,9 +111,7 @@ return; } $this->ui->setCellAttributes('color = #FF0000'); - - $this->assertFalse($this->errorThrown, 'error thrown'); + $this->_getResult(); } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellCount.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellCount.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellCount.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellCount.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellCount.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellCount.php Wed May 5 14:24:06 2004 @@ -1,9 +1,8 @@ <?php - /** * API setCellCount Unit tests for HTML_Progress_UI class. * - * @version $Id: HTML_Progress_TestCase_UI_setCellCount.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_UI_setCellCount.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -11,10 +10,11 @@ class HTML_Progress_TestCase_UI_setCellCount extends PHPUnit_TestCase { /** - * HTML_Progress_UI instance + * HTML_Progress instance * * @var object */ + var $progress; var $ui; function HTML_Progress_TestCase_UI_setCellCount($name) @@ -24,17 +24,18 @@ function setUp() { - error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); + error_reporting(E_ALL & ~E_NOTICE); - $this->ui = new HTML_Progress_UI(); - Error_Raise::setContextGrabber($this->ui->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown + $this->progress = new HTML_Progress($logger); + $this->ui =& $this->progress->getUI(); } function tearDown() { - unset($this->ui); + unset($this->progress); } function _stripWhitespace($str) @@ -51,10 +52,26 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _pushCallback($err) + { + // don't die if the error is an exception (as default callback) + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } } /** @@ -67,6 +84,7 @@ return; } $this->ui->setCellCount(''); + $this->_getResult(); } function test_setCellCount_fail_less_1() @@ -75,6 +93,7 @@ return; } $this->ui->setCellCount(0); + $this->_getResult(); } function test_setCellCount_horizontal_valid_width() @@ -110,5 +129,4 @@ $this->assertFalse($this->errorThrown, 'error thrown'); } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setFillWay.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setFillWay.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setFillWay.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setFillWay.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setFillWay.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setFillWay.php Wed May 5 14:24:06 2004 @@ -1,9 +1,8 @@ <?php - /** * API setFillWay Unit tests for HTML_Progress_UI class. * - * @version $Id: HTML_Progress_TestCase_UI_setFillWay.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_UI_setFillWay.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -11,10 +10,11 @@ class HTML_Progress_TestCase_UI_setFillWay extends PHPUnit_TestCase { /** - * HTML_Progress_UI instance + * HTML_Progress instance * * @var object */ + var $progress; var $ui; function HTML_Progress_TestCase_UI_setFillWay($name) @@ -24,17 +24,18 @@ function setUp() { - error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); + error_reporting(E_ALL & ~E_NOTICE); - $this->ui = new HTML_Progress_UI(); - Error_Raise::setContextGrabber($this->ui->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown + $this->progress = new HTML_Progress($logger); + $this->ui =& $this->progress->getUI(); } function tearDown() { - unset($this->ui); + unset($this->progress); } function _stripWhitespace($str) @@ -51,10 +52,26 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _pushCallback($err) + { + // don't die if the error is an exception (as default callback) + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } } /** @@ -67,6 +84,7 @@ return; } $this->ui->setFillWay(0); + $this->_getResult(); } function test_setFillWay_fail_invalid_value() @@ -75,6 +93,7 @@ return; } $this->ui->setFillWay('right'); + $this->_getResult(); } function test_setFillWay_natural() @@ -83,9 +102,7 @@ return; } $this->ui->setFillWay('natural'); - - $this->assertFalse($this->errorThrown, 'error thrown'); + $this->_getResult(); } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setOrientation.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setOrientation.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setOrientation.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setOrientation.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setOrientation.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setOrientation.php Wed May 5 14:24:06 2004 @@ -1,9 +1,8 @@ <?php - /** * API setOrientation Unit tests for HTML_Progress_UI class. * - * @version $Id: HTML_Progress_TestCase_UI_setOrientation.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_UI_setOrientation.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -11,10 +10,11 @@ class HTML_Progress_TestCase_UI_setOrientation extends PHPUnit_TestCase { /** - * HTML_Progress_UI instance + * HTML_Progress instance * * @var object */ + var $progress; var $ui; function HTML_Progress_TestCase_UI_setOrientation($name) @@ -24,17 +24,18 @@ function setUp() { - error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); + error_reporting(E_ALL & ~E_NOTICE); - $this->ui = new HTML_Progress_UI(); - Error_Raise::setContextGrabber($this->ui->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown + $this->progress = new HTML_Progress($logger); + $this->ui =& $this->progress->getUI(); } function tearDown() { - unset($this->ui); + unset($this->progress); } function _stripWhitespace($str) @@ -51,10 +52,26 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _pushCallback($err) + { + // don't die if the error is an exception (as default callback) + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } } /** @@ -67,6 +84,7 @@ return; } $this->ui->setOrientation(''); + $this->_getResult(); } function test_setOrientation_fail_invalid_value() @@ -75,6 +93,7 @@ return; } $this->ui->setOrientation(0); + $this->_getResult(); } function test_setOrientation_vertical_valid_width() @@ -127,9 +146,7 @@ return; } $this->ui->setOrientation(HTML_PROGRESS_BAR_VERTICAL); - - $this->assertFalse($this->errorThrown, 'error thrown'); + $this->_getResult(); } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setScript.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setScript.php diff -u pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setScript.php:1.1 pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setScript.php:1.2 --- pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setScript.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setScript.php Wed May 5 14:24:06 2004 @@ -1,9 +1,8 @@ <?php - /** * API setScript Unit tests for HTML_Progress_UI class. * - * @version $Id: HTML_Progress_TestCase_UI_setScript.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: HTML_Progress_TestCase_UI_setScript.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -11,10 +10,11 @@ class HTML_Progress_TestCase_UI_setScript extends PHPUnit_TestCase { /** - * HTML_Progress_UI instance + * HTML_Progress instance * * @var object */ + var $progress; var $ui; function HTML_Progress_TestCase_UI_setScript($name) @@ -24,17 +24,18 @@ function setUp() { - error_reporting(E_ALL); - $this->errorThrown = false; - set_error_handler(array(&$this, 'errorHandler')); + error_reporting(E_ALL & ~E_NOTICE); - $this->ui = new HTML_Progress_UI(); - Error_Raise::setContextGrabber($this->ui->_package, array('Error_Util', '_getFileLine')); + $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver + $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message + $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown + $this->progress = new HTML_Progress($logger); + $this->ui =& $this->progress->getUI(); } function tearDown() { - unset($this->ui); + unset($this->progress); } function _stripWhitespace($str) @@ -51,10 +52,26 @@ return false; } - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline"); - $this->errorThrown = true; - $this->assertTrue(false, $errstr); + function _msgCallback(&$stack, $err) + { + $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); + return $message; + } + + function _pushCallback($err) + { + // don't die if the error is an exception (as default callback) + } + + function _getResult() + { + $s = &PEAR_ErrorStack::singleton('HTML_Progress'); + if ($s->hasErrors()) { + $err = $s->pop(); + $this->assertTrue(false, $err['message']); + } else { + $this->assertTrue(true); + } } /** @@ -67,6 +84,7 @@ return; } $this->ui->setScript(100); + $this->_getResult(); } function test_setScript_fail_no_file() @@ -75,6 +93,7 @@ return; } $this->ui->setScript('progress1.js'); + $this->_getResult(); } function test_setScript() @@ -83,9 +102,7 @@ return; } $this->ui->setScript('progress3.js'); - - $this->assertFalse($this->errorThrown, 'error thrown'); + $this->_getResult(); } } - ?> http://cvs.php.net/diff.php/pear/HTML_Progress/tests/testsuite.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/tests/testsuite.php diff -u pear/HTML_Progress/tests/testsuite.php:1.1 pear/HTML_Progress/tests/testsuite.php:1.2 --- pear/HTML_Progress/tests/testsuite.php:1.1 Sat Nov 15 13:27:11 2003 +++ pear/HTML_Progress/tests/testsuite.php Wed May 5 14:24:06 2004 @@ -3,7 +3,7 @@ /** * HTML output for PHPUnit suite tests. * - * @version $Id: testsuite.php,v 1.1 2003/11/15 18:27:11 thesaur Exp $ + * @version $Id: testsuite.php,v 1.2 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ @@ -45,22 +45,31 @@ <h2>Tests</h2> <?php $testcases = array( - 'HTML_Progress_TestCase_DM', - 'HTML_Progress_TestCase_UI_setOrientation', - 'HTML_Progress_TestCase_UI_setFillWay', - 'HTML_Progress_TestCase_UI_setCellCount', - 'HTML_Progress_TestCase_UI_setCellAttributes', - 'HTML_Progress_TestCase_UI_setScript', 'HTML_Progress_TestCase_setIndeterminate', 'HTML_Progress_TestCase_setBorderPainted', 'HTML_Progress_TestCase_setStringPainted', - 'HTML_Progress_TestCase_getString', - 'HTML_Progress_TestCase_getDM', 'HTML_Progress_TestCase_setDM', - 'HTML_Progress_TestCase_getUI', 'HTML_Progress_TestCase_setUI', + 'HTML_Progress_TestCase_setModel', + 'HTML_Progress_TestCase_setAnimSpeed', 'HTML_Progress_TestCase_addListener', - 'HTML_Progress_TestCase_removeListener' + 'HTML_Progress_TestCase_removeListener', + + 'HTML_Progress_TestCase_UI_setOrientation', + 'HTML_Progress_TestCase_UI_setFillWay', + 'HTML_Progress_TestCase_UI_setCellCount', + 'HTML_Progress_TestCase_UI_getCellAttributes', + 'HTML_Progress_TestCase_UI_setCellAttributes', + 'HTML_Progress_TestCase_UI_setCellCoordinates', + 'HTML_Progress_TestCase_UI_getBorderAttributes', + 'HTML_Progress_TestCase_UI_getStringAttributes', + 'HTML_Progress_TestCase_UI_getProgressAttributes', + 'HTML_Progress_TestCase_UI_setScript', + + 'HTML_Progress_TestCase_DM_setMinimum', + 'HTML_Progress_TestCase_DM_setMaximum', + 'HTML_Progress_TestCase_DM_setIncrement', + 'HTML_Progress_TestCase_DM_setValue' ); http://cvs.php.net/co.php/pear/HTML_Progress/tests/ancestor.ini?r=1.1&p=1 Index: pear/HTML_Progress/tests/ancestor.ini +++ pear/HTML_Progress/tests/ancestor.ini ; ; Ancestor UI model properties ; ; @version $Id: ancestor.ini,v 1.1 2004/05/05 18:24:06 farell Exp $ ; @author Laurent Laville <pear@laurent-laville.org> ; @package HTML_Progress ; [orientation] ; 1=horizontal 2=vertical 3=polygonal shape=1 fillway=natural [cell] id=progressCell%01s class=cell active-color=#006600 inactive-color=#CCCCCC font-family=Courier, Verdana font-size=8 color=#000000 width=15 height=20 spacing=2 [border] class=progressBarBorder width=0 style=solid color=#FFFFFF [string] id=installationProgress width=60 font-family=Verdana, Arial, Helvetica, sans-serif font-size=14 color=#000000 background-color=#FFFFFF align=center valign=right [progress] class=progressBar background-color=#FFFFFF auto-size=true http://cvs.php.net/co.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_DM_setIncrement.php?r=1.1&p=1 Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_DM_setIncrement.php +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_DM_setIncrement.php <?php /** * API setIncrement Unit tests for HTML_Progress_DM class. * * @version $Id: HTML_Progress_TestCase_DM_setIncrement.php,v 1.1 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ class HTML_Progress_TestCase_DM_setIncrement extends PHPUnit_TestCase { /** * HTML_Progress instance * * @var object */ var $progress; var $dm; function HTML_Progress_TestCase_DM_setIncrement($name) { $this->PHPUnit_TestCase($name); } function setUp() { error_reporting(E_ALL & ~E_NOTICE); $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown $this->progress = new HTML_Progress($logger); $this->dm =& $this->progress->getDM(); } function tearDown() { unset($this->progress); } function _stripWhitespace($str) { return preg_replace('/\\s+/', '', $str); } function _methodExists($name) { if (in_array(strtolower($name), get_class_methods($this->dm))) { return true; } $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->dm)); return false; } function _msgCallback(&$stack, $err) { $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); return $message; } function _pushCallback($err) { // don't die if the error is an exception (as default callback) } function _getResult() { $s = &PEAR_ErrorStack::singleton('HTML_Progress'); if ($s->hasErrors()) { $err = $s->pop(); $this->assertTrue(false, $err['message']); } else { $this->assertTrue(true); } } /** * TestCases for method setIncrement. * */ function test_setIncrement_fail_no_integer() { if (!$this->_methodExists('setIncrement')) { return; } $this->dm->setIncrement(''); $this->_getResult(); } function test_setIncrement_fail_zero() { if (!$this->_methodExists('setIncrement')) { return; } $this->dm->setIncrement(0); $this->_getResult(); } function test_setIncrement() { if (!$this->_methodExists('setIncrement')) { return; } $this->dm->setIncrement(5); $this->_getResult(); } } ?> http://cvs.php.net/co.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_DM_setMaximum.php?r=1.1&p=1 Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_DM_setMaximum.php +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_DM_setMaximum.php <?php /** * API setMaximum Unit tests for HTML_Progress_DM class. * * @version $Id: HTML_Progress_TestCase_DM_setMaximum.php,v 1.1 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ class HTML_Progress_TestCase_DM_setMaximum extends PHPUnit_TestCase { /** * HTML_Progress instance * * @var object */ var $progress; var $dm; function HTML_Progress_TestCase_DM_setMaximum($name) { $this->PHPUnit_TestCase($name); } function setUp() { error_reporting(E_ALL & ~E_NOTICE); $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown $this->progress = new HTML_Progress($logger); $this->dm =& $this->progress->getDM(); $this->dm->setMinimum(10); $this->dm->setMaximum(100); } function tearDown() { unset($this->progress); } function _stripWhitespace($str) { return preg_replace('/\\s+/', '', $str); } function _methodExists($name) { if (in_array(strtolower($name), get_class_methods($this->dm))) { return true; } $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->dm)); return false; } function _msgCallback(&$stack, $err) { $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); return $message; } function _pushCallback($err) { // don't die if the error is an exception (as default callback) } function _getResult() { $s = &PEAR_ErrorStack::singleton('HTML_Progress'); if ($s->hasErrors()) { $err = $s->pop(); $this->assertTrue(false, $err['message']); } else { $this->assertTrue(true); } } /** * TestCases for method setMaximum. * */ function test_setMaximum_fail_no_integer() { if (!$this->_methodExists('setMaximum')) { return; } $this->dm->setMaximum(''); $this->_getResult(); } function test_setMaximum_fail_no_positive() { if (!$this->_methodExists('setMaximum')) { return; } $this->dm->setMaximum(-1); $this->_getResult(); } function test_setMaximum_fail_less_min() { if (!$this->_methodExists('setMaximum')) { return; } $this->dm->setMaximum(1); $this->_getResult(); } function test_setMaximum() { if (!$this->_methodExists('setMaximum')) { return; } $this->dm->setMaximum(10); $this->_getResult(); } } ?> http://cvs.php.net/co.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_DM_setMinimum.php?r=1.1&p=1 Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_DM_setMinimum.php +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_DM_setMinimum.php <?php /** * API setMinimum Unit tests for HTML_Progress_DM class. * * @version $Id: HTML_Progress_TestCase_DM_setMinimum.php,v 1.1 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ class HTML_Progress_TestCase_DM_setMinimum extends PHPUnit_TestCase { /** * HTML_Progress instance * * @var object */ var $progress; var $dm; function HTML_Progress_TestCase_DM_setMinimum($name) { $this->PHPUnit_TestCase($name); } function setUp() { error_reporting(E_ALL & ~E_NOTICE); $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown $this->progress = new HTML_Progress($logger); $this->dm =& $this->progress->getDM(); } function tearDown() { unset($this->progress); } function _stripWhitespace($str) { return preg_replace('/\\s+/', '', $str); } function _methodExists($name) { if (in_array(strtolower($name), get_class_methods($this->dm))) { return true; } $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->dm)); return false; } function _msgCallback(&$stack, $err) { $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); return $message; } function _pushCallback($err) { // don't die if the error is an exception (as default callback) } function _getResult() { $s = &PEAR_ErrorStack::singleton('HTML_Progress'); if ($s->hasErrors()) { $err = $s->pop(); $this->assertTrue(false, $err['message']); } else { $this->assertTrue(true); } } /** * TestCases for method setMinimum. * */ function test_setMinimum_fail_no_integer() { if (!$this->_methodExists('setMinimum')) { return; } $this->dm->setMinimum(''); $this->_getResult(); } function test_setMinimum_fail_no_positive() { if (!$this->_methodExists('setMinimum')) { return; } $this->dm->setMinimum(-1); $this->_getResult(); } function test_setMinimum_fail_greater_max() { if (!$this->_methodExists('setMinimum')) { return; } $this->dm->setMinimum(500); $this->_getResult(); } function test_setMinimum() { if (!$this->_methodExists('setMinimum')) { return; } $this->dm->setMinimum(10); $this->_getResult(); } } ?> http://cvs.php.net/co.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_DM_setValue.php?r=1.1&p=1 Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_DM_setValue.php +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_DM_setValue.php <?php /** * API setValue Unit tests for HTML_Progress_DM class. * * @version $Id: HTML_Progress_TestCase_DM_setValue.php,v 1.1 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ class HTML_Progress_TestCase_DM_setValue extends PHPUnit_TestCase { /** * HTML_Progress instance * * @var object */ var $progress; var $dm; function HTML_Progress_TestCase_DM_setValue($name) { $this->PHPUnit_TestCase($name); } function setUp() { error_reporting(E_ALL & ~E_NOTICE); $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown $this->progress = new HTML_Progress($logger); $this->dm =& $this->progress->getDM(); $this->dm->setMinimum(10); $this->dm->setMaximum(100); } function tearDown() { unset($this->progress); } function _stripWhitespace($str) { return preg_replace('/\\s+/', '', $str); } function _methodExists($name) { if (in_array(strtolower($name), get_class_methods($this->dm))) { return true; } $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->dm)); return false; } function _msgCallback(&$stack, $err) { $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); return $message; } function _pushCallback($err) { // don't die if the error is an exception (as default callback) } function _getResult() { $s = &PEAR_ErrorStack::singleton('HTML_Progress'); if ($s->hasErrors()) { $err = $s->pop(); $this->assertTrue(false, $err['message']); } else { $this->assertTrue(true); } } /** * TestCases for method setValue. * */ function test_setValue_fail_no_integer() { if (!$this->_methodExists('setValue')) { return; } $this->dm->setValue(''); $this->_getResult(); } function test_setValue_fail_less_than_min() { if (!$this->_methodExists('setValue')) { return; } $this->dm->setValue(1); $this->_getResult(); } function test_setValue_fail_greater_than_max() { if (!$this->_methodExists('setValue')) { return; } $this->dm->setValue(200); $this->_getResult(); } function test_setValue() { if (!$this->_methodExists('setValue')) { return; } $this->dm->setValue(15); $this->_getResult(); } } ?> http://cvs.php.net/co.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_setAnimSpeed.php?r=1.1&p=1 Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_setAnimSpeed.php +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_setAnimSpeed.php <?php /** * API setAnimSpeed Unit tests for HTML_Progress class. * * @version $Id: HTML_Progress_TestCase_setAnimSpeed.php,v 1.1 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ class HTML_Progress_TestCase_setAnimSpeed extends PHPUnit_TestCase { /** * HTML_Progress instance * * @var object */ var $progress; function HTML_Progress_TestCase_setAnimSpeed($name) { $this->PHPUnit_TestCase($name); } function setUp() { error_reporting(E_ALL & ~E_NOTICE); $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown $this->progress = new HTML_Progress($logger); } function tearDown() { unset($this->progress); } function _stripWhitespace($str) { return preg_replace('/\\s+/', '', $str); } function _methodExists($name) { if (in_array(strtolower($name), get_class_methods($this->progress))) { return true; } $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->progress)); return false; } function _msgCallback(&$stack, $err) { $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); return $message; } function _pushCallback($err) { // don't die if the error is an exception (as default callback) } function _getResult() { $s = &PEAR_ErrorStack::singleton('HTML_Progress'); if ($s->hasErrors()) { $err = $s->pop(); $this->assertTrue(false, $err['message']); } else { $this->assertTrue(true); } } /** * TestCases for method setAnimSpeed. * */ function test_setAnimSpeed_fail_no_integer() { if (!$this->_methodExists('setAnimSpeed')) { return; } $this->progress->setAnimSpeed(''); $this->_getResult(); } function test_setAnimSpeed_fail_no_positive() { if (!$this->_methodExists('setAnimSpeed')) { return; } $this->progress->setAnimSpeed(-1); $this->_getResult(); } function test_setAnimSpeed_fail_greater_max_allowed() { if (!$this->_methodExists('setAnimSpeed')) { return; } $this->progress->setAnimSpeed(1500); $this->_getResult(); } function test_setAnimSpeed() { if (!$this->_methodExists('setAnimSpeed')) { return; } $this->progress->setAnimSpeed(100); $this->_getResult(); } } ?> http://cvs.php.net/co.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_setModel.php?r=1.1&p=1 Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_setModel.php +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_setModel.php <?php /** * API setModel Unit tests for HTML_Progress class. * * @version $Id: HTML_Progress_TestCase_setModel.php,v 1.1 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ class HTML_Progress_TestCase_setModel extends PHPUnit_TestCase { /** * HTML_Progress instance * * @var object */ var $progress; function HTML_Progress_TestCase_setModel($name) { $this->PHPUnit_TestCase($name); } function setUp() { error_reporting(E_ALL & ~E_NOTICE); $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message $this->progress = new HTML_Progress($logger); } function tearDown() { unset($this->progress); } function _stripWhitespace($str) { return preg_replace('/\\s+/', '', $str); } function _methodExists($name) { if (in_array(strtolower($name), get_class_methods($this->progress))) { return true; } $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->progress)); return false; } function _msgCallback(&$stack, $err) { $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); return $message; } function _getResult() { $s = &PEAR_ErrorStack::singleton('HTML_Progress'); if ($s->hasErrors()) { $err = $s->pop(); $this->assertTrue(false, $err['message']); } else { $this->assertTrue(true); } } /** * TestCases for method setModel. * */ function test_setModel_fail_no_file() { if (!$this->_methodExists('setModel')) { return; } $this->progress->setModel('progress360.php', 'phpArray'); $this->_getResult(); } function test_setModel_fail_invalid_filetype() { if (!$this->_methodExists('setModel')) { return; } $this->progress->setModel('ancestor.ini', 'simpleXML'); $this->_getResult(); } function test_setModel() { if (!$this->_methodExists('setModel')) { return; } $this->progress->setModel('ancestor.ini', 'iniCommented'); $this->_getResult(); } } ?> http://cvs.php.net/co.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_setString.php?r=1.1&p=1 Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_setString.php +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_setString.php <?php /** * API setString Unit tests for HTML_Progress class. * * @version $Id: HTML_Progress_TestCase_setString.php,v 1.1 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ class HTML_Progress_TestCase_setString extends PHPUnit_TestCase { /** * HTML_Progress instance * * @var object */ var $progress; function HTML_Progress_TestCase_setString($name) { $this->PHPUnit_TestCase($name); } function setUp() { error_reporting(E_ALL); $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message $this->progress = new HTML_Progress($logger); } function tearDown() { unset($this->progress); } function _stripWhitespace($str) { return preg_replace('/\\s+/', '', $str); } function _methodExists($name) { if (in_array(strtolower($name), get_class_methods($this->progress))) { return true; } $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->progress)); return false; } function _msgCallback(&$stack, $err) { $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); return $message; } function _getResult() { $s = &PEAR_ErrorStack::singleton('HTML_Progress'); if ($s->hasErrors()) { $err = $s->pop(); $this->assertTrue(false, $err['message']); } else { $this->assertTrue(true); } } /** * TestCases for method setString. * */ function test_setString_fail() { if (!$this->_methodExists('setString')) { return; } $this->progress->setStringPainted(false); $str = '"Receiving 1 out of 5"'; $this->progress->setString($str); $percent = $this->progress->getString(); $this->assertEquals($str, '"'.$percent.'"'); } function test_setString() { if (!$this->_methodExists('setString')) { return; } $this->progress->setStringPainted(true); $str = '"Receiving 1 out of 5"'; $this->progress->setString($str); $percent = $this->progress->getString(); $this->assertEquals($str, $percent); } } ?> http://cvs.php.net/co.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_getBorderAttributes.php?r=1.1&p=1 Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_getBorderAttributes.php +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_getBorderAttributes.php <?php /** * API getBorderAttributes Unit tests for HTML_Progress_UI class. * * @version $Id: HTML_Progress_TestCase_UI_getBorderAttributes.php,v 1.1 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ class HTML_Progress_TestCase_UI_getBorderAttributes extends PHPUnit_TestCase { /** * HTML_Progress instance * * @var object */ var $progress; var $ui; function HTML_Progress_TestCase_UI_getBorderAttributes($name) { $this->PHPUnit_TestCase($name); } function setUp() { error_reporting(E_ALL & ~E_NOTICE); $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown $this->progress = new HTML_Progress($logger); $this->ui =& $this->progress->getUI(); } function tearDown() { unset($this->progress); } function _stripWhitespace($str) { return preg_replace('/\\s+/', '', $str); } function _methodExists($name) { if (in_array(strtolower($name), get_class_methods($this->ui))) { return true; } $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->ui)); return false; } function _msgCallback(&$stack, $err) { $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); return $message; } function _pushCallback($err) { // don't die if the error is an exception (as default callback) } function _getResult() { $s = &PEAR_ErrorStack::singleton('HTML_Progress'); if ($s->hasErrors()) { $err = $s->pop(); $this->assertTrue(false, $err['message']); } else { $this->assertTrue(true); } } /** * TestCases for method getBorderAttributes. * */ function test_getBorderAttributes_fail_no_boolean() { if (!$this->_methodExists('getBorderAttributes')) { return; } $this->ui->getBorderAttributes(''); $this->_getResult(); } function test_getBorderAttributes() { if (!$this->_methodExists('getBorderAttributes')) { return; } $this->ui->getBorderAttributes(true); $this->_getResult(); } } ?> http://cvs.php.net/co.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_getCellAttributes.php?r=1.1&p=1 Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_getCellAttributes.php +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_getCellAttributes.php <?php /** * API getCellAttributes Unit tests for HTML_Progress_UI class. * * @version $Id: HTML_Progress_TestCase_UI_getCellAttributes.php,v 1.1 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ class HTML_Progress_TestCase_UI_getCellAttributes extends PHPUnit_TestCase { /** * HTML_Progress instance * * @var object */ var $progress; var $ui; function HTML_Progress_TestCase_UI_getCellAttributes($name) { $this->PHPUnit_TestCase($name); } function setUp() { error_reporting(E_ALL & ~E_NOTICE); $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown $this->progress = new HTML_Progress($logger); $this->ui =& $this->progress->getUI(); } function tearDown() { unset($this->progress); } function _stripWhitespace($str) { return preg_replace('/\\s+/', '', $str); } function _methodExists($name) { if (in_array(strtolower($name), get_class_methods($this->ui))) { return true; } $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->ui)); return false; } function _msgCallback(&$stack, $err) { $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); return $message; } function _pushCallback($err) { // don't die if the error is an exception (as default callback) } function _getResult() { $s = &PEAR_ErrorStack::singleton('HTML_Progress'); if ($s->hasErrors()) { $err = $s->pop(); $this->assertTrue(false, $err['message']); } else { $this->assertTrue(true); } } /** * TestCases for method getCellAttributes. * */ function test_getCellAttributes_fail_no_boolean() { if (!$this->_methodExists('getCellAttributes')) { return; } $this->ui->getCellAttributes(''); $this->_getResult(); } function test_getCellAttributes() { if (!$this->_methodExists('getCellAttributes')) { return; } $this->ui->getCellAttributes(true); $this->_getResult(); } } ?> http://cvs.php.net/co.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_getProgressAttributes.php?r=1.1&p=1 Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_getProgressAttributes.php +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_getProgressAttributes.php <?php /** * API getProgressAttributes Unit tests for HTML_Progress_UI class. * * @version $Id: HTML_Progress_TestCase_UI_getProgressAttributes.php,v 1.1 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ class HTML_Progress_TestCase_UI_getProgressAttributes extends PHPUnit_TestCase { /** * HTML_Progress instance * * @var object */ var $progress; var $ui; function HTML_Progress_TestCase_UI_getProgressAttributes($name) { $this->PHPUnit_TestCase($name); } function setUp() { error_reporting(E_ALL & ~E_NOTICE); $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown $this->progress = new HTML_Progress($logger); $this->ui =& $this->progress->getUI(); } function tearDown() { unset($this->progress); } function _stripWhitespace($str) { return preg_replace('/\\s+/', '', $str); } function _methodExists($name) { if (in_array(strtolower($name), get_class_methods($this->ui))) { return true; } $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->ui)); return false; } function _msgCallback(&$stack, $err) { $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); return $message; } function _pushCallback($err) { // don't die if the error is an exception (as default callback) } function _getResult() { $s = &PEAR_ErrorStack::singleton('HTML_Progress'); if ($s->hasErrors()) { $err = $s->pop(); $this->assertTrue(false, $err['message']); } else { $this->assertTrue(true); } } /** * TestCases for method getProgressAttributes. * */ function test_getProgressAttributes_fail_no_boolean() { if (!$this->_methodExists('getProgressAttributes')) { return; } $this->ui->getProgressAttributes(''); $this->_getResult(); } function test_getProgressAttributes() { if (!$this->_methodExists('getProgressAttributes')) { return; } $this->ui->getProgressAttributes(true); $this->_getResult(); } } ?> http://cvs.php.net/co.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_getStringAttributes.php?r=1.1&p=1 Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_getStringAttributes.php +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_getStringAttributes.php <?php /** * API getStringAttributes Unit tests for HTML_Progress_UI class. * * @version $Id: HTML_Progress_TestCase_UI_getStringAttributes.php,v 1.1 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ class HTML_Progress_TestCase_UI_getStringAttributes extends PHPUnit_TestCase { /** * HTML_Progress instance * * @var object */ var $progress; var $ui; function HTML_Progress_TestCase_UI_getStringAttributes($name) { $this->PHPUnit_TestCase($name); } function setUp() { error_reporting(E_ALL & ~E_NOTICE); $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown $this->progress = new HTML_Progress($logger); $this->ui =& $this->progress->getUI(); } function tearDown() { unset($this->progress); } function _stripWhitespace($str) { return preg_replace('/\\s+/', '', $str); } function _methodExists($name) { if (in_array(strtolower($name), get_class_methods($this->ui))) { return true; } $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->ui)); return false; } function _msgCallback(&$stack, $err) { $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); return $message; } function _pushCallback($err) { // don't die if the error is an exception (as default callback) } function _getResult() { $s = &PEAR_ErrorStack::singleton('HTML_Progress'); if ($s->hasErrors()) { $err = $s->pop(); $this->assertTrue(false, $err['message']); } else { $this->assertTrue(true); } } /** * TestCases for method getStringAttributes. * */ function test_getStringAttributes_fail_no_boolean() { if (!$this->_methodExists('getStringAttributes')) { return; } $this->ui->getStringAttributes(''); $this->_getResult(); } function test_getStringAttributes() { if (!$this->_methodExists('getStringAttributes')) { return; } $this->ui->getStringAttributes(true); $this->_getResult(); } } ?> http://cvs.php.net/co.php/pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellCoordinates.php?r=1.1&p=1 Index: pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellCoordinates.php +++ pear/HTML_Progress/tests/HTML_Progress_TestCase_UI_setCellCoordinates.php <?php /** * API setCellCoordinates Unit tests for HTML_Progress_UI class. * * @version $Id: HTML_Progress_TestCase_UI_setCellCoordinates.php,v 1.1 2004/05/05 18:24:06 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ class HTML_Progress_TestCase_UI_setCellCoordinates extends PHPUnit_TestCase { /** * HTML_Progress instance * * @var object */ var $progress; var $ui; function HTML_Progress_TestCase_UI_setCellCoordinates($name) { $this->PHPUnit_TestCase($name); } function setUp() { error_reporting(E_ALL & ~E_NOTICE); $logger['display_errors'] = 'off'; // don't use PEAR::Log display driver $logger['msgCallback'] = array(&$this, '_msgCallback'); // remove file&line context in error message $logger['pushCallback'] = array(&$this, '_pushCallback'); // don't die when an exception is thrown $this->progress = new HTML_Progress($logger); $this->ui =& $this->progress->getUI(); } function tearDown() { unset($this->progress); } function _stripWhitespace($str) { return preg_replace('/\\s+/', '', $str); } function _methodExists($name) { if (in_array(strtolower($name), get_class_methods($this->ui))) { return true; } $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->ui)); return false; } function _msgCallback(&$stack, $err) { $message = call_user_func_array(array(&$stack, 'getErrorMessage'), array(&$stack, $err)); return $message; } function _pushCallback($err) { // don't die if the error is an exception (as default callback) } function _getResult() { $s = &PEAR_ErrorStack::singleton('HTML_Progress'); if ($s->hasErrors()) { $err = $s->pop(); $this->assertTrue(false, $err['message']); } else { $this->assertTrue(true); } } /** * TestCases for method setCellCoordinates. * */ function test_setCellCoordinates_fail_no_integer() { if (!$this->_methodExists('setCellCoordinates')) { return; } $this->ui->setCellCoordinates('',2); $this->_getResult(); } function test_setCellCoordinates_fail_no_positive() { if (!$this->_methodExists('setCellCoordinates')) { return; } $this->ui->setCellCoordinates(-1,4); $this->_getResult(); } function test_setCellCoordinates_fail_too_small() { if (!$this->_methodExists('setCellCoordinates')) { return; } $this->ui->setCellCoordinates(1,2); $this->_getResult(); } function test_setCellCoordinates() { if (!$this->_methodExists('setCellCoordinates')) { return; } $this->ui->setCellCoordinates(5,5); $this->_getResult(); } } ?>