/** * Tests the connection procedure including checking fingerprint - requires working SSH server * * @group server * @medium */ public function testConnection() { $logger = new Logger(); $connection = new Connection(\properties::$host, \properties::$port); $connection->setLogger($logger); $this->assertTrue($connection->connect()); $fp = $connection->getFingerprint(); $this->assertEquals(32, strlen($fp)); // 32 byte MD5 HEX encoded fingerprint $this->assertTrue($connection->checkFingerprint($fp)); $this->assertFalse($connection->checkFingerprint(self::BAD_FINGERPRINT)); $this->assertNotEmpty($connection->getResource()); $this->assertFalse($connection->isAuthenticated()); $connection->disconnect(); $this->assertContains('Disconnected', $logger->getHistory()); }