diff options
author | Vincent Petry <vincent@nextcloud.com> | 2022-12-16 11:41:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-16 11:41:36 +0100 |
commit | 2881a2f6dd19edf582ed2f2030af20bef6c25eab (patch) | |
tree | 01734f97c78cefaaef715c9a78b460d370d5cfc7 /tests/lib/AppFramework/Http/RequestTest.php | |
parent | 8a0add4ecbbbcb682d5c332deabcfe0a3c56a946 (diff) | |
parent | 81f2857f340464d996caf454bb38e27a7fb970c1 (diff) | |
download | nextcloud-server-2881a2f6dd19edf582ed2f2030af20bef6c25eab.tar.gz nextcloud-server-2881a2f6dd19edf582ed2f2030af20bef6c25eab.zip |
Merge pull request #35779 from nextcloud/catchTypeError
[PHP8] check if params given to API are really an array
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'] |