Completed
Pull Request — master (#44)
by Sam
02:16
created

SmokeTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
c 1
b 0
f 1
lcom 0
cbo 2
dl 0
loc 18
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testHelpOutput() 0 12 1
1
<?php
2
3
define('PACKAGE_ROOT' , dirname(__DIR__).'/');
4
require_once(PACKAGE_ROOT . 'src/SSPak.php');
5
6
/**
7
 * Confirm that the compile binary executes
8
 */
9
class SmokeTest extends PHPUnit_Framework_TestCase
10
{
11
	/**
12
	 * Check that the help output of the binary matches what the internal function generates
13
	 */
14
	function testHelpOutput() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
15
		$ssPak = new SSPak(null);
0 ignored issues
show
Documentation introduced by
null is of type null, but the function expects a object<Executor>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
16
17
		// Internal call
18
		ob_start();
19
		$ssPak->help(array());
20
		$helpText = ob_get_contents();
21
		ob_end_clean();
22
23
		// Call to binary
24
		$this->assertEquals($helpText, `build/sspak.phar help &> /dev/stdout`);
25
	}
26
}
27