Passed
Push — master ( b62f3e...ec4003 )
by Aimeos
02:15
created

StandardTest::testGet()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 3
c 2
b 0
f 0
dl 0
loc 6
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Aimeos\Base\Filesystem\Manager;
4
5
6
class StandardTest extends \PHPUnit\Framework\TestCase
7
{
8
	public function testGet()
9
	{
10
		$config = ['fs-media' => ['adapter' => 'Standard', 'basedir' => __DIR__]];
11
		$object = new \Aimeos\Base\Filesystem\Manager\Standard( $config );
12
13
		$this->assertInstanceof( 'Aimeos\Base\Filesystem\Iface', $object->get( 'fs-media' ) );
14
	}
15
16
17
	public function testGetFallback()
18
	{
19
		$config = ['fs' => ['adapter' => 'Standard', 'basedir' => __DIR__]];
20
		$object = new \Aimeos\Base\Filesystem\Manager\Standard( $config );
21
22
		$this->assertInstanceof( 'Aimeos\Base\Filesystem\Iface', $object->get( 'fs-media' ) );
23
	}
24
25
26
	public function testGetException()
27
	{
28
		$object = new \Aimeos\Base\Filesystem\Manager\Standard( [] );
29
30
		$this->expectException( \Aimeos\Base\Filesystem\Exception::class );
31
		$object->get( 'xx' );
32
	}
33
34
35
	public function tesGetNoAdapter()
36
	{
37
		$object = new \Aimeos\Base\Filesystem\Manager\Standard( ['fs' => ['basedir' => __DIR__]] );
38
39
		$this->expectException( \Aimeos\Base\Filesystem\Exception::class );
40
		$object->get();
0 ignored issues
show
Bug introduced by
The call to Aimeos\Base\Filesystem\Manager\Standard::get() has too few arguments starting with name. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

40
		$object->/** @scrutinizer ignore-call */ 
41
           get();

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
41
	}
42
43
44
	public function testSleep()
45
	{
46
		$object = new \Aimeos\Base\Filesystem\Manager\Standard( [] );
47
		$this->assertEquals( ['config' => [], 'objects' => []], $object->__sleep() );
48
	}
49
}
50