Code Duplication    Length = 33-36 lines in 3 locations

lib/custom/tests/MW/Filesystem/FlyAwsS3Test.php 1 location

@@ 6-38 (lines=33) @@
3
namespace Aimeos\MW\Filesystem;
4
5
6
class FlyAwsS3Test 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\AwsS3v3\AwsS3Adapter' ) ) {
19
			$this->markTestSkipped( 'Install Flysystem AwsS3v3 adapter' );
20
		}
21
22
		$object = new FlyAwsS3( array( 'bucket' => 'test' ) );
23
		$this->assertInstanceof( '\Aimeos\MW\Filesystem\Iface', $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\MW\Filesystem\Iface', $object );
34
35
		$this->expectException( '\Aimeos\MW\Filesystem\Exception' );
36
		$object->has( 'test' );
37
	}
38
}
39

lib/custom/tests/MW/Filesystem/FlyRackspaceTest.php 1 location

@@ 6-38 (lines=33) @@
3
namespace Aimeos\MW\Filesystem;
4
5
6
class FlyRackspaceTest 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
		$object = new FlyRackspace( [] );
19
		$this->assertInstanceof( '\Aimeos\MW\Filesystem\Iface', $object );
20
21
		$this->expectException( '\Aimeos\MW\Filesystem\Exception' );
22
		$object->has( 'test' );
23
	}
24
25
26
	public function testGetProviderContainer()
27
	{
28
		if( !class_exists( '\League\Flysystem\Rackspace\RackspaceAdapter' ) ) {
29
			$this->markTestSkipped( 'Install Flysystem Rackspace adapter' );
30
		}
31
32
		$object = new FlyRackspace( array( 'container' => 'test' ) );
33
		$this->assertInstanceof( '\Aimeos\MW\Filesystem\Iface', $object );
34
35
		$this->expectException( '\OpenCloud\Common\Exceptions\CredentialError' );
36
		$object->has( 'test' );
37
	}
38
}
39

lib/custom/tests/MW/Filesystem/FlyZipTest.php 1 location

@@ 6-41 (lines=36) @@
3
namespace Aimeos\MW\Filesystem;
4
5
6
class FlyZipTest 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\ZipArchive\ZipArchiveAdapter' ) ) {
19
			$this->markTestSkipped( 'Install Flysystem ZipArchive adapter' );
20
		}
21
22
		$object = new FlyZip( [] );
23
		$this->assertInstanceof( '\Aimeos\MW\Filesystem\Iface', $object );
24
25
		$this->expectException( '\Aimeos\MW\Filesystem\Exception' );
26
		$object->has( 'test' );
27
	}
28
29
30
	public function testGetProviderFilepath()
31
	{
32
		if( !class_exists( '\League\Flysystem\ZipArchive\ZipArchiveAdapter' ) ) {
33
			$this->markTestSkipped( 'Install Flysystem ZipArchive adapter' );
34
		}
35
36
		$object = new FlyZip( array( 'filepath' => '/tmp/flytest.zip' ) );
37
		$this->assertInstanceof( '\Aimeos\MW\Filesystem\Iface', $object );
38
39
		$object->has( 'test' );
40
	}
41
}
42