Completed
Push — master ( 9a5b65...bc6c02 )
by Aimeos
05:06
created

FlyDropboxTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 50
Duplicated Lines 48 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 1
dl 24
loc 50
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 2
A testGetProviderToken() 0 11 1
A testGetProvider() 8 8 1
A testGetProviderAccess() 16 16 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Aimeos\MW\Filesystem;
4
5
6
class FlyDropboxTest 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 View Code Duplication
	public function testGetProvider()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
	{
18
		$object = new FlyDropbox( [] );
19
		$this->assertInstanceof( \Aimeos\MW\Filesystem\Iface::class, $object );
20
21
		$this->setExpectedException( 'Aimeos\MW\Filesystem\Exception' );
22
		$object->has( 'test' );
23
	}
24
25
26
	public function testGetProviderToken()
27
	{
28
		$config = array(
29
			'accesstoken' => 'test',
30
		);
31
		$object = new FlyDropbox( $config );
32
		$this->assertInstanceof( \Aimeos\MW\Filesystem\Iface::class, $object );
33
34
		$this->setExpectedException( 'Aimeos\MW\Filesystem\Exception' );
35
		$object->has( 'test' );
36
	}
37
38
39 View Code Duplication
	public function testGetProviderAccess()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
40
	{
41
		if( !class_exists( '\League\Flysystem\Dropbox\DropboxAdapter' ) ) {
42
			$this->markTestSkipped( 'Install Flysystem Dropbox adapter' );
43
		}
44
45
		$config = array(
46
			'accesstoken' => 'test',
47
			'appsecret' => 'test',
48
		);
49
		$object = new FlyDropbox( $config );
50
		$this->assertInstanceof( \Aimeos\MW\Filesystem\Iface::class, $object );
51
52
		$this->setExpectedException( 'Exception' );
53
		$object->has( 'test' );
54
	}
55
}
56