mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
Fixes #10372: Fixed console controller including DI arguments in help
This commit is contained in:

committed by
Alexander Makarov

parent
dcda2a2466
commit
18fc8db32f
@ -43,6 +43,7 @@ Yii Framework 2 Change Log
|
||||
- Bug #10142: Fixed `yii\validators\EmailValidator` to check the length of email properly (silverfire)
|
||||
- Bug #10278: Fixed `yii\helpers\BaseJson` support \SimpleXMLElement data (SilverFire, LAV45)
|
||||
- Bug #10302: Fixed JS function `yii.getQueryParams`, which parsed array variables incorrectly (servocoder, silverfire)
|
||||
- Bug #10372: Fixed console controller including DI arguments in help (sammousa)
|
||||
- Bug #10385: Fixed `yii\validators\CaptchaValidator` passed incorrect hashKey to JS validator when `captchaAction` begins with `/` (silverfire)
|
||||
- Bug: Fixed generation of canonical URLs for `ViewAction` pages (samdark)
|
||||
- Bug: Fixed `mb_*` functions calls to use `UTF-8` or `Yii::$app->charset` (silverfire)
|
||||
|
@ -414,8 +414,13 @@ class Controller extends \yii\base\Controller
|
||||
$params = isset($tags['param']) ? (array) $tags['param'] : [];
|
||||
|
||||
$args = [];
|
||||
|
||||
/** @var \ReflectionParameter $reflection */
|
||||
foreach ($method->getParameters() as $i => $reflection) {
|
||||
$name = $reflection->getName();
|
||||
if ($reflection->getClass() !== null) {
|
||||
continue;
|
||||
}
|
||||
$tag = isset($params[$i]) ? $params[$i] : '';
|
||||
if (preg_match('/^(\S+)\s+(\$\w+\s+)?(.*)/s', $tag, $matches)) {
|
||||
$type = $matches[1];
|
||||
|
@ -92,4 +92,27 @@ class ControllerTest extends TestCase
|
||||
$result = $controller->runAction('aksi7', $params);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if action help does not include class-hinted arguments
|
||||
* @see https://github.com/yiisoft/yii2/issues/10372
|
||||
*/
|
||||
public function testHelp()
|
||||
{
|
||||
$this->mockApplication([
|
||||
'components' => [
|
||||
'barBelongApp' => [
|
||||
'class' => Bar::className(),
|
||||
'foo' => 'belong_app'
|
||||
],
|
||||
'quxApp' => [
|
||||
'class' => OtherQux::className(),
|
||||
'b' => 'belong_app'
|
||||
]
|
||||
]
|
||||
]);
|
||||
$controller = new FakeController('fake', Yii::$app);
|
||||
|
||||
$this->assertArrayNotHasKey('bar', $controller->getActionArgsHelp($controller->createAction('aksi1')));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user