public function getString($remote)
{
if (!$this->node) {
throw new \RuntimeException("Node is not defined to get a file.");
}
$this->runtimeTask->getOutput()->writeln($this->getRemoteInfoPrefix() . "<info>Get: </info>{$remote}");
$sftp = $this->getSFTP();
$ret = $sftp->get($remote);
if ($ret === false) {
throw new \RuntimeException("Couldn't get: {$remote}");
}
return $ret;
}
public function testGetString2() { $srcPath = "/NotExistsFile/gettest.txt"; $this->runtimeTask->getOutput()->setVerbosity(3); $node = new Node(); $node->setName("127.0.0.1"); $process = new Process($this->runtimeTask, $node); try { $process->getString($srcPath); $this->assertEquals(false, true); } catch (\RuntimeException $e) { $this->assertEquals(true, true); } }