Where do I put my test?

From: Date: Thu, 07 May 2009 14:00:10 +0000
Subject: Where do I put my test?
Groups: php.qa 
Request: Send a blank email to php-qa+get-64893@lists.php.net to get a copy of this message
Hi Sebs just raised a good question on IRC about where in PHP source tree to put test cases. Most of the time the answer is guessable. For example, if you write a tests for ex/sockets, then the test goes in the directory ext/sockets/tests. The general rule is that you look for the directory that has the C source file that implements a function, there is usually a sub directory called 'tests' where you can put tests. ext/standard is a little bit different in that tests for ext/standard/xxx.c can be found in directory ext/standard/tests/xxx, but still not too hard to figure out. The SVN repos is set up with the same structure as the PHP source tree - so checking in should be easy. However, this wouldn't be PHP if there wasn't an exception :-) Sebs wrote a test for 'ignore_user_abort'. The C source code that implements this is in ext/standard/basic_functions.c, but there is no test directory called ext/standard/tests/basic functions - so where does the test go? Well, I would put this test in ext/standard/tests/general_functions, on the basis that I find other tests for functions that are implemented in ext/standard/basic_functions.c in that directory. It took me a bit of 'grep'ing and 'find'ing to get to this conclusion, I'm not sure if there is a better answer, if anyone from the development team has one, please shout :-) Zoe

« previous php.qa (#64893) next »