1
0
mirror of https://github.com/danog/phpseclib.git synced 2024-11-26 20:35:21 +01:00

Added test SFTPWrongServerTest

This commit is contained in:
Vladmir Gaydamaka 2019-09-17 13:09:51 +03:00 committed by terrafrost
parent 2fee8e22c1
commit 05bf34860d

View File

@ -0,0 +1,18 @@
<?php
use phpseclib\Net\SFTP;
use phpseclib\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());
}
}
}