diff options
author | provokateurin <kate@provokateurin.de> | 2024-08-31 17:00:19 +0200 |
---|---|---|
committer | provokateurin <kate@provokateurin.de> | 2024-09-10 16:36:33 +0200 |
commit | d0a827a68430cf716f098b0238a150c2fd9e4c83 (patch) | |
tree | ecc4ce85e6d2a2b0253f6542f5e902af682aaad7 /tests | |
parent | 0858ff7a076b1535cecd7c1ec5140b4e2c2b4f47 (diff) | |
download | nextcloud-server-d0a827a68430cf716f098b0238a150c2fd9e4c83.tar.gz nextcloud-server-d0a827a68430cf716f098b0238a150c2fd9e4c83.zip |
fix(RichObjectStrings/Validator): Validate key value types of rich object parameters
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/RichObjectStrings/ValidatorTest.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/lib/RichObjectStrings/ValidatorTest.php b/tests/lib/RichObjectStrings/ValidatorTest.php index 3604dcba4f7..91fe10916d2 100644 --- a/tests/lib/RichObjectStrings/ValidatorTest.php +++ b/tests/lib/RichObjectStrings/ValidatorTest.php @@ -8,6 +8,7 @@ namespace Test\RichObjectStrings; use OC\RichObjectStrings\Validator; use OCP\RichObjectStrings\Definitions; +use OCP\RichObjectStrings\InvalidObjectExeption; use Test\TestCase; class ValidatorTest extends TestCase { @@ -33,5 +34,27 @@ class ValidatorTest extends TestCase { ], ]); $this->addToAssertionCount(2); + + $this->expectException(InvalidObjectExeption::class); + + $this->expectExceptionMessage('Object is invalid, value 123 is not a string'); + $v->validate('test {string1} test.', [ + 'string1' => [ + 'type' => 'user', + 'id' => 'johndoe', + 'name' => 'John Doe', + 'key' => 123, + ], + ]); + + $this->expectExceptionMessage('Object is invalid, key 456 is not a string'); + $v->validate('test {string1} test.', [ + 'string1' => [ + 'type' => 'user', + 'id' => 'johndoe', + 'name' => 'John Doe', + 456 => 'value', + ], + ]); } } |