コード例 #1
0
ファイル: ShellTest.php プロジェクト: bravo3/ssh
 /**
  * Get an authenticated connection ready for transaction testing
  *
  * @param bool $doAuth
  * @throws \Exception
  * @return Shell
  */
 protected function getShell()
 {
     $connection = new Connection(\properties::$host, \properties::$port, new PasswordCredential(\properties::$user, \properties::$pass));
     if (!$connection->connect()) {
         throw new \Exception("Error connecting to test server");
     }
     if (!$connection->authenticate()) {
         throw new \Exception("Error authenticating on test server");
     }
     return $connection->getShell();
 }