#25 skipping tests (refs bug#2049571)

open
nobody
None
5
2008-10-16
2008-10-16
one-mb
No

created a workaround/patch/enhancement in the meantime to the bug that I reported before ([ 2049571 ] skip() - no useful overwrite possible)

simpletest/test_case.php -> starting at line 154
/**
* Gets a list of test names. Normally that will
* be all internal methods that start with the
* name "test". This method should be overridden
* if you want a different rule.
* @return array List of test names.
* @access public
*/
function getTests() {
$methods = array();
foreach (get_class_methods(get_class($this)) as $method) {
if ($this->_isTest($method)) {
if( isset($this->aTestsToSkip)
&& (in_array($method, array_keys($this->aTestsToSkip), true)
|| in_array($method, $this->aTestsToSkip, true)
)
){
// log the skip, if reporter is capable to do so
if (method_exists($this->_reporter, 'paintSkip')) {
$message = $method;
if (isset($this->aTestsToSkip[$method])) {
$message .= ': ' . $this->aTestsToSkip[$method];
}
$this->_reporter->paintSkip($message);
}
// skipping testmethod
continue;
} else {
$methods[] = $method;
}

}
}
return $methods;
}

This allows developers to skip single testmethods by setting their names into an protected array called $aTestsToSkip
method names may be put in there as array values or array keys pointing a value containing a message string the reporter may display.

Discussion


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks