mirror of
https://github.com/danog/tgseclib.git
synced 2024-12-14 18:16:26 +01:00
ba46db1758
Various fixes to fopen mode handling in SFTP Stream * bantu/SFTPStreamTest: Explicitly set size to 0 when creating or truncating. mode[0] of 'c' is not supposed to truncate. Need to create the file when it does not exist and mode[0] is not 'r'. Add SFTPStreamTest::testFopenFcloseCreatesFile() Conflicts: tests/Functional/Net/SFTPLargeFileTest.php
42 lines
1.1 KiB
PHP
42 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
|
|
{
|
|
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();
|
|
}
|
|
}
|