/** * Test that ftp.kernel.org allows anonymous login's */ public function test_ftp_authenticate_returns_true() { $anonymous_ftp_adapter = new Adapter\Ftp('ftp.kernel.org', 'anonymous', 'anonymous', ''); $ret = $anonymous_ftp_adapter->authenticate(); $this->assertTrue($ret); if ($ret === true) { $this->assertTrue($anonymous_ftp_adapter->setPassiveMode(true)); $this->assertTrue($anonymous_ftp_adapter->setActiveMode()); } }
/** * Assert that writing to a local ftp server will fail if the user is not authenticated. */ public function test_ftp_local_connection_file_write_fails() { if (($user = getenv('FTP_USER')) && ($pass = getenv('FTP_PASSWORD')) && ($host = getenv('FTP_HOST'))) { $ftp = new Adapter\Ftp('', '', '', 'httpdocs/scan_new.yml'); $report = new Scan\Report\Report(); $items = array('a' => 'b'); $report->setItems($items); $result = $ftp->write($report); $this->assertFalse($result); unset($ftp); } }