PHPUnit doesn't recognize file_exists()
- by Ondrej Slinták
I've set up a project with unit test files in NetBeans. I set bootstrap to C:\www\foo\_tests\TestAutoload.php and put simple autoload method to this file:
function __autoload( $class_name ) {
    // series of ifs
    if ( ... ) {
        $file_name = ...
    }
    if ( file_exists ( $file_name ) ) {
        require_once( $file_name );
    } else {
        echo "autoload error";
    }
}
All of my tests fail on autoload this way. They always output just "autoload error". If I don't check if file_exists and just use require_once( $file ) no matter what's in $file, it works perfectly.
Anyone encountered anything like this before? It's not something I couldn't resolve by simply not checking whether file exists or not, but I'm interested why it does this and if I can cheat it somehow.