Provide unit tests for includes/form.inc

pukku - March 7, 2008 - 18:20
Project:Drupal
Version:7.x-dev
Component:forms system
Category:task
Priority:normal
Assigned:Unassigned
Status:closed
Description

THE VERSION ON THIS IS INCORRECT -- THIS IS FOR CVS/HEAD/DRUPAL 7.x.

Attached is a patch to add some tests for form.inc.

This is a very initial version, which only tests two of the theme functions, and provides only the most basic tests at that. But it's a start...

AttachmentSize
form_inc_tests.patch2.23 KB

#1

boombatower - March 10, 2008 - 00:29
Status:active» postponed

We haven't started unit testing officially yet.

We are working on how we want it done and any associated standards.

Once we begin then reroll your patch if necessary.

If you want to help finish functional testing you can write a test that hasn't already as seen on the list: http://groups.drupal.org/node/9408.

#2

pwolanin - March 16, 2008 - 00:16

here's an additional test derived from: http://drupal.org/node/117748#comment-754417

AttachmentSize
TestCase117748-231302.patch3.88 KB

#3

moshe weitzman - March 18, 2008 - 20:33

If we do decent test for poll module we will effectively have tested the obscure parts of fapi. other tests such as node edit assure the common stuff works ... even so, focused unit tests for fapi are always welcome.

#4

boombatower - May 15, 2008 - 01:56
Project:SimpleTest» Drupal
Version:6.x-1.x-dev» 7.x-dev
Component:Code» simpletest.module
Status:postponed» patch (code needs work)

Once the convention for include files is figured out this can be completed. http://groups.drupal.org/node/11020 Which should just decide on where to but include file tests. So far I believe it is includes/tests/[name_of_file].test.

Otherwise we aren't going to do unit testing in the manor originally being planned so this work can commence.

These tests need updating and completion.

#5

pwolanin - July 17, 2008 - 19:07
Status:patch (code needs work)» patch (code needs review)

ok, re-rolled the above test now that we have a location in includes/tests

AttachmentSize
fapi-test-231302-5.patch3.79 KB

#6

pwolanin - July 17, 2008 - 19:08
Component:simpletest.module» forms system

#7

boombatower - July 17, 2008 - 22:35

#8

pwolanin - July 18, 2008 - 01:44

@boombatower - does another test matter? The patch there for moving tests will probably not be used but rather just cvs rm, cvs add.

#9

boombatower - July 18, 2008 - 02:47

Not really, it can be re-rolled. Wasn't stating that as a stopper.

#10

catch - July 18, 2008 - 11:34
Status:patch (code needs review)» patch (reviewed & tested by the community)

38 passes, 0 fails, 0 exceptions

Test looks fine to me as well, so RTBC.

#11

Dries - July 19, 2008 - 07:34

I'm not sure about:

+    // Avoid output drupal warnings and messages into assert messages
+    drupal_get_messages();

First, the code comment reads a but funny. Second, is this the place to do it? What happens with previous messages? Is this something we need to move to the web test case file?

#12

pwolanin - July 19, 2008 - 14:48

@Dries - agreed the comment could use re-wording.

Basically the problem is that any dsm() error message shows up as an exception, which is normally useful so that PHP errors, etc, show up as test exceptions. In this case, we are causing the errors as a deliberate part of the testing. So, I don't think we want to clear them for normal tests, and even here it would be ideal to be able to just clear the form-required errors.

#13

pwolanin - July 19, 2008 - 18:32

Here's the same patch except for a re-worded code comment.

AttachmentSize
fapi-test-231302-13.patch3.8 KB

#14

Dries - July 19, 2008 - 19:43
Status:patch (reviewed & tested by the community)» fixed

pwolanin: yes, some more studying of the code let me to believe the same thing. Thanks for clarifying the code comment -- that will prove useful for others. Committed to CVS HEAD.

Yay to more tests.

#15

Anonymous (not verified) - August 2, 2008 - 19:52
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.