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

douggreen - July 11, 2008 - 14:16

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

douggreen - August 20, 2008 - 23:06

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.

AttachmentSize
281399.patch 8.92 KB

#3

douggreen - August 20, 2008 - 23:08
Status:active» needs work

#4

hailu - August 23, 2008 - 11:47
Assigned to:fen» Anonymous

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

AttachmentSize
somestyletesting.patch 9.28 KB

#6

douggreen - August 24, 2008 - 11:28

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

AttachmentSize
281399.patch 17.59 KB

#7

douggreen - August 24, 2008 - 11:29

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

AttachmentSize
281399.patch 16.22 KB

#8

stella - August 25, 2008 - 12:18

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

#9

douggreen - August 25, 2008 - 20:44

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

stella - August 25, 2008 - 21:01

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

hailu - August 26, 2008 - 17:22

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.

AttachmentSize
simpletests_added.patch 17.99 KB

#12

douggreen - August 28, 2008 - 15:02
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.

#13

douggreen - September 21, 2008 - 17:24
Status:active» fixed

I've finished these and committed them.

#14

Anonymous (not verified) - October 5, 2008 - 17:32
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.