Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

do PHPUnit tests need to be inside a "/test" directory?

when using PHPUnit, is it required for tests to be inside of a /tests directory? How does PHPUnit know that a test is a "test"? Does it parse the file and look for method names, or use some sort of naming convention of files?

like image 388
ken jakson Avatar asked Sep 21 '11 22:09

ken jakson


People also ask

What is the PHPUnit XML configuration file used to organize tests?

The <testsuite> Element.

What is PHPUnit testing?

PHPUnit is a unit testing framework for the PHP programming language. It is an instance of the xUnit architecture for unit testing frameworks that originated with SUnit and became popular with JUnit. PHPUnit was created by Sebastian Bergmann and its development is hosted on GitHub.

Is PHPUnit a framework?

PHPUnit is a programmer-oriented testing framework for PHP. It is an instance of the xUnit architecture for unit testing frameworks. The currently supported versions are PHPUnit 9 and PHPUnit 8.


1 Answers

it required for tests to be inside of a /tests directory?

No.

How does PHPUnit know that a test is a "test"?

Via reflection (and by the user specifying a directory to look into).

like image 179
hakre Avatar answered Nov 06 '22 21:11

hakre