Skip to content

Commit ddd4044

Browse files
authored
[7.x] align docblock to support multiple choice questions assertion (#32897)
This PR only aligns the docblock to give proper hint when testing console CHOICE with multiple options selected as an answer. In reality we would do something like this: **Only one chosen** works fine ``` Which toppings would you like? ['none']: 0 Cheese 1 Pineapple 2 Ham > 1 // This can be tested as: ->expectsChoice('Which toppings would you like?', 'Pineapple', ['Cheese', 'Pineapple', 'Ham']) ``` **Multiple chosen** not entirely right ``` Which toppings would you like? ['none']: 0 Cheese 1 Pineapple 2 Ham > 0,1,2 // This cannot be tested providing string as answer, since test will take it literally as one long answer: ->expectsChoice('Which toppings would you like?', 'Cheese,Pineapple,Ham') // Instead we have to pass an array: ->expectsChoice('Which toppings would you like?', ['Cheese', 'Pineapple', 'Ham']) ```
1 parent f8ad78b commit ddd4044

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Illuminate/Testing/PendingCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function expectsConfirmation($question, $answer = 'no')
103103
* Specify an expected choice question with expected answers that will be asked/shown when the command runs.
104104
*
105105
* @param string $question
106-
* @param string $answer
106+
* @param string|array $answer
107107
* @param array $answers
108108
* @param bool $strict
109109
* @return $this

0 commit comments

Comments
 (0)