From cf17b3f98019876a80b5c14462c4855918038ad1 Mon Sep 17 00:00:00 2001 From: ochorocho Date: Sun, 1 May 2022 21:25:51 +0200 Subject: [PATCH] [TASK] Use methods from abstract command. --- Classes/Command/AcceptanceTestsCommand.php | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/Classes/Command/AcceptanceTestsCommand.php b/Classes/Command/AcceptanceTestsCommand.php index 8b4f502..a74bf92 100644 --- a/Classes/Command/AcceptanceTestsCommand.php +++ b/Classes/Command/AcceptanceTestsCommand.php @@ -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; @@ -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(); @@ -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'} ?? []));