Completed
Pull Request — master (#217)
by Thomas
03:10
created

RequestTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A varsProvider() 0 8 1
A testPostParameter() 0 5 1
1
<?php
2
3
namespace Owncloud\Updater\Tests\Http;
4
5
use Owncloud\Updater\Http\Request;
6
7
class RequestTest extends \PHPUnit_Framework_TestCase {
8
9
	public function varsProvider(){
10
		return [
11
			[ [], 'abcd', null ],
12
			[ [ 'post'=> [ 'command' => 'jump'] ], 'dummy',  null ],
13
			[ [ 'post'=> [ 'command' => 'jump'] ], 'command', 'jump' ],
14
			[ [ 'post'=> [ 'testArray' => ['key' => 'value'] ] ], 'testArray',  ['key' => 'value'] ],
15
		];
16
	}
17
18
	/**
19
	 * @dataProvider varsProvider
20
	 */
21
	public function testPostParameter($vars, $key, $expected){
22
		$request = new Request($vars);
23
		$actual = $request->postParameter($key);
24
		$this->assertEquals($expected, $actual);
25
	}
26
}
27