LoginTest.php (1035B)
1 <?php 2 3 4 namespace Ssh\FunctionalTests; 5 6 7 use Ssh\Authentication\Password; 8 use Ssh\Configuration; 9 use Ssh\Session; 10 11 /** 12 * @author Julius Beckmann 13 * 14 * @group functional 15 * 16 * @covers \Ssh\Session 17 * @covers \Ssh\Authentication\Password 18 */ 19 class LoginTest extends \PHPUnit_Framework_TestCase 20 { 21 22 public function testLoginPassword() 23 { 24 $configuration = new Configuration('localhost'); 25 $session = new Session($configuration); 26 27 $authentication = new Password(TEST_USER, TEST_PASSWORD); 28 $login = $authentication->authenticate($session->getResource()); 29 $this->assertTrue($login, 'Authentification failed.'); 30 } 31 32 public function testLoginPasswordFailed() 33 { 34 $configuration = new Configuration('localhost'); 35 $session = new Session($configuration); 36 37 $authentication = new Password(TEST_USER, 'invalid'); 38 $login = $authentication->authenticate($session->getResource()); 39 $this->assertFalse($login, 'Authentification should have failed.'); 40 } 41 } 42