Split out and improve tests

This commit is contained in:
Robin Appelman 2014-08-24 02:16:33 +02:00
commit 65b76d6428
3 changed files with 74 additions and 95 deletions

View file

@ -35,7 +35,8 @@ class RawConnection {
setlocale(LC_ALL, Server::LOCALE);
$env = array_merge($env, array(
'CLI_FORCE_INTERACTIVE' => 'y', // Needed or the prompt isn't displayed!!
'LC_ALL' => Server::LOCALE
'LC_ALL' => Server::LOCALE,
'LANG' => Server::LOCALE
));
$this->process = proc_open($command, $descriptorSpec, $this->pipes, '/', $env);
if (!$this->isValid()) {
@ -72,8 +73,8 @@ class RawConnection {
*
* @return string
*/
public function read() {
return trim(fgets($this->getOutputStream()));
public function readLine() {
return stream_get_line($this->getOutputStream(), 4086, "\n");
}
/**
@ -83,7 +84,7 @@ class RawConnection {
*/
public function readAll() {
$output = array();
while ($line = $this->read()) {
while ($line = $this->readLine()) {
$output[] = $line;
}
return $output;