mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-16 07:11:19 +08:00
Fixes #17133: Fixed aliases rendering during help generation for a console command
This commit is contained in:

committed by
Alexander Makarov

parent
687f15fbd2
commit
5b5150ae62
@ -4,6 +4,7 @@ Yii Framework 2 Change Log
|
||||
2.0.17 under development
|
||||
------------------------
|
||||
|
||||
- Bug #17133: Fixed aliases rendering during help generation for a console command (GHopperMSK)
|
||||
- Bug #17185: Fixed `AssetManager` timestamp appending when a file is published manually (GHopperMSK)
|
||||
- Bug #17156: Fixes PHP 7.2 warning when a data provider has no data as a parameter for a GridView (evilito)
|
||||
- Bug #17083: Fixed `yii\validators\EmailValidator::$checkDNS` tells that every domain is correct on alpine linux (mikk150)
|
||||
|
@ -532,7 +532,7 @@ class HelpController extends Controller
|
||||
protected function formatOptionAliases($controller, $option)
|
||||
{
|
||||
foreach ($controller->optionAliases() as $name => $value) {
|
||||
if ($value === $option) {
|
||||
if (Inflector::camel2id($value, '-', true) === $option) {
|
||||
return ', -' . $name;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
21
tests/framework/console/FakeHelpControllerWithoutOutput.php
Normal file
21
tests/framework/console/FakeHelpControllerWithoutOutput.php
Normal 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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user