1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Aimeos\MW\Filesystem; |
4
|
|
|
|
5
|
|
|
|
6
|
|
|
class FlyReplicateTest extends \PHPUnit_Framework_TestCase |
7
|
|
|
{ |
8
|
|
|
protected function setUp() |
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\Replicate\ReplicateAdapter' ) ) { |
19
|
|
|
$this->markTestSkipped( 'Install Flysystem Replicate adapter' ); |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
$config = array( |
23
|
|
|
'adapter' => 'Replicate', |
24
|
|
|
'source' => array( 'adapter' => 'FlyMemory' ), |
25
|
|
|
'replica' => array( 'adapter' => 'FlyMemory' ), |
26
|
|
|
); |
27
|
|
|
$object = new FlyReplicate( $config ); |
28
|
|
|
$this->assertInstanceof( '\Aimeos\MW\Filesystem\Iface', $object ); |
29
|
|
|
|
30
|
|
|
$object->has( 'test' ); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
|
34
|
|
|
public function testGetProviderNoSource() |
35
|
|
|
{ |
36
|
|
|
$config = array( |
37
|
|
|
'adapter' => 'Replicate', |
38
|
|
|
); |
39
|
|
|
$object = new FlyReplicate( $config ); |
40
|
|
|
$this->assertInstanceof( '\Aimeos\MW\Filesystem\Iface', $object ); |
41
|
|
|
|
42
|
|
|
$this->setExpectedException( 'Aimeos\MW\Filesystem\Exception' ); |
43
|
|
|
$object->has( 'test' ); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
|
47
|
|
|
public function testGetProviderNoReplica() |
48
|
|
|
{ |
49
|
|
|
$config = array( |
50
|
|
|
'adapter' => 'Replicate', |
51
|
|
|
'source' => array( 'adapter' => 'FlyMemory' ), |
52
|
|
|
); |
53
|
|
|
$object = new FlyReplicate( $config ); |
54
|
|
|
$this->assertInstanceof( '\Aimeos\MW\Filesystem\Iface', $object ); |
55
|
|
|
|
56
|
|
|
$this->setExpectedException( 'Aimeos\MW\Filesystem\Exception' ); |
57
|
|
|
$object->has( 'test' ); |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|