On Fri, 2011-07-22 at 12:01 +0200, Michal Čihař wrote:
Hi
Dne Fri, 22 Jul 2011 10:37:42 +0100 Rouslan Placella rouslan@placella.com napsal(a):
I wrote some unit tests for my features, but I'm not too sure what to do with them. They work fine, but that's my first time writing unit tests, so I'm not too sure if I used all the best practices for them. Should I check them into master? Something else?
I see you have some changes in testing_rte branch, which definitely should not be merged (like changes in build.xml). Otherwise the tests look okay and IMHO could be merged.
OK, I pushed the tests and deleted my testing_rte branch (it was a mess anyway).
Now, as far as the tests themselves, there is an issue in a few tests where I had to use some hackish code to get the tests to run. For example, in PMA_RTN_getQueryFromRequest_test.php I have this piece of art:
------ >% ------ $cfg['ShowFunctionFields'] = false; eval(substr(file_get_contents('libraries/data_mysql.inc.php'), 5, -3)); ------ >% ------
Here's what I think is the problem here: data_mysql.inc.php is included in some other file before this test is run and then $cfg['ColumnTypes'] is also unset in some other test. So when it's my turn to run a test, simply using require_once does nothing since that file was already executed before :(
Again, not sure if this can/should be fixed, but I thought that it's worth a mention.
Rouslan