@@ -95,52 +95,52 @@ public function testAskChoiceNonInteractive()
95
95
96
96
$ helperSet = new HelperSet (array (new FormatterHelper ()));
97
97
$ questionHelper ->setHelperSet ($ helperSet );
98
- $ questionHelper -> setInputStream ( $ this ->getInputStream ("\n1 \n 1 \nFabien \n1 \nFabien \n1 \n0,2 \n 0 , 2 \n\n\n" ) );
98
+ $ inputStream = $ this ->getInputStream ("\n1 \n 1 \nFabien \n1 \nFabien \n1 \n0,2 \n 0 , 2 \n\n\n" );
99
99
100
100
$ heroes = array ('Superman ' , 'Batman ' , 'Spiderman ' );
101
101
102
102
$ question = new ChoiceQuestion ('What is your favorite superhero? ' , $ heroes , '0 ' );
103
103
104
- $ this ->assertSame ('Superman ' , $ questionHelper ->ask ($ this ->createInputInterfaceMock ( false ), $ this ->createOutputInterface (), $ question ));
104
+ $ this ->assertSame ('Superman ' , $ questionHelper ->ask ($ this ->createStreamableInputInterfaceMock ( $ inputStream , false ), $ this ->createOutputInterface (), $ question ));
105
105
106
106
$ question = new ChoiceQuestion ('What is your favorite superhero? ' , $ heroes , 'Batman ' );
107
- $ this ->assertSame ('Batman ' , $ questionHelper ->ask ($ this ->createInputInterfaceMock ( false ), $ this ->createOutputInterface (), $ question ));
107
+ $ this ->assertSame ('Batman ' , $ questionHelper ->ask ($ this ->createStreamableInputInterfaceMock ( $ inputStream , false ), $ this ->createOutputInterface (), $ question ));
108
108
109
109
$ question = new ChoiceQuestion ('What is your favorite superhero? ' , $ heroes , null );
110
- $ this ->assertNull ($ questionHelper ->ask ($ this ->createInputInterfaceMock ( false ), $ this ->createOutputInterface (), $ question ));
110
+ $ this ->assertNull ($ questionHelper ->ask ($ this ->createStreamableInputInterfaceMock ( $ inputStream , false ), $ this ->createOutputInterface (), $ question ));
111
111
112
112
$ question = new ChoiceQuestion ('What is your favorite superhero? ' , $ heroes , '0 ' );
113
113
$ question ->setValidator (null );
114
- $ this ->assertSame ('Superman ' , $ questionHelper ->ask ($ this ->createInputInterfaceMock ( false ), $ this ->createOutputInterface (), $ question ));
114
+ $ this ->assertSame ('Superman ' , $ questionHelper ->ask ($ this ->createStreamableInputInterfaceMock ( $ inputStream , false ), $ this ->createOutputInterface (), $ question ));
115
115
116
116
try {
117
117
$ question = new ChoiceQuestion ('What is your favorite superhero? ' , $ heroes , null );
118
- $ questionHelper ->ask ($ this ->createInputInterfaceMock ( false ), $ this ->createOutputInterface (), $ question );
118
+ $ questionHelper ->ask ($ this ->createStreamableInputInterfaceMock ( $ inputStream , false ), $ this ->createOutputInterface (), $ question );
119
119
} catch (\InvalidArgumentException $ e ) {
120
120
$ this ->assertSame ('Value "" is invalid ' , $ e ->getMessage ());
121
121
}
122
122
123
123
$ question = new ChoiceQuestion ('Who are your favorite superheros? ' , $ heroes , '0, 1 ' );
124
124
$ question ->setMultiselect (true );
125
- $ this ->assertSame (array ('Superman ' , 'Batman ' ), $ questionHelper ->ask ($ this ->createInputInterfaceMock ( false ), $ this ->createOutputInterface (), $ question ));
125
+ $ this ->assertSame (array ('Superman ' , 'Batman ' ), $ questionHelper ->ask ($ this ->createStreamableInputInterfaceMock ( $ inputStream , false ), $ this ->createOutputInterface (), $ question ));
126
126
127
127
$ question = new ChoiceQuestion ('Who are your favorite superheros? ' , $ heroes , '0, 1 ' );
128
128
$ question ->setMultiselect (true );
129
129
$ question ->setValidator (null );
130
- $ this ->assertSame (array ('Superman ' , 'Batman ' ), $ questionHelper ->ask ($ this ->createInputInterfaceMock ( false ), $ this ->createOutputInterface (), $ question ));
130
+ $ this ->assertSame (array ('Superman ' , 'Batman ' ), $ questionHelper ->ask ($ this ->createStreamableInputInterfaceMock ( $ inputStream , false ), $ this ->createOutputInterface (), $ question ));
131
131
132
132
$ question = new ChoiceQuestion ('Who are your favorite superheros? ' , $ heroes , '0, Batman ' );
133
133
$ question ->setMultiselect (true );
134
- $ this ->assertSame (array ('Superman ' , 'Batman ' ), $ questionHelper ->ask ($ this ->createInputInterfaceMock ( false ), $ this ->createOutputInterface (), $ question ));
134
+ $ this ->assertSame (array ('Superman ' , 'Batman ' ), $ questionHelper ->ask ($ this ->createStreamableInputInterfaceMock ( $ inputStream , false ), $ this ->createOutputInterface (), $ question ));
135
135
136
136
$ question = new ChoiceQuestion ('Who are your favorite superheros? ' , $ heroes , null );
137
137
$ question ->setMultiselect (true );
138
- $ this ->assertNull ($ questionHelper ->ask ($ this ->createInputInterfaceMock ( false ), $ this ->createOutputInterface (), $ question ));
138
+ $ this ->assertNull ($ questionHelper ->ask ($ this ->createStreamableInputInterfaceMock ( $ inputStream , false ), $ this ->createOutputInterface (), $ question ));
139
139
140
140
try {
141
141
$ question = new ChoiceQuestion ('Who are your favorite superheros? ' , $ heroes , '' );
142
142
$ question ->setMultiselect (true );
143
- $ questionHelper ->ask ($ this ->createInputInterfaceMock ( false ), $ this ->createOutputInterface (), $ question );
143
+ $ questionHelper ->ask ($ this ->createStreamableInputInterfaceMock ( $ inputStream , false ), $ this ->createOutputInterface (), $ question );
144
144
} catch (\InvalidArgumentException $ e ) {
145
145
$ this ->assertSame ('Value "" is invalid ' , $ e ->getMessage ());
146
146
}
0 commit comments