GHOP #112: Write Simpletest tests for Actions for content
| Project: | SimpleTest |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | cwgordon7 |
| Status: | closed |
Description
The main work for this task is to write a small suite of tests to check the basic functionality of Actions associated with changes to site content. This suite should be written as a single .test file.
Suggested tests:
1. admin/build/actions/assign/node Assign an action. Trigger the action and make sure it fires.
2. admin/build/actions/assign/node Attempt to assign the same action twice. Confirm error.
3. admin/build/actions/assign/node Remove an assigned action. Make sure it no longer fires.

#1
link to task: http://code.google.com/p/google-highly-open-participation-drupal/issues/...
#2
File attached as a .txt. If anything fails it's because it's a critical Drupal core issue, not because anything's wrong with this file.
#3
using chx's patch from http://drupal.org/node/203509 and enabling trigger the test runs, without fail. Coding style looks good, strings in t().
Testing an error situation with reverting the patch mentioned above gives me a nice error, so does running it without trigger enabled, so it indeed functions well.
#4
Thanks for the review, pwolanin. Test rerolled.
#5
note - in IRC I suggested writing the aid as
md5(callback)for readability, testing all 6 actions, and comparing$node->status, etc to an int rather than a string.#6
This code comment needs fixing:
// Set action id to "publish post".Also, there is a random $i in various calls like:
$node->body = $this->randomName(32 + $i)#7
Thanks, test file rerolled.
#8
why $action rather than $this->actionName($action)? you shouldn't concat like that in t()
t('Check to make sure the "'. $action .'" action is fired.'));look at your code below:
t('Action %action has been unassigned.', array('%action' => $this->actionName($action)))that's a better model
#9
Ok, rerolled. Except with @action.
#10
// Action should NOT work.$this->assertTrue(!$this->actionWorked($action, $node2)
why not:
$this->assertFalse($this->actionWorked($action, $node2)#11
Ok, rerolled.
#12
Ok, rerolled (again).
#13
Ok, following our discussion on IRC, this patch is rerolled & shortened significantly.
#14
There is something weird going on with trigger/actions when trying to sequentially run several sequentially. Also, we found this bug - need to patch to make this work on PHP4.4: http://drupal.org/node/203846
So - this issue demonstrates the value of this exercise - we turned up 2 core bugs! Thanks cwgordon7
#15
Rerolled
#16
Whoops. Rerolled.
#17
Hi,
took a look at the test, and everything seems fine - the test came back with 6 failures, but the failures don't look related to the test.
(Disclaimer: Not only am I a student who is taking part in GHOP, but I am also not an expert in simpletest. But the test still looks ok to me.)
The output of the test is attached if anyone's interested in it.
#18
Adding on to what kyl191 said: The tests kyl191 performed were without chx's patch, so failures were to be expected.
#19
some trivial patches that break the tests
#20
I did a quick fix on a couple of the error messages, and re-rolled this in patch form (diffed from the simpletest module directory). Looks good to me.
#21
@cwgordon7: please post the final version to the GHOP queue
#22
Committed thanks.
#23
Automatically closed -- issue fixed for two weeks with no activity.