Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
Improved authentication type tests in SSHConnectionAdapterTest
Browse files Browse the repository at this point in the history
  • Loading branch information
niels-nijens committed Oct 18, 2015
1 parent 622c0ca commit f936404
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions tests/Deployment/Connection/SSHConnectionAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,36 @@ public function testConstructWithUnknownAuthenticationTypeThrowsUnexpectedValueE
new SSHConnectionAdapter('localhost', 'unknown');
}

/**
* Tests if constructing a new SSHConnectionAdapter instance with username and password succeeds
*/
public function testConstructWithPasswordAuthenticationType()
{
$this->connectionAdapter = new SSHConnectionAdapter('localhost', SSHConnectionAdapter::AUTHENTICATION_PASSWORD, $this->getSSHUsername(), getenv('ssh.password'));
}

/**
* Tests if SSHConnectionAdapter::connect returns true with password authentication type.
*/
public function testConnectWithAuthenticationTypePasswordReturnsTrue()
{
$connectionAdapter = new SSHConnectionAdapter('localhost', SSHConnectionAdapter::AUTHENTICATION_PASSWORD, $this->getSSHUsername(), getenv('ssh.password'));
$this->connectionAdapter = new SSHConnectionAdapter('localhost', SSHConnectionAdapter::AUTHENTICATION_PASSWORD, $this->getSSHUsername(), getenv('ssh.password'));

$this->assertTrue($connectionAdapter->connect());
if (get_current_user() === 'travis') {
$this->markTestSkipped('This test is not properly set up to be tested with Travis CI.');
}

$connectionAdapter->disconnect();
$this->assertTrue($this->connectionAdapter->connect());
}

/**
* Tests if SSHConnectionAdapter::connect returns true with SSH agent authentication type.
*/
public function testConnectWithAuthenticationTypeSSHAgentReturnsTrue()
{
$connectionAdapter = new SSHConnectionAdapter('localhost', SSHConnectionAdapter::AUTHENTICATION_SSH_AGENT, $this->getSSHUsername());

$this->assertTrue($connectionAdapter->connect());
$this->connectionAdapter = new SSHConnectionAdapter('localhost', SSHConnectionAdapter::AUTHENTICATION_SSH_AGENT, $this->getSSHUsername());

$connectionAdapter->disconnect();
$this->assertTrue($this->connectionAdapter->connect());
}

/**
Expand Down

0 comments on commit f936404

Please sign in to comment.