$definition =
new InputDefinition([ new InputOption('with-required-value', 'r', InputOption::VALUE_REQUIRED
),
new InputOption('with-optional-value', 'o', InputOption::VALUE_OPTIONAL
),
new InputOption('without-value', 'n', InputOption::VALUE_NONE
),
new InputArgument('required-arg', InputArgument::REQUIRED
),
new InputArgument('optional-arg', InputArgument::OPTIONAL
),
]);
$input->
bind($definition);
$this->
assertEquals($expectedType,
$input->
getCompletionType(), 'Unexpected type'
);
$this->
assertEquals($expectedName,
$input->
getCompletionName(), 'Unexpected name'
);
$this->
assertEquals($expectedValue,
$input->
getCompletionValue(), 'Unexpected value'
);
} public static function provideBindData() { // option names
yield 'optname-minimal-input' =>
[CompletionInput::
fromTokens(['bin/console', '-'
], 1
), CompletionInput::TYPE_OPTION_NAME, null, '-'
];
yield 'optname-partial' =>
[CompletionInput::
fromTokens(['bin/console', '--with'
], 1
), CompletionInput::TYPE_OPTION_NAME, null, '--with'
];
// option values
yield 'optval-short' =>
[CompletionInput::
fromTokens(['bin/console', '-r'
], 1
), CompletionInput::TYPE_OPTION_VALUE, 'with-required-value', ''
];