-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
223 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Selami\Console\Exception; | ||
|
||
class DependencyNotFoundException extends \InvalidArgumentException | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
tests/resources/Command/OrdinaryCommandWithArrayDependency.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
|
||
namespace SelamiConsoleTest\Command; | ||
|
||
use SelamiConsoleTest\Service\PrintService; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class OrdinaryCommandWithArrayDependency extends Command | ||
{ | ||
/** | ||
* @var PrintService | ||
*/ | ||
private $printService; | ||
private $config; | ||
|
||
public function __construct(PrintService $printService, array $args, string $name = null) | ||
{ | ||
$this->printService = $printService; | ||
$this->config = $config; | ||
parent::__construct($name); | ||
} | ||
|
||
protected function configure() : void | ||
{ | ||
$this | ||
->setName('command:ordinary-with-array-dependency') | ||
->setDescription('Show basic information about all mapped entities') | ||
->setDefinition([ | ||
new InputArgument('name', InputArgument::REQUIRED), | ||
]); | ||
} | ||
|
||
|
||
protected function execute(InputInterface $input, OutputInterface $output) : void | ||
{ | ||
$name = $input->getArgument('name'); | ||
$output->write($this->printService->formatMessage($name) . ' -'. $this->config['cache']); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
tests/resources/Command/OrdinaryCommandWithServiceDependency.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
|
||
namespace SelamiConsoleTest\Command; | ||
|
||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class OrdinaryCommandWithServiceDependency extends Command | ||
{ | ||
/** | ||
* @var NonExistingPrintService | ||
*/ | ||
private $printService; | ||
private $config; | ||
|
||
public function __construct(NonExistingPrintService $printService, string $name = null) | ||
{ | ||
$this->printService = $printService; | ||
$this->config = $config; | ||
parent::__construct($name); | ||
} | ||
|
||
protected function configure() : void | ||
{ | ||
$this | ||
->setName('command:ordinary-with-service-dependency') | ||
->setDescription('Show basic information about all mapped entities') | ||
->setDefinition([ | ||
new InputArgument('name', InputArgument::REQUIRED), | ||
]); | ||
} | ||
|
||
|
||
protected function execute(InputInterface $input, OutputInterface $output) : void | ||
{ | ||
$name = $input->getArgument('name'); | ||
$output->write($this->printService->formatMessage($name) . ' -'. $this->config['cache']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters