2015-06-24 22:15:19 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Andreas Fischer <bantu@phpbb.com>
|
|
|
|
* @copyright 2015 Andreas Fischer
|
|
|
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
|
|
|
*/
|
|
|
|
|
2015-07-03 23:18:19 +00:00
|
|
|
use phpseclib\Net\SFTP;
|
|
|
|
|
2015-06-24 22:15:19 +00:00
|
|
|
/**
|
|
|
|
* This class provides each test method with a new and empty $this->scratchDir.
|
|
|
|
*/
|
|
|
|
abstract class Functional_Net_SFTPTestCase extends PhpseclibFunctionalTestCase
|
|
|
|
{
|
2015-08-27 09:45:28 +00:00
|
|
|
/**
|
|
|
|
* @var SFTP
|
|
|
|
*/
|
2015-06-24 22:15:19 +00:00
|
|
|
protected $sftp;
|
|
|
|
protected $scratchDir;
|
|
|
|
|
|
|
|
public function setUp()
|
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
$this->scratchDir = uniqid('phpseclib-sftp-scratch-');
|
|
|
|
|
2015-07-03 23:18:19 +00:00
|
|
|
$this->sftp = new SFTP($this->getEnv('SSH_HOSTNAME'));
|
2015-06-24 22:15:19 +00:00
|
|
|
$this->assertTrue($this->sftp->login(
|
|
|
|
$this->getEnv('SSH_USERNAME'),
|
|
|
|
$this->getEnv('SSH_PASSWORD')
|
|
|
|
));
|
|
|
|
$this->assertTrue($this->sftp->mkdir($this->scratchDir));
|
|
|
|
$this->assertTrue($this->sftp->chdir($this->scratchDir));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function tearDown()
|
|
|
|
{
|
|
|
|
if ($this->sftp) {
|
|
|
|
$this->sftp->chdir($this->getEnv('SSH_HOME'));
|
|
|
|
$this->sftp->delete($this->scratchDir);
|
|
|
|
}
|
|
|
|
parent::tearDown();
|
|
|
|
}
|
|
|
|
}
|