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

FlyAwsS3Test   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetProvider() 0 11 2
A testGetProviderNoBucket() 0 7 1
A setUp() 0 4 2
1
<?php
2
3
namespace Aimeos\Base\Filesystem;
4
5
6
class FlyAwsS3Test 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\AwsS3v3\AwsS3Adapter' ) ) {
19
			$this->markTestSkipped( 'Install Flysystem AwsS3v3 adapter' );
20
		}
21
22
		$object = new FlyAwsS3( array( 'bucket' => 'test' ) );
23
		$this->assertInstanceof( \Aimeos\Base\Filesystem\Iface::class, $object );
24
25
		$this->expectException( 'InvalidArgumentException' );
26
		$object->has( 'test' );
27
	}
28
29
30
	public function testGetProviderNoBucket()
31
	{
32
		$object = new FlyAwsS3( [] );
33
		$this->assertInstanceof( \Aimeos\Base\Filesystem\Iface::class, $object );
34
35
		$this->expectException( \Aimeos\Base\Filesystem\Exception::class );
36
		$object->has( 'test' );
37
	}
38
}
39