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.

Comments

douggreen’s picture

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).

douggreen’s picture

StatusFileSize
new8.92 KB

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.

douggreen’s picture

Status: Active » Needs work
hailu’s picture

Assigned: fen » Unassigned
StatusFileSize
new9.28 KB

Here's a re rolled patch with some of the functionality from coder_style.inc migrated to coder_style.test

douggreen’s picture

StatusFileSize
new17.59 KB

This version fixes some of the errors, that we're broken in my original patch, and add's Hailu's additional tests.

douggreen’s picture

StatusFileSize
new16.22 KB

Actually, that patch includes 2 things it shouldn't, so here it is again...

stella’s picture

It's not necessary to have the coder_update_1() function to delete everything from the cache table. In Drupal 6, update.php calls drupal_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 DrupalWebTestCase instead of DrupalTestCase, and using getInfo() instead of get_info()? The latter one might explain why the Coder tests don't appear on admin/build/testing

Cheers,
Stella

douggreen’s picture

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?

stella’s picture

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.

hailu’s picture

StatusFileSize
new17.99 KB

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.

douggreen’s picture

Title: convert the coder tests to simpletests » Create Simpletest for the Coder 6.x Style Review
Status: Needs work » Active

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.

douggreen’s picture

Status: Active » Fixed

I've finished these and committed them.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.