Improved header tests

This commit is contained in:
Khushboo Verma
2024-08-11 18:15:10 +05:30
parent 8667e9f821
commit a8973ab26b
2 changed files with 13 additions and 0 deletions
@@ -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));
}
}