mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
Improved header tests
This commit is contained in:
1 parent
8667e9f821
commit
a8973ab26b
2 files changed
+13
No files matched your search
@@ -47,6 +47,10 @@ class Headers extends Validator
|
||||
$value = \json_decode($value, true);
|
||||
}
|
||||
|
||||
if (!\is_array($value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
return false;
|
||||
} else {
|
||||
|
||||
@@ -95,5 +95,14 @@ class HeadersTest extends TestCase
|
||||
'a' => 'b',
|
||||
];
|
||||
$this->assertTrue($this->object->isValid($headers));
|
||||
|
||||
$headers = 123;
|
||||
$this->assertFalse($this->object->isValid($headers));
|
||||
|
||||
$headers = true;
|
||||
$this->assertFalse($this->object->isValid($headers));
|
||||
|
||||
$headers = 'string';
|
||||
$this->assertFalse($this->object->isValid($headers));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user