Fixes #17133: Fixed aliases rendering during help generation for a console command

This commit is contained in:
Nikolay Poryadin
2019-03-09 15:35:19 +03:00
committed by Alexander Makarov
parent 687f15fbd2
commit 5b5150ae62
4 changed files with 28 additions and 1 deletions

View File

@@ -23,6 +23,7 @@ class ControllerTest extends TestCase
$this->mockApplication();
Yii::$app->controllerMap = [
'fake' => 'yiiunit\framework\console\FakeController',
'fake_witout_output' => 'yiiunit\framework\console\FakeHelpControllerWithoutOutput',
'help' => 'yiiunit\framework\console\FakeHelpController',
];
}
@@ -127,6 +128,10 @@ class ControllerTest extends TestCase
$this->assertFalse(FakeController::getWasActionIndexCalled());
$this->assertEquals(FakeHelpController::getActionIndexLastCallParams(), ['posts/index']);
$helpController = new FakeHelpControllerWithoutOutput('help', Yii::$app);
$helpController->actionIndex('fake/aksi1');
$this->assertContains('--test-array, -ta', $helpController->outputString);
}
/**

View File

@@ -0,0 +1,21 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yiiunit\framework\console;
use yii\console\controllers\HelpController;
use yii\helpers\Console;
class FakeHelpControllerWithoutOutput extends HelpController
{
public $outputString = '';
public function stdout($string)
{
return $this->outputString .= $string;
}
}