Passed
Branch master (c225ea)
by Aimeos
05:57
created

CacheTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
dl 0
loc 25
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testRunHelp() 0 6 1
A testRun() 0 11 1
1
<?php
2
3
class CacheTest extends \PHPUnit\Framework\TestCase
4
{
5
	public function testRun()
6
	{
7
		$cfgfile = dirname( dirname( __DIR__ ) ) . '/src/aimeos-default.php';
8
		$argv = array( "cache.php", "--config=$cfgfile", "unittest" );
9
10
		ob_start();
11
		$result = \Aimeos\Slim\Command\Cache::run( $argv );
0 ignored issues
show
Unused Code introduced by
The assignment to $result is dead and can be removed.
Loading history...
Bug introduced by
Are you sure the assignment to $result is correct as Aimeos\Slim\Command\Cache::run($argv) targeting Aimeos\Slim\Command\Cache::run() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
12
		$output = ob_get_contents();
13
		ob_end_clean();
14
15
		$this->assertEquals( "Clearing the Aimeos cache for site \"unittest\"\n", $output );
16
	}
17
18
19
	/**
20
	 * @expectedException Aimeos\Slim\Command\Exception
21
	 */
22
	public function testRunHelp()
23
	{
24
		$cfgfile = dirname( dirname( __DIR__ ) ) . '/src/aimeos-default.php';
0 ignored issues
show
Unused Code introduced by
The assignment to $cfgfile is dead and can be removed.
Loading history...
25
		$argv = array( "cache.php", "--help" );
26
27
		\Aimeos\Slim\Command\Cache::run( $argv );
28
	}
29
}
30