forked from thephpleague/flysystem
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFtpdTests.php
More file actions
66 lines (58 loc) · 1.88 KB
/
FtpdTests.php
File metadata and controls
66 lines (58 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
namespace League\Flysystem\Adapter;
use League\Flysystem\Config;
class FtpdTests extends \PHPUnit_Framework_TestCase
{
protected $options = [
'host' => 'example.org',
'port' => 40,
'ssl' => true,
'timeout' => 35,
'root' => '/somewhere',
'permPublic' => 0777,
'permPrivate' => 0000,
'passive' => false,
'username' => 'user',
'password' => 'password',
];
public function testInstantiable()
{
if (!defined('FTP_BINARY')) {
$this->markTestSkipped('The FTP_BINARY constant is not defined');
}
$adapter = new Ftpd($this->options);
$listing = $adapter->listContents('', true);
$this->assertInternalType('array', $listing);
$this->assertFalse($adapter->has('syno.not.found'));
$result = $adapter->getMimetype('something.txt');
$this->assertEquals('text/plain', $result['mimetype']);
$this->assertInternalType('array', $adapter->write('syno.unknowndir/file.txt', 'contents', new Config(['visibility' => 'public'])));
$this->assertInternalType('array', $adapter->getTimestamp('some/file.ext'));
}
/**
* @depends testInstantiable
*/
public function testRawlistFail()
{
$adapter = new Ftpd($this->options);
$result = $adapter->listContents('fail.rawlist');
$this->assertEquals([], $result);
}
/**
* @depends testInstantiable
*/
public function testGetMetadata()
{
$adapter = new Ftpd($this->options);
$result = $adapter->getMetadata('something.txt');
$this->assertNotEmpty($result);
}
/**
* @depends testInstantiable
*/
public function testSynologyFtpLegacyClassName()
{
$adapter = new SynologyFtp($this->options);
$this->assertInstanceOf('League\Flysystem\Adapter\Ftpd', $adapter);
}
}