Damiano Barbati
Damiano Barbati

Reputation: 3496

PHPUnit and auto require of testing class

Isn't PHPUnit supposed to require the class itself using the naming conventiong "ClassTest"?

However it raises a fatal error for file not found "Router.php". If I require it manually everything is ok.

What's wrong with it?

Upvotes: 0

Views: 214

Answers (1)

Schleis
Schleis

Reputation: 43700

There is nothing wrong with it. How would PHPUnit know where your classes are in relation from the tests?

For your tests, you need to either require the class under test yourself or create an autoloader that will require the class for you. PHPUnit has no idea where it should be getting the files from. It has an autoloader for its internal files but that is it.

Upvotes: 1

Related Questions