Added some simple Net_SSH2 tests

Placed helper at top again in my test

Removed a whitespace
This commit is contained in:
Marc Philip Scholten 2013-12-28 21:27:02 +01:00
parent 268ec2e5d1
commit b7092ebc21
2 changed files with 71 additions and 2 deletions

View File

@ -2738,6 +2738,20 @@ class Net_SSH2
$this->quiet_mode = false;
}
/**
* Returns whether Quiet Mode is enabled or not
*
* @see Net_SSH2::enableQuietMode()
* @see Net_SSH2::disableQuietMode()
*
* @access public
* @return boolean
*/
function isQuietModeEnabled()
{
return $this->quiet_mode;
}
/**
* Enable request-pty when using exec()
*
@ -2758,6 +2772,20 @@ class Net_SSH2
$this->request_pty = false;
}
/**
* Returns whether request-pty is enabled or not
*
* @see Net_SSH2::enablePTY()
* @see Net_SSH2::disablePTY()
*
* @access public
* @return boolean
*/
function isPTYEnabled()
{
return $this->request_pty;
}
/**
* Gets channel data
*

View File

@ -18,7 +18,7 @@ class Net_SSH2Test extends PhpseclibTestCase
->setMethods(array('__destruct'))
->getMock();
}
public function formatLogDataProvider()
{
return array(
@ -46,7 +46,7 @@ class Net_SSH2Test extends PhpseclibTestCase
$result = $ssh->_format_log($message_log, $message_number_log);
$this->assertEquals($expected, $result);
}
public function generateIdentifierProvider()
{
return array(
@ -81,4 +81,45 @@ class Net_SSH2Test extends PhpseclibTestCase
$this->assertEquals($expected, $identifier);
}
public function testGetExitStatusIfNotConnected()
{
$ssh = $this->createSSHMock();
$this->assertFalse($ssh->getExitStatus());
}
public function testPTYIDefaultValue()
{
$ssh = $this->createSSHMock();
$this->assertFalse($ssh->isPTYEnabled());
}
public function testEnablePTY()
{
$ssh = $this->createSSHMock();
$ssh->enablePTY();
$this->assertTrue($ssh->isPTYEnabled());
$ssh->disablePTY();
$this->assertFalse($ssh->isPTYEnabled());
}
public function testQuietModeDefaultValue()
{
$ssh = $this->createSSHMock();
$this->assertFalse($ssh->isQuietModeEnabled());
}
public function testEnableQuietMode()
{
$ssh = $this->createSSHMock();
$ssh->enableQuietMode();
$this->assertTrue($ssh->isQuietModeEnabled());
$ssh->disableQuietMode();
$this->assertFalse($ssh->isQuietModeEnabled());
}
}