Skip to content

Commit

Permalink
Added optional file name parameter.
Browse files Browse the repository at this point in the history
  • Loading branch information
Neal Vanmeert committed Mar 20, 2015
1 parent 59eb3bc commit f3bcf07
Show file tree
Hide file tree
Showing 5 changed files with 674 additions and 680 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@ formatters:
emuse\BehatHTMLFormatter\BehatHTMLFormatterExtension:
name: html
renderer: Twig,Behat2
file_name: Index
</pre>

The *output* parameter is relative to %paths.base% and, when omitted, will default to that same path.

The *renderer* is the renderer engine and the report format that you want to be generated.

The *file_name* is optional. When it is added, the report name will be fixed instead fo generated, and this file will be overwritten with every build.

Actually, there is 3 formats :

- **Twig** : new report format based on Twig, **requires Twig installed**
Expand Down
117 changes: 57 additions & 60 deletions src/BehatHTMLFormatterExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,68 +12,65 @@
* Class BehatHTMLFormatterExtension
* @package Features\Formatter
*/
class BehatHTMLFormatterExtension implements ExtensionInterface
{
/**
* You can modify the container here before it is dumped to PHP code.
*
* @param ContainerBuilder $container
*
* @api
*/
public function process(ContainerBuilder $container)
{
}
class BehatHTMLFormatterExtension implements ExtensionInterface {
/**
* You can modify the container here before it is dumped to PHP code.
*
* @param ContainerBuilder $container
*
* @api
*/
public function process(ContainerBuilder $container) {
}

/**
* Returns the extension config key.
*
* @return string
*/
public function getConfigKey()
{
return "emusehtml";
}
/**
* Returns the extension config key.
*
* @return string
*/
public function getConfigKey() {
return "emusehtml";
}

/**
* Initializes other extensions.
*
* This method is called immediately after all extensions are activated but
* before any extension `configure()` method is called. This allows extensions
* to hook into the configuration of other extensions providing such an
* extension point.
*
* @param ExtensionManager $extensionManager
*/
public function initialize(ExtensionManager $extensionManager)
{
}
/**
* Initializes other extensions.
*
* This method is called immediately after all extensions are activated but
* before any extension `configure()` method is called. This allows extensions
* to hook into the configuration of other extensions providing such an
* extension point.
*
* @param ExtensionManager $extensionManager
*/
public function initialize(ExtensionManager $extensionManager) {
}

/**
* Setups configuration for the extension.
*
* @param ArrayNodeDefinition $builder
*/
public function configure(ArrayNodeDefinition $builder)
{
$builder->children()->scalarNode("name")->defaultValue("emusehtml");
$builder->children()->scalarNode("renderer")->defaultValue("behat2");
$builder->children()->scalarNode('output')->defaultValue('.');
}
/**
* Setups configuration for the extension.
*
* @param ArrayNodeDefinition $builder
*/
public function configure(ArrayNodeDefinition $builder) {
$builder->children()->scalarNode("name")->defaultValue("emusehtml");
$builder->children()->scalarNode("renderer")->defaultValue("behat2");
$builder->children()->scalarNode("file_name")->defaultValue("generated");
$builder->children()->scalarNode('output')->defaultValue('.');
}

/**
* Loads extension services into temporary container.
*
* @param ContainerBuilder $container
* @param array $config
*/
public function load(ContainerBuilder $container, array $config)
{
$definition = new Definition("emuse\\BehatHTMLFormatter\\Formatter\\BehatHTMLFormatter");
$definition->addArgument($config['name']);
$definition->addArgument($config['renderer']);
$definition->addArgument('%paths.base%');
$container->setDefinition("html.formatter", $definition)
->addTag("output.formatter");
}
/**
* Loads extension services into temporary container.
*
* @param ContainerBuilder $container
* @param array $config
*/
public function load(ContainerBuilder $container, array $config) {
$definition = new Definition("emuse\\BehatHTMLFormatter\\Formatter\\BehatHTMLFormatter");
$definition->addArgument($config['name']);
$definition->addArgument($config['renderer']);
$definition->addArgument($config['file_name']);

$definition->addArgument('%paths.base%');
$container->setDefinition("html.formatter", $definition)
->addTag("output.formatter");
}
}
Loading

0 comments on commit f3bcf07

Please sign in to comment.