Completed
Push — master ( 953c6b...ad658e )
by Aimeos
02:48
created

lib/custom/tests/MW/Filesystem/FlyCopyTest.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Aimeos\MW\Filesystem;
4
5
6
class FlyCopyTest 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 FlyCopy( array() );
19
		$this->assertInstanceof( '\Aimeos\MW\Filesystem\Iface', $object );
20
21
		$this->setExpectedException( 'Aimeos\MW\Filesystem\Exception' );
22
		$object->has( 'test' );
23
	}
24
25
26
	public function testGetProviderKey()
27
	{
28
		$config = array(
29
			'consumerkey' => 'test'
30
		);
31
		$object = new FlyCopy( $config );
32
		$this->assertInstanceof( '\Aimeos\MW\Filesystem\Iface', $object );
33
34
		$this->setExpectedException( 'Aimeos\MW\Filesystem\Exception' );
35
		$object->has( 'test' );
36
	}
37
38
39 View Code Duplication
	public function testGetProviderSecret()
0 ignored issues
show
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
		$config = array(
42
			'consumerkey' => 'test',
43
			'consumersecret' => 'test',
44
		);
45
		$object = new FlyCopy( $config );
46
		$this->assertInstanceof( '\Aimeos\MW\Filesystem\Iface', $object );
47
48
		$this->setExpectedException( 'Aimeos\MW\Filesystem\Exception' );
49
		$object->has( 'test' );
50
	}
51
52
53 View Code Duplication
	public function testGetProviderToken()
0 ignored issues
show
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...
54
	{
55
		$config = array(
56
			'consumerkey' => 'test',
57
			'consumersecret' => 'test',
58
			'accesstoken' => 'test',
59
		);
60
		$object = new FlyCopy( $config );
61
		$this->assertInstanceof( '\Aimeos\MW\Filesystem\Iface', $object );
62
63
		$this->setExpectedException( 'Aimeos\MW\Filesystem\Exception' );
64
		$object->has( 'test' );
65
	}
66
67
68
	public function testGetProviderAccess()
69
	{
70
		if( !class_exists( '\League\Flysystem\Copy\CopyAdapter' ) ) {
71
			$this->markTestSkipped( 'Install Flysystem Copy adapter' );
72
		}
73
74
		$config = array(
75
			'consumerkey' => 'test',
76
			'consumersecret' => 'test',
77
			'accesstoken' => 'test',
78
			'tokensecret' => 'test',
79
		);
80
		$object = new FlyCopy( $config );
81
		$this->assertInstanceof( '\Aimeos\MW\Filesystem\Iface', $object );
82
83
		$this->setExpectedException( 'Exception' );
84
		$object->has( 'test' );
85
	}
86
}
87