mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Improved header tests
This commit is contained in:
@@ -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