PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Testing » PHPUnit2 » Bug #3676

Test results in error when include fails

Details

Submitted2005-03-02 23:09 UTC
Frominfo at e-novative dot de
StatusClosed
PackagePHPUnit2
PHP Version5.0.2
OSWinXP
Roadmaps(Not assigned)

Comments

[2005-03-02 23:09 UTC] info at e-novative dot de

Description:
------------
Seems like in PHPUnit 2.2.0beta5 a test of a method trying to include (or include_once) something that does not exist results in an error. I am using include in a method to check for presence of certain PEAR classes.

Reproduce code:
---------------
Excerpt from the tested method:

foreach ($this->RequiredPearClasses as $class)
{
@include_once str_replace('_', '/', $class) . '.php';
if (!class_exists($class)) $result[] = $class;
}

For $this->RequiredPearClasses = array('PEAR') the test runs as expected. For $this->RequiredPearClasses = array('Absolute_Nonsense_Class'), see below:

Expected result:
----------------
A failed include should produce a warning, but (as opposed to a failed require) no error, thus the test should not fail.

Actual result:
--------------
There was 1 error:
1) testCheckRequirementsFail
myClass::checkPearClasses(Absolute/Nonsense/Class.php): failed to
open stream: No such file or directory

FAILURES!!!
Tests run: 7, Failures: 0, Errors: 1, Incomplete Tests: 0.