/** * 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 work if the credentials are correct. */ public function test_ftp_local_connection_file_write() { if (($user = getenv('FTP_USER')) && ($pass = getenv('FTP_PASSWORD')) && ($host = getenv('FTP_HOST'))) { $ftp = new Adapter\Ftp($host, $user, $pass, 'httpdocs/scan_new.yml'); $ret = $ftp->authenticate(); $this->assertTrue($ret); if ($ret === true) { $report = new Scan\Report\Report(); $items = array('a' => 'b'); $report->setItems($items); $didWrite = $ftp->write($report); $this->assertTrue($didWrite); } unset($ftp); } }