|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Aimeos\Base\Filesystem; |
|
4
|
|
|
|
|
5
|
|
|
|
|
6
|
|
|
class FlyReplicateTest 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\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\Base\Filesystem\Iface::class, $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\Base\Filesystem\Iface::class, $object ); |
|
41
|
|
|
|
|
42
|
|
|
$this->expectException( 'Aimeos\Base\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\Base\Filesystem\Iface::class, $object ); |
|
55
|
|
|
|
|
56
|
|
|
$this->expectException( 'Aimeos\Base\Filesystem\Exception' ); |
|
57
|
|
|
$object->has( 'test' ); |
|
58
|
|
|
} |
|
59
|
|
|
} |
|
60
|
|
|
|