summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorArtur Neumann <artur@jankaritech.com>2022-12-15 13:06:02 +0545
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>2022-12-16 10:56:04 +0000
commitc8fa04fe62be11c9639c4659f775fc28ace70c49 (patch)
treefbd48765af8de0572c8ec9ac7dc92642408d44bc /tests
parent104d5fae79ecb93857cc7c06b55e0962bd623a06 (diff)
downloadnextcloud-server-c8fa04fe62be11c9639c4659f775fc28ace70c49.tar.gz
nextcloud-server-c8fa04fe62be11c9639c4659f775fc28ace70c49.zip
check if params given to API are really an array
Signed-off-by: Artur Neumann <artur@jankaritech.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/AppFramework/Http/RequestTest.php15
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']