I am working on D6.14 properly patched with the simpletest patch.
This is a pretty difficult bug to explain: I have a piece of code that imports data from XML files as nodes. The code works just fine: if data refers to an existing node, it updates it, if it's a new node, it creates it. All the code uses proper API functions (db_query with {} for tables) node_load and node_save, etc, etc... It does not contain any weird shortcut.
I wrote a test that imports a file with a brand new node, and then imports a file with the same modified node. Insert and update are performed by the exact same procedure, so the code is the same, the only thing changing being the file. Moreover, if I cut&paste the code from the test to the module, the code works.
The problem is: the test fails. From the limited debugging tools at my disposal, it simply seems the second call to my module's function is somehow ignored or fails (like if the module could not write anymore in the test_table ?!?). The assert statements can only find the data as inserted by the first call (so the original node, not the modified one).
I do hope it's just a mistake of mines in the test, but I fear it has to do with simpletest, instead.
For clarity I attached the test file. The test that fails is called "testProductUpdate".
| Comment | File | Size | Author |
|---|---|---|---|
| conduit.test | 3.92 KB | Mac Ryan |
Comments
Comment #1
dave reidI think what's happening here is you're expecting data from one test function to carry over into a second test function, which is not how simpletest works. For every testSomething() function you have, it creates a new/clean testing 'database'. If you need to carry information over between functions, either merge the two test functions or put your 'insert' data into the setUp() function in the test (so it gets run before every testSomething() function).