Beispiel #1
0
 public function testCanSelectOptionWithCustomIndex()
 {
     fwrite($this->adapter->stream, "2");
     $select = new Select('Select an option :', array('2' => 'foo', '6' => 'bar'));
     $select->setConsole($this->adapter);
     ob_start();
     $response = $select->show();
     $text = ob_get_clean();
     $this->assertTrue((bool) preg_match('#2\\) foo#', $text));
     $this->assertTrue((bool) preg_match('#6\\) bar#', $text));
     $this->assertEquals('2', $response);
 }
Beispiel #2
0
 public function select($promptText, array $options, $allowEmpty = false)
 {
     $prompt = new SelectPrompt($promptText, $options, $allowEmpty);
     $prompt->setConsole($this->console);
     return $prompt->show();
 }