Skip to content
Extraits de code Groupes Projets
Valider 3733cb35 rédigé par diosmosis's avatar diosmosis
Parcourir les fichiers

Allow Environment to be specified via constructor to Console app for tests,...

Allow Environment to be specified via constructor to Console app for tests, and re-use Fixture environment in ConsoleCommandTestCase.
parent a957d769
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -26,12 +26,14 @@ class Console extends Application
*/
private $environment;
public function __construct()
public function __construct(Environment $environment = null)
{
$this->setServerArgsIfPhpCgi();
parent::__construct();
$this->environment = $environment;
$option = new InputOption('piwik-domain',
null,
InputOption::VALUE_OPTIONAL,
......@@ -169,8 +171,10 @@ class Console extends Application
protected function initEnvironment(OutputInterface $output)
{
try {
$this->environment = new Environment('cli');
$this->environment->init();
if ($this->environment === null) {
$this->environment = new Environment('cli');
$this->environment->init();
}
$config = Config::getInstance();
return $config;
......
......@@ -75,7 +75,7 @@ class ConsoleCommandTestCase extends SystemTestCase
{
parent::setUp();
$this->application = new TestConsole();
$this->application = new TestConsole(self::$fixture->piwikEnvironment);
$this->application->setAutoExit(false);
$this->applicationTester = new ApplicationTester($this->application);
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter