public function testInWithOptions() { $command = new MockCommand(array('request' => $this->request)); fwrite($command->request->input, 'y'); rewind($command->request->input); $expected = "y"; $result = $command->in('Everything Cool?', array('choices' => array('y', 'n'))); $this->assertEqual($expected, $result); $expected = "Everything Cool? (y/n) \n > "; $result = $command->response->output; $this->assertEqual($expected, $result); }
public function testColumnsOnErrorOutput() { $command = new MockCommand(array('request' => $this->request)); $expected = "data1\t\ndata2\t\n"; $command->columns(array('col1' => 'data1', 'col2' => 'data2'), array('error' => true)); $result = $command->response->error; $this->assertEqual($expected, $result); }
public function testInWithBadInput() { $command = new MockCommand(array('request' => $this->request)); fwrite($command->request->input, "f\n"); fwrite($command->request->input, 'y'); rewind($command->request->input); $expected = "y"; $result = $command->in('Everything Cool?', array('choices' => array('y', 'n'))); $this->assertEqual($expected, $result); }