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

RequestTest::testPostParameter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 4
nc 1
nop 3
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