1
0
mirror of https://github.com/danog/tgseclib.git synced 2024-12-04 02:27:52 +01:00
tgseclib/tests/Functional/Net/SFTPWrongServerTest.php
2019-12-18 14:00:20 +01:00

19 lines
619 B
PHP

<?php
use tgseclib\Net\SFTP;
use tgseclib\Exception\UnableToConnectException;
use PHPUnit\Framework\TestCase;
class SFTPWrongServerTest extends TestCase
{
public function testLoginToInvalidServer()
{
try {
(new SFTP('dummy-server'))->login('username', 'password');
static::fail('The connection to the non-existent server must not succeed.');
} catch (UnableToConnectException $e) {
static::assertSame('Cannot connect to dummy-server:22. Error 0. php_network_getaddresses: getaddrinfo failed: Name or service not known', $e->getMessage());
}
}
}