Create Simpletest for the Coder 6.x Style Review
fen - July 11, 2008 - 14:12
| Project: | Coder |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
It would be cleaner to update the coder framework to act as simpletests so that we could run tests as groups and maintain the system in a compatible way.

#1
The coder tests were implemented before the simpletest framework was created. So, the coder tests are just include files, and the way we test coder is running coder on itself and manually looking at the results. These tests should be converted to simpletest framework.
Fen and Hailu are planning on working on this together... (please grant them CVS rights for this, Thanks).
#2
We may want to restructure the test logic some (I'm not completely satisfied with it), but here's a start on the simpletests. Notice that I had to restructure coder a little to give us cleaner access to the warning messages. Also notice that you need to clear the cache after applying this patch (an update handler is included). If you re-roll this patch, remember that coder_style.test is a new file, which means that you'll need to follow Create patches.
#3
#4
Here's a re rolled patch with some of the functionality from coder_style.inc migrated to coder_style.test
#6
This version fixes some of the errors, that we're broken in my original patch, and add's Hailu's additional tests.
#7
Actually, that patch includes 2 things it shouldn't, so here it is again...
#8
It's not necessary to have the
coder_update_1()function to delete everything from the cache table. In Drupal 6, update.php callsdrupal_flush_all_caches(). Everyone should be running update.php on module upgrade, though it's possible alright that not everyone does if there appears to be no updates shown to be available on update.php summary page...I'm not that familiar with the Simple Test stuff yet, but shouldn't you be extending
DrupalWebTestCaseinstead ofDrupalTestCase, and usinggetInfo()instead ofget_info()? The latter one might explain why the Coder tests don't appear on admin/build/testingCheers,
Stella
#9
Stella, is that true. That people should submit update.php, even when it doesn't show that there are any upgrades?
I can see creating an empty coder_update_1() hook, without the cache, but don't we need a hook so that people submit the form?
#10
Personally, I would always run update.php even if I don't see any hook updates. Maybe that's just because I know the drupal cache, etc, will be cleared when it's run.
It is part of the generic module upgrade instructions iirc.
#11
Here's another patch, with doug's fixes from the 281399_1.patch and some new tests all rolled into one big happy package.
I'm fairly new to the drupal world, and one thing that's been wired into my brain is to run update.php whenever any new or different version of a module is installed...fwiw.
I've briefly tested this patch using '-p1' arg against a clean 6.x-1.x-dev coder install, and the coder_style.test file was placed in the correct directory, coder/tests, which in turn got the coder tests to show up at admin/build/simpletest.
I think a fresh application of this patch will still need the update hook to run in able to see the tests though. Caches still need to be cleared.
#12
I committed the framework for simpletests so that we could get a few more people involved with writing tests. See #301113: Create SimpleTest for the Coder Comment Review, #301109: Create SimpleTest for the Coder 6.x Upgrade Review and #301125: Create SimpleTest for the Coder SQL Review. If the style test is not complete, please continue development of it here, and post new patches.
#13
I've finished these and committed them.
#14
Automatically closed -- issue fixed for two weeks with no activity.