1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Aimeos\Base\Filesystem; |
4
|
|
|
|
5
|
|
|
|
6
|
|
|
class FlySftpTest extends \PHPUnit\Framework\TestCase |
7
|
|
|
{ |
8
|
|
|
protected function setUp() : void |
9
|
|
|
{ |
10
|
|
|
if( !class_exists( '\\League\\Flysystem\\Filesystem' ) ) { |
11
|
|
|
$this->markTestSkipped( 'Install Flysystem first' ); |
12
|
|
|
} |
13
|
|
|
|
14
|
|
|
if( !class_exists( 'League\Flysystem\PhpseclibV2\SftpAdapter' ) ) { |
15
|
|
|
$this->markTestSkipped( 'Install Flysystem SFTP adapter' ); |
16
|
|
|
} |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
|
20
|
|
|
public function testGetProvider() |
21
|
|
|
{ |
22
|
|
|
$object = new FlySftp( ['host' => 'test.rebex.net', 'username' => 'demo', 'password' => 'password', 'root' => ''] ); |
23
|
|
|
$this->assertInstanceof( \Aimeos\Base\Filesystem\Iface::class, $object ); |
24
|
|
|
|
25
|
|
|
$object->has( 'test' ); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
|
29
|
|
|
public function testGetProviderNoHost() |
30
|
|
|
{ |
31
|
|
|
$object = new FlySftp( [] ); |
32
|
|
|
$this->assertInstanceof( \Aimeos\Base\Filesystem\Iface::class, $object ); |
33
|
|
|
|
34
|
|
|
$this->expectException( \Aimeos\Base\Filesystem\Exception::class ); |
35
|
|
|
$object->has( 'test' ); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
|
39
|
|
|
public function testGetProviderNoUser() |
40
|
|
|
{ |
41
|
|
|
$object = new FlySftp( ['host' => 'test.rebex.net'] ); |
42
|
|
|
$this->assertInstanceof( \Aimeos\Base\Filesystem\Iface::class, $object ); |
43
|
|
|
|
44
|
|
|
$this->expectException( \Aimeos\Base\Filesystem\Exception::class ); |
45
|
|
|
$object->has( 'test' ); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
|
49
|
|
|
public function testGetProviderNoRoot() |
50
|
|
|
{ |
51
|
|
|
$object = new FlySftp( ['host' => 'test.rebex.net', 'username' => 'demo', 'password' => 'password'] ); |
52
|
|
|
$this->assertInstanceof( \Aimeos\Base\Filesystem\Iface::class, $object ); |
53
|
|
|
|
54
|
|
|
$this->expectException( \Aimeos\Base\Filesystem\Exception::class ); |
55
|
|
|
$object->has( 'test' ); |
56
|
|
|
} |
57
|
|
|
} |
58
|
|
|
|