Passed
Push — master ( 894e98...cda682 )
by Aimeos
18:42 queued 10:10
created

FlyWebdavTest::setUp()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Aimeos\Base\Filesystem;
4
5
6
class FlyWebdavTest extends \PHPUnit\Framework\TestCase
7
{
8
	protected function setUp() : void
9
	{
10
		if( !interface_exists( '\\League\\Flysystem\\FilesystemInterface' ) ) {
11
			$this->markTestSkipped( 'Install Flysystem first' );
12
		}
13
	}
14
15
16
	public function testGetProvider()
17
	{
18
		if( !class_exists( '\League\Flysystem\WebDAV\WebDAVAdapter' ) ) {
19
			$this->markTestSkipped( 'Install Flysystem WebDAV adapter' );
20
		}
21
22
		try
23
		{
24
			$object = new FlyWebdav( array( 'baseUri' => 'http://test.webdav.org/dav/' ) );
25
			$this->assertInstanceof( \Aimeos\Base\Filesystem\Iface::class, $object );
26
27
			$object->has( 'test' );
28
		}
29
		catch( \Exception $e )
30
		{
31
			$this->markTestSkipped( $e->getMessage() );
32
		}
33
	}
34
35
36
	public function testGetProviderNoBaseuri()
37
	{
38
		if( !class_exists( '\League\Flysystem\WebDAV\WebDAVAdapter' ) ) {
39
			$this->markTestSkipped( 'Install Flysystem WebDAV adapter' );
40
		}
41
42
		$object = new FlyWebdav( [] );
43
		$this->assertInstanceof( \Aimeos\Base\Filesystem\Iface::class, $object );
44
45
		$this->expectException( \InvalidArgumentException::class );
46
		$object->has( 'test' );
47
	}
48
}
49