Completed
Push — master ( 554150...480ec4 )
by Aimeos
02:39
created

FlyReplicateTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 4
c 2
b 0
f 1
lcom 1
cbo 1
dl 0
loc 46
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetProvider() 0 16 2
A testGetProviderNoSource() 0 11 1
A testGetProviderNoReplica() 0 12 1
1
<?php
2
3
namespace Aimeos\MW\Filesystem;
4
5
6
class FlyReplicateTest extends \PHPUnit_Framework_TestCase
7
{
8
	public function testGetProvider()
9
	{
10
		if( !class_exists( '\League\Flysystem\Replicate\ReplicateAdapter' ) ) {
11
			$this->markTestSkipped( 'Install Flysystem Replicate adapter' );
12
		}
13
14
		$config = array(
15
			'adapter' => 'Replicate',
16
			'source' => array( 'adapter' => 'FlyMemory' ),
17
			'replica' => array( 'adapter' => 'FlyMemory' ),
18
		);
19
		$object = new FlyReplicate( $config );
20
		$this->assertInstanceof( '\Aimeos\MW\Filesystem\Iface', $object );
21
22
		$object->has( 'test' );
23
	}
24
25
26
	public function testGetProviderNoSource()
27
	{
28
		$config = array(
29
			'adapter' => 'Replicate',
30
		);
31
		$object = new FlyReplicate( $config );
32
		$this->assertInstanceof( '\Aimeos\MW\Filesystem\Iface', $object );
33
34
		$this->setExpectedException( 'Aimeos\MW\Filesystem\Exception' );
35
		$object->has( 'test' );
36
	}
37
38
39
	public function testGetProviderNoReplica()
40
	{
41
		$config = array(
42
			'adapter' => 'Replicate',
43
			'source' => array( 'adapter' => 'FlyMemory' ),
44
		);
45
		$object = new FlyReplicate( $config );
46
		$this->assertInstanceof( '\Aimeos\MW\Filesystem\Iface', $object );
47
48
		$this->setExpectedException( 'Aimeos\MW\Filesystem\Exception' );
49
		$object->has( 'test' );
50
	}
51
}
52