Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

84 lines (70 sloc) 1.974 kB
<?php
/**
* API setStringPainted Unit tests for HTML_Progress class.
*
* @version $Id$
* @author Laurent Laville <pear@laurent-laville.org>
* @package HTML_Progress
*/
class HTML_Progress_TestCase_setStringPainted extends PHPUnit_TestCase
{
/**
* HTML_Progress instance
*
* @var object
*/
var $progress;
function HTML_Progress_TestCase_setStringPainted($name)
{
$this->PHPUnit_TestCase($name);
}
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'));
}
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 errorHandler($errno, $errstr, $errfile, $errline) {
//die("$errstr in $errfile at line $errline");
$this->errorThrown = true;
$this->assertTrue(false, $errstr);
}
/**
* TestCases for method setStringPainted.
*
*/
function test_setStringPainted_fail_no_boolean()
{
if (!$this->_methodExists('setStringPainted')) {
return;
}
$this->progress->setStringPainted('');
}
function test_setStringPainted()
{
if (!$this->_methodExists('setStringPainted')) {
return;
}
$this->progress->setStringPainted(true);
$this->assertFalse($this->errorThrown, 'error thrown');
}
}
?>
Jump to Line
Something went wrong with that request. Please try again.