Skip to content

Commit

Permalink
[TASK] Use newly introduced extension selection and cleanup old code
Browse files Browse the repository at this point in the history
  • Loading branch information
ochorocho committed Jul 14, 2022
1 parent 48a344b commit 3b651e4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
11 changes: 2 additions & 9 deletions Classes/Command/AcceptanceTestsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Filesystem\Exception\IOException;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
Expand All @@ -32,11 +31,6 @@ class AcceptanceTestsCommand extends AbstractCommand
*/
protected $filesystem;

/**
* @var SymfonyStyle $io
*/
protected $io;

/**
* @var PackageInterface $package
*/
Expand All @@ -54,8 +48,7 @@ protected function configure(): void
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->io = new SymfonyStyle($input, $output);
$this->package = $this->askForPackage($this->io);
$this->package = $this->packageResolver->resolvePackage($this->askForExtensionKey());

$packageKey = $this->package->getPackageKey();
$targetPackagePath = $this->package->getPackagePath();
Expand All @@ -70,7 +63,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$finder = GeneralUtility::makeInstance(Finder::class);

$codeTemplatePath = '/Resources/Private/CodeTemplates/AcceptanceTests';
$templatePath = $this->getPackageResolver()->resolvePackage('b13/make')->getPackagePath() . $codeTemplatePath;
$templatePath = $this->packageResolver->resolvePackage('b13/make')->getPackagePath() . $codeTemplatePath;

$this->filesystem->mkdir([
$targetPackagePath . '/Tests/Acceptance/Fixtures',
Expand Down
8 changes: 8 additions & 0 deletions Classes/Command/RunTestsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
);
}

$this->io->writeln('<info>Created docker environment for testing:</info>');
$filePaths = array_map(function ($ar) {return $ar['target'];}, $templatesToCreate);
$this->io->listing($filePaths);
$this->io->writeln('For details run "cd ' . $this->package->getPackagePath() . ' && ' . 'Build/Scripts/runTests.sh -h"');

return 0;
}

Expand All @@ -94,6 +99,9 @@ protected function prepareTemplate(string $source, string $target): void

try {
$this->filesystem->dumpFile($target, $templateContent);
if ((pathinfo($target)['extension'] ?? '') === 'sh') {
$this->filesystem->chmod([$target], 0770);
}
} catch (IOException $exception) {
$this->io->writeln('<error>Failed to save file in ' . $target . PHP_EOL . $exception->getMessage() . '</error>');
}
Expand Down

0 comments on commit 3b651e4

Please sign in to comment.