Skip to content

Commit

Permalink
[TASK] Use methods from abstract command.
Browse files Browse the repository at this point in the history
  • Loading branch information
ochorocho committed May 26, 2022
1 parent 7c17a14 commit cf17b3f
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions Classes/Command/AcceptanceTestsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

namespace B13\Make\Command;

use B13\Make\PackageResolver;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
Expand Down Expand Up @@ -50,21 +49,14 @@ protected function configure(): void
$this->filesystem = GeneralUtility::makeInstance(Filesystem::class);
}

/**
* @throws \JsonException
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->io = new SymfonyStyle($input, $output);
$this->package = $this->askForPackage($this->io);

$packages = $this->getPackageResolver()->getPackageManager()->getActivePackages();
$choices = array_reduce($packages, function ($result, PackageInterface $package) {
if ($package->getPackageMetaData()->getPackageType() === 'typo3-cms-extension') {
$packageKey = $package->getPackageKey();
$result[$packageKey] = $packageKey;
}
return $result;
}, []);

$selectedPackageName = $this->io->choice('Select a package to create acceptance tests for', $choices);
$this->package = $this->getPackageResolver()->resolvePackage($selectedPackageName);
$packageKey = $this->package->getPackageKey();
$targetPackagePath = $this->package->getPackagePath();

Expand Down Expand Up @@ -194,11 +186,6 @@ protected function substituteMarkersAndSave(string $content, string $target): vo
}
}

protected function getPackageResolver(): PackageResolver
{
return GeneralUtility::makeInstance(PackageResolver::class);
}

protected function getNamespace(): string
{
return (string)key((array)($this->package->getValueFromComposerManifest('autoload')->{'psr-4'} ?? []));
Expand Down

0 comments on commit cf17b3f

Please sign in to comment.