Both #360023: Update node_comment_statistics during "Publish comment" action and #306611: Fatal error when trying to invoke non-existing action callbacks were unnecessarily hold off, because we don't have any tests for actions yet.

AFAICS, actions can be invoked directly or via Trigger module. Trigger module ships with a few tests for its own functionality.

Actions can be directly invoked via actions_do(), and it seems like

- a single system action can be invoked directly, either providing the target object directly or some $context that only contains an object id

- multiple system actions can be invoked directly, ditto.

- configurable actions can be invoked, ditto.

We have an actions.test file in modules/simpletest/tests, but that is testing configuration of actions only.

In general, we have too few actions. And we have too few triggers (f.e. comment_insert, but no comment_publish), but that's off-topic.

The first of all questions is where we want to put tests for actions. Logical would be to have each module's .test file test its own actions. However, it's possible that such tests require some common helper functions to run tests for the implemented actions. I.e., it boils down to specifying the available actions, their "context" (node, comment, ...), and the expected result (potentially using a helper method).

Comments

sun’s picture

Category: task » bug
jhodgdon’s picture

Note that some tests for actions were added in #525540: trigger.module and includes/actions.inc need overhaul recently.

catch’s picture

webchick’s picture

Status: Active » Postponed (maintainer needs more info)

Could someone update this issue with what tests from above are remaining to implement? Depending on how wide of a swath is missing, it might make sense to bump this back to critical in its own right.

andypost’s picture

webchick’s picture

Status: Postponed (maintainer needs more info) » Fixed

Ok cool. Let's mark this sucker fixed then. Thanks!

Status: Fixed » Closed (fixed)
Issue tags: -Needs tests, -API clean-up

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