During testing token.module will throw warnings if they have the has-data attribute and no data is available. This can cause build failures by default when running tests via jenkins. There are ways to avoid the build failure, but it's fairly noisy and it would be nice if token provided a bit more control over it.

The following patch allows the warnings to be disabled via a variable_set or settings.php override.

CommentFileSizeAuthor
#1 1999298-disable-test-warnings.patch702 bytesbeeradb
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

beeradb’s picture

Status: Active » Needs review
FileSize
702 bytes
hefox’s picture

Patch works

However, when discussing it, perhaps the test that want that warning do something like $GLOBALS['drupal_test_info']['test_run_token_warning'] = TRUE and !empty($GLOBALS['drupal_test_info']['test_run_token_warning'] )

Are token tests the ones this warning is for?

mpotter’s picture

Status: Needs review » Reviewed & tested by the community

This seems useful and works for me.

Dave Reid’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs review

Warrants more discussion.

bisonbleu’s picture

I'm discovering/seeing these warnings (Attempting to perform token replacement for token type term without required data) in tests I created with SimpleTest.

Took me a while to figure out where they were coming from. And it's not exactly clear what they are telling me and if, in my use case, something needs to fixed or not. These warning are just warnings right?

AFAICT they have no undesirable effect on the outcome of my tests - except making me search for errors that don't actually exist, or do they?

The patch works as advertised.

darrenwh’s picture

Status: Needs review » Needs work

Please also add code to remove the variable in the token modules uninstall function.