Behat/Behat-docs — Issue #24: Tagged Hooks could use some clarification examples
Author: johnkary
Created: 2011-12-01 04:18:47+00:00
State: open

[Tagged Hooks](http://docs.behat.org/guides/3.hooks.html#tagged-hooks) in the Hooks guide could use a bit more explanation on how to map tags to step definition methods. After reading, I'm left guessing:

* How exactly do I use the defined @database or @orm tags from the example?
* It appears tags are used to group step definition methods?
* The code example shows ``@BeforeScenario @database,@orm`` but doesn't explain what comma-delimited tags mean. Am I expected to know all about annotations?
* How do I tag step definitions with multiple tags? I guess from the example they are comma-delimited, but is that right?

If someone can clarify the answers to these questions, and the following code example is correct, I can add some clarification to the hooks guide.

/**
* @BeforeScenario @database,@orm
*/
public function cleanDatabase()
{
// clean database before
// @database OR @orm scenarios
}

/**
* @When /^I do something with "([^"]*)"$/
* @database
*/
public function iDoSomethingWith($methodArgument) {}

/**
* @When /^I do something else with "([^"]*)"$/
* @orm
*/
public function iDoSomethingElseWith($methodArgument) {}

/**
* @When /^I do other things with "([^"]*)"$/
* @database,@orm
*/
public function iDoOtherThingsWith($methodArgument) {}