/**
* @param Bundle $bundle
* @param OutputInterface $output
* @param array $parameters
*/
public function generateBehatTests(Bundle $bundle, OutputInterface $output, array $parameters)
{
$dirPath = sprintf("%s/Features", $bundle->getPath());
$skeletonDir = sprintf("%s/Features", $this->fullSkeletonDir);
// First copy all the content
$this->filesystem->mirror($this->fullSkeletonDir, $bundle->getPath());
// Now render the Context files to replace the namespace etc.
if ($handle = opendir($skeletonDir . "/Context")) {
while (false !== ($entry = readdir($handle))) {
// Check to make sure we skip hidden folders
// And we render the files ending in .php
if (substr($entry, 0, 1) != '.' && substr($entry, -strlen(".php")) === ".php") {
$this->renderFile("/Features/Context/" . $entry, $dirPath . "/Context/" . $entry, $parameters);
}
}
closedir($handle);
}
$featureContext = $dirPath . "/Context/FeatureContext.php";
if ($this->filesystem->exists($featureContext)) {
$contents = file_get_contents($featureContext);
$contents = str_replace('-adminpwd-', $this->container->getParameter('kunstmaan_admin.admin_password'), $contents);
file_put_contents($featureContext, $contents);
}
$output->writeln('Generating Behat Tests : <info>OK</info>');
}