Code Duplication    Length = 28-32 lines in 3 locations

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

@@ 6-37 (lines=32) @@
3
namespace Aimeos\MW\Filesystem;
4
5
6
class FlyGridfsTest extends \PHPUnit_Framework_TestCase
7
{
8
	public function testGetProvider()
9
	{
10
		$object = new FlyGridfs( array() );
11
		$this->assertInstanceof( '\Aimeos\MW\Filesystem\Iface', $object );
12
13
		$this->setExpectedException( 'Aimeos\MW\Filesystem\Exception' );
14
		$object->has( 'test' );
15
	}
16
17
18
	public function testGetProviderToken()
19
	{
20
		if( !class_exists( '\League\Flysystem\GridFS\GridFSAdapter' ) ) {
21
			$this->markTestSkipped( 'Install Flysystem GridFS adapter' );
22
		}
23
24
		if( !class_exists( '\MongoClient' ) ) {
25
			$this->markTestSkipped( 'Install Mongo client extension' );
26
		}
27
28
		$config = array(
29
			'dbname' => 'test',
30
		);
31
		$object = new FlyGridfs( $config );
32
		$this->assertInstanceof( '\Aimeos\MW\Filesystem\Iface', $object );
33
34
		$this->setExpectedException( 'Aimeos\MW\Filesystem\Exception' );
35
		$object->has( 'test' );
36
	}
37
}
38

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

@@ 6-33 (lines=28) @@
3
namespace Aimeos\MW\Filesystem;
4
5
6
class FlyZipTest extends \PHPUnit_Framework_TestCase
7
{
8
	public function testGetProvider()
9
	{
10
		if( !class_exists( '\League\Flysystem\ZipArchive\ZipArchiveAdapter' ) ) {
11
			$this->markTestSkipped( 'Install Flysystem ZipArchive adapter' );
12
		}
13
14
		$object = new FlyZip( array() );
15
		$this->assertInstanceof( '\Aimeos\MW\Filesystem\Iface', $object );
16
17
		$this->setExpectedException( '\Aimeos\MW\Filesystem\Exception' );
18
		$object->has( 'test' );
19
	}
20
21
22
	public function testGetProviderFilepath()
23
	{
24
		if( !class_exists( '\League\Flysystem\ZipArchive\ZipArchiveAdapter' ) ) {
25
			$this->markTestSkipped( 'Install Flysystem ZipArchive adapter' );
26
		}
27
28
		$object = new FlyZip( array( 'filepath' => '/tmp/flytest.zip' ) );
29
		$this->assertInstanceof( '\Aimeos\MW\Filesystem\Iface', $object );
30
31
		$object->has( 'test' );
32
	}
33
}
34

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

@@ 6-33 (lines=28) @@
3
namespace Aimeos\MW\Filesystem;
4
5
6
class FlyWebdavTest extends \PHPUnit_Framework_TestCase
7
{
8
	public function testGetProvider()
9
	{
10
		if( !class_exists( '\League\Flysystem\WebDAV\WebDAVAdapter' ) ) {
11
			$this->markTestSkipped( 'Install Flysystem WebDAV adapter' );
12
		}
13
14
		$object = new FlyWebdav( array( 'baseUri' => 'http://test.webdav.org/dav/' ) );
15
		$this->assertInstanceof( '\Aimeos\MW\Filesystem\Iface', $object );
16
17
		$object->has( 'test' );
18
	}
19
20
21
	public function testGetProviderNoBaseuri()
22
	{
23
		if( !class_exists( '\League\Flysystem\WebDAV\WebDAVAdapter' ) ) {
24
			$this->markTestSkipped( 'Install Flysystem WebDAV adapter' );
25
		}
26
27
		$object = new FlyWebdav( array() );
28
		$this->assertInstanceof( '\Aimeos\MW\Filesystem\Iface', $object );
29
30
		$this->setExpectedException( '\InvalidArgumentException' );
31
		$object->has( 'test' );
32
	}
33
}
34