diff options
Diffstat (limited to 'tests/lib/httphelper.php')
-rw-r--r-- | tests/lib/httphelper.php | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/tests/lib/httphelper.php b/tests/lib/httphelper.php index 1cc4232ab4b..48d6543f1f2 100644 --- a/tests/lib/httphelper.php +++ b/tests/lib/httphelper.php @@ -12,14 +12,17 @@ class TestHTTPHelper extends \Test\TestCase { private $config; /** @var \OC\HTTPHelper */ private $httpHelperMock; + /** @var \OC\Security\CertificateManager */ + private $certificateManager; protected function setUp() { parent::setUp(); $this->config = $this->getMockBuilder('\OCP\IConfig') ->disableOriginalConstructor()->getMock(); + $this->certificateManager = $this->getMock('\OCP\ICertificateManager'); $this->httpHelperMock = $this->getMockBuilder('\OC\HTTPHelper') - ->setConstructorArgs(array($this->config)) + ->setConstructorArgs(array($this->config, $this->certificateManager)) ->setMethods(array('getHeaders')) ->getMock(); } @@ -87,4 +90,23 @@ class TestHTTPHelper extends \Test\TestCase { $this->assertSame($expected, $this->httpHelperMock->isHTTPURL($url)); } + + /** + * @dataProvider postParameters + */ + public function testassemblePostParameters($parameterList, $expectedResult) { + $helper = \OC::$server->getHTTPHelper(); + $result = \Test_Helper::invokePrivate($helper, 'assemblePostParameters', array($parameterList)); + $this->assertSame($expectedResult, $result); + } + + public function postParameters() { + return array( + array(array('k1' => 'v1'), 'k1=v1'), + array(array('k1' => 'v1', 'k2' => 'v2'), 'k1=v1&k2=v2'), + array(array(), ''), + ); + } + + } |