SFTP: add more unit tests

This commit is contained in:
terrafrost 2014-05-21 10:29:08 -05:00 committed by Andreas Fischer
parent 69e15b3855
commit 6e8e44b120

View File

@ -19,6 +19,7 @@ class Net_SFTPFunctionalTest extends PhpseclibFunctionalTestCase
'This test hangs on Travis CI on PHP 5.3.3 and below.'
);
}
parent::setUpBeforeClass();
self::$scratchDir = uniqid('phpseclib-sftp-scratch-');
@ -123,6 +124,22 @@ class Net_SFTPFunctionalTest extends PhpseclibFunctionalTestCase
return $sftp;
}
/**
* @depends testChDirScratch
*/
public function testStatOnDir($sftp)
{
$stat = $sftp->stat('.');
$this->assertThat(
$stat,
$this->logicalNot($this->equalTo(array())),
'Failed asserting that the cwd has a non-empty stat'
);
return $sftp;
}
/**
* @depends testChDirScratch
*/
@ -148,6 +165,19 @@ class Net_SFTPFunctionalTest extends PhpseclibFunctionalTestCase
return $sftp;
}
/**
* @depends testPutSizeGetFile
*/
public function testChDirOnFile($sftp)
{
$this->assertFalse(
$sftp->chdir('file1.txt'),
'Failed to assert that the cwd cannot be changed to a file'
);
return $sftp;
}
/**
* @depends testPutSizeGetFile
*/