/** * Generate composer file. * * @param \JonathanTorres\Construct\Helpers\Git $git The git helper. * * @return void */ protected function composer(Git $git) { $file = $this->file->get(__DIR__ . '/stubs/composer.txt'); $user = $git->getUser(); $stubs = ['{project_upper}', '{project_lower}', '{vendor_lower}', '{vendor_upper}', '{testing}', '{testing_version}', '{namespace}', '{license}', '{author_name}', '{author_email}', '{keywords}']; $values = [$this->projectUpper, $this->projectLower, $this->vendorLower, $this->vendorUpper, $this->settings->getTestingFramework(), $this->testingVersion, $this->createNamespace(true), $this->settings->getLicense(), $user['name'], $user['email'], $this->str->toQuotedKeywords($this->settings->getComposerKeywords())]; $content = str_replace($stubs, $values, $file); $this->file->put($this->projectLower . '/' . 'composer.json', $content); }
/** * Show warning if a test framework that is not supported is specified. * * @param \Symfony\Component\Console\Output\OutputInterface $output * * @return string */ private function testFrameworkWarning($output) { $testFramework = $this->settings->getTestingFramework(); if (!in_array($testFramework, $this->defaults->testingFrameworks)) { $warning = '<error>Warning: "' . $testFramework . '" is not a supported testing framework. ' . 'Using ' . Defaults::TEST_FRAMEWORK . '.</error>'; $output->writeln($warning); $testFramework = Defaults::TEST_FRAMEWORK; } return $testFramework; }
/** * Run any extra scripts. * * @param JonathanTorres\Construct\Helpers\Script $script * * @return void */ protected function scripts(Script $script) { $testingFramework = $this->settings->getTestingFramework(); if ($this->file->isDirectory($this->projectLower)) { if ($testingFramework === 'behat') { $script->initBehat($this->projectLower); } if ($testingFramework === 'codeception') { $script->bootstrapCodeception($this->projectLower); } } }