/**
  * Write in Memory for test.
  *
  * @param string $text
  *
  * @return  $this
  */
 protected function setStream($text)
 {
     $this->memory = fopen('php://memory', 'r+', false);
     fputs($this->memory, $text);
     rewind($this->memory);
     $this->instance->getIO()->setInputStream($this->memory);
     return $this->memory;
 }
 /**
  * Constructor.
  *
  * @param   string      $question The question you want to ask.
  * @param   callable    $handler  The callback handler.
  * @param   mixed       $default  $default   The default value.
  * @param   IOInterface $io       The input object.
  *
  * @since   2.0
  */
 public function __construct($question = null, $handler = null, $default = null, IOInterface $io = null)
 {
     parent::__construct($question, $default, $io);
     if ($handler !== null) {
         $this->setHandler($handler);
     }
 }