Passed
Push — master ( 7dfc38...3cd1a1 )
by Aimeos
13:27 queued 06:48
created

FlySftpTest::testGetProviderNoUser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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