/** * Reads the given amount of characters from the standard input. * * @param int $length The number of characters to read. * @param string $default The default to return if interaction is disabled. * * @return string The characters read from the input. * * @throws IOException If reading fails or if the standard input is closed. */ public function read($length, $default = null) { return $this->input->read($length, $default); }
public function testReadReturnsDefaultIfNotInteractive() { $this->stream->set('Lorem ipsum'); $this->input->setInteractive(false); $this->assertSame('Default', $this->input->read(20, 'Default')); }