Current File : //opt/RZphp56/includes/test/HTML_Progress2/tests/HTML_Progress2_TestCase_setFillWay.php |
<?php
/**
* API setFillWay Unit tests for HTML_Progress2 class.
*
* @version $Id: HTML_Progress2_TestCase_setFillWay.php,v 1.2 2005/08/18 09:40:39 farell Exp $
* @author Laurent Laville <pear@laurent-laville.org>
* @package HTML_Progress2
* @ignore
*/
class HTML_Progress2_TestCase_setFillWay extends PHPUnit_TestCase
{
/**
* HTML_Progress2 instance
*
* @var object
*/
var $progress;
function HTML_Progress2_TestCase_setFillWay($name)
{
$this->PHPUnit_TestCase($name);
}
function setUp()
{
error_reporting(E_ALL & ~E_NOTICE);
$prefs= array('push_callback' => array(&$this, '_handleError'));
$this->progress = new HTML_Progress2($prefs);
}
function tearDown()
{
unset($this->progress);
}
function _methodExists($name)
{
if (substr(PHP_VERSION,0,1) < '5') {
$n = strtolower($name);
} else {
$n = $name;
}
if (in_array($n, get_class_methods($this->progress))) {
return true;
}
$this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->progress));
return false;
}
function _handleError($code, $level)
{
// don't die if the error is an exception (as default callback)
return PEAR_ERROR_RETURN;
}
function _getResult()
{
if ($this->progress->hasErrors()) {
$err = $this->progress->getError();
$msg = $err->getMessage() . ' >>';
$this->assertTrue(false, $msg);
} else {
$this->assertTrue(true);
}
}
/**
* TestCases for method setFillWay().
*/
function test_setFillWay_fail_no_string()
{
if (!$this->_methodExists('setFillWay')) {
return;
}
$this->progress->setFillWay(true);
$this->_getResult();
}
function test_setFillWay_fail_invalid_value()
{
if (!$this->_methodExists('setFillWay')) {
return;
}
$this->progress->setFillWay('right');
$this->_getResult();
}
function test_setFillWay_natural()
{
if (!$this->_methodExists('setFillWay')) {
return;
}
$this->progress->setFillWay('natural');
$this->_getResult();
}
}
?>