/** * Creates features path structure (initializes behat tests structure). * * @param Behat\Behat\PathLocator $locator path locator * @param Symfony\Component\Console\Input\OutputInterface $output output console */ protected function initFeaturesDirectoryStructure(PathLocator $locator, OutputInterface $output) { $basePath = realpath($locator->getWorkPath()) . DIRECTORY_SEPARATOR; $featuresPath = $locator->getFeaturesPath(); $bootstrapPath = $locator->getBootstrapPath(); if (!is_dir($featuresPath)) { mkdir($featuresPath, 0777, true); $output->writeln('<info>+d</info> ' . str_replace($basePath, '', realpath($featuresPath)) . ' <comment>- place your *.feature files here</comment>'); } if (!is_dir($bootstrapPath)) { mkdir($bootstrapPath, 0777, true); $output->writeln('<info>+d</info> ' . str_replace($basePath, '', realpath($bootstrapPath)) . ' <comment>- place bootstrap scripts and static files here</comment>'); file_put_contents($bootstrapPath . DIRECTORY_SEPARATOR . 'FeatureContext.php', $this->getFeatureContextSkelet()); $output->writeln('<info>+f</info> ' . str_replace($basePath, '', realpath($bootstrapPath)) . DIRECTORY_SEPARATOR . 'FeatureContext.php <comment>- place your feature related code here</comment>'); } }
/** * Creates features path structure (initializes behat tests structure). * * @param Behat\Behat\PathLocator $locator path locator * @param Symfony\Component\Console\Input\OutputInterface $output output console */ protected function initFeaturesDirectoryStructure(PathLocator $locator, OutputInterface $output) { $basePath = getcwd() . DIRECTORY_SEPARATOR; $featuresPath = $locator->getFeaturesPath(); $supportPath = $locator->getSupportPath(); $stepsPath = current($locator->locateDefinitionsPaths(false)); $envPath = current($locator->locateEnvironmentConfigsPaths(false)); $bootPath = current($locator->locateBootstrapsPaths(false)); if (!is_dir($featuresPath)) { mkdir($featuresPath, 0777, true); $output->writeln('<info>+d</info> ' . str_replace($basePath, '', $featuresPath) . ' <comment>- place your *.feature files here</comment>'); } if (!is_dir($stepsPath)) { mkdir($stepsPath, 0777, true); $output->writeln('<info>+d</info> ' . str_replace($basePath, '', $stepsPath) . ' <comment>- place step definition files here</comment>'); copy(__DIR__ . '/../../Skeleton/steps.php', $stepsPath . DIRECTORY_SEPARATOR . 'steps.php'); $output->writeln('<info>+f</info> ' . str_replace($basePath, '', $stepsPath) . DIRECTORY_SEPARATOR . 'steps.php' . ' <comment>- place some step definitions in this file</comment>'); } if (!is_dir($supportPath)) { mkdir($supportPath, 0777, true); $output->writeln('<info>+d</info> ' . str_replace($basePath, '', $supportPath) . ' <comment>- place support scripts and static files here</comment>'); } if (!file_exists($bootPath)) { if (!is_dir(dirname($bootPath))) { mkdir(dirname($bootPath), 0777, true); } copy(__DIR__ . '/../../Skeleton/bootstrap.php', $bootPath); $output->writeln('<info>+f</info> ' . str_replace($basePath, '', $bootPath) . ' <comment>- place bootstrap scripts in this file</comment>'); } if (!file_exists($envPath)) { if (!is_dir(dirname($envPath))) { mkdir(dirname($envPath), 0777, true); } copy(__DIR__ . '/../../Skeleton/env.php', $envPath); $output->writeln('<info>+f</info> ' . str_replace($basePath, '', $envPath) . ' <comment>- place environment initialization scripts in this file</comment>'); } }