at the end of the day, it was inevitable

This commit is contained in:
Mo Elzubeir
2022-12-09 08:36:26 -06:00
commit 1218570914
1768 changed files with 887087 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
<?php
namespace Command\Util;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\HttpKernel\KernelInterface;
/**
* Class CommandTestFactory
* @package Command\Util
*/
class CommandTestFactory
{
/**
* @var Application
*/
private $application;
/**
* CommandRunner constructor.
*
* @param KernelInterface $kernel A KernelInterface instance.
*/
public function __construct(KernelInterface $kernel)
{
$this->application = new Application($kernel);
// If don't set to false, application will call 'exit' after command was
// executed.
$this->application->setAutoExit(false);
}
/**
* Create new command instance.
*
* @param string $command Command name.
* @param array $params Command parameters.
*
* @return CommandTest
*/
public function create($command, array $params = [])
{
return new CommandTest($this->application, $command, $params);
}
}