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

FlyGridfsTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 38
rs 10
c 0
b 0
f 0
wmc 6

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 2
A testGetProviderToken() 0 18 3
A testGetProvider() 0 7 1
1
<?php
2
3
namespace Aimeos\Base\Filesystem;
4
5
6
class FlyGridfsTest 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
		$object = new FlyGridfs( [] );
19
		$this->assertInstanceof( \Aimeos\Base\Filesystem\Iface::class, $object );
20
21
		$this->expectException( 'Aimeos\Base\Filesystem\Exception' );
22
		$object->has( 'test' );
23
	}
24
25
26
	public function testGetProviderToken()
27
	{
28
		if( !class_exists( '\League\Flysystem\GridFS\GridFSAdapter' ) ) {
29
			$this->markTestSkipped( 'Install Flysystem GridFS adapter' );
30
		}
31
32
		if( !class_exists( '\MongoClient' ) ) {
33
			$this->markTestSkipped( 'Install Mongo client extension' );
34
		}
35
36
		$config = array(
37
			'dbname' => 'test',
38
		);
39
		$object = new FlyGridfs( $config );
40
		$this->assertInstanceof( \Aimeos\Base\Filesystem\Iface::class, $object );
41
42
		$this->expectException( 'Aimeos\Base\Filesystem\Exception' );
43
		$object->has( 'test' );
44
	}
45
}
46