3

I'm developing a custom module. My module calls drupal_alter() with a $type unique to my module, so other modules can alter the behavior of my module.

I'd like to write a SimpleTest for my module, which includes a test implementation of the hook my module calls. This hook implementation should only be used by my SimpleTest; it should not apply when the module is installed on a full Drupal installation (so therefore I can't place my test hook implementation in the .module file).

What's the right way to do implement a hook that only applies to an active SimpleTest?

2

You can create a test module and place hidden = TRUE in the .info file.

This will hide the module in the user interface but you can still enable it in your setUp() method.

See http://drupalcode.org/project/drupal.git/blob/refs/heads/7.x:/modules/file/tests/file_module_test.info for an example.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.