diff options
author | Artur Neumann <artur@jankaritech.com> | 2022-12-15 13:06:02 +0545 |
---|---|---|
committer | Artur Neumann <artur@jankaritech.com> | 2022-12-15 13:45:22 +0545 |
commit | 81f2857f340464d996caf454bb38e27a7fb970c1 (patch) | |
tree | 158523fd48885aee5c08f2615df6a7ecedca5461 /tests/lib/AppFramework/Http/RequestTest.php | |
parent | 0d6a706bc08e40fad013bc7f0d07e6c0b71d27f9 (diff) | |
download | nextcloud-server-81f2857f340464d996caf454bb38e27a7fb970c1.tar.gz nextcloud-server-81f2857f340464d996caf454bb38e27a7fb970c1.zip |
check if params given to API are really an array
Signed-off-by: Artur Neumann <artur@jankaritech.com>
Diffstat (limited to 'tests/lib/AppFramework/Http/RequestTest.php')
-rw-r--r-- | tests/lib/AppFramework/Http/RequestTest.php | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php index cf5ebdca2f0..78f4f80f8be 100644 --- a/tests/lib/AppFramework/Http/RequestTest.php +++ b/tests/lib/AppFramework/Http/RequestTest.php @@ -207,9 +207,20 @@ class RequestTest extends \Test\TestCase { $this->assertSame('Joey', $request['nickname']); } - public function testNotJsonPost() { + public function notJsonDataProvider() { + return [ + ['this is not valid json'], + ['"just a string"'], + ['{"just a string"}'], + ]; + } + + /** + * @dataProvider notJsonDataProvider + */ + public function testNotJsonPost($testData) { global $data; - $data = 'this is not valid json'; + $data = $testData; $vars = [ 'method' => 'POST', 'server' => ['CONTENT_TYPE' => 'application/json; utf-8'] |