phpseclib/tests/Functional/Net/SFTPTestCase.php
terrafrost b4cf10fc94 Revert "Merge branch '2.0'"
This reverts commit be5f4ef6b19c82f6c898708cc8e1828b05e3d4e8, reversing
changes made to 638fe6971c.
2016-04-10 11:30:59 -05:00

45 lines
1.1 KiB
PHP

<?php
/**
* @author Andreas Fischer <bantu@phpbb.com>
* @copyright 2015 Andreas Fischer
* @license http://www.opensource.org/licenses/mit-license.html MIT License
*/
use phpseclib\Net\SFTP;
/**
* This class provides each test method with a new and empty $this->scratchDir.
*/
abstract class Functional_Net_SFTPTestCase extends PhpseclibFunctionalTestCase
{
/**
* @var SFTP
*/
protected $sftp;
protected $scratchDir;
public function setUp()
{
parent::setUp();
$this->scratchDir = uniqid('phpseclib-sftp-scratch-');
$this->sftp = new SFTP($this->getEnv('SSH_HOSTNAME'));
$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();
}
}