mirror of
https://github.com/appwrite/appwrite
synced 2026-04-21 21:47:16 +00:00
49 lines
1.2 KiB
PHP
49 lines
1.2 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace Tests\Unit\Functions\Validator;
|
||
|
|
|
||
|
|
use Appwrite\Functions\Validator\Headers;
|
||
|
|
use PHPUnit\Framework\TestCase;
|
||
|
|
|
||
|
|
class HeadersTest extends TestCase
|
||
|
|
{
|
||
|
|
protected ?Headers $object = null;
|
||
|
|
|
||
|
|
public function setUp(): void
|
||
|
|
{
|
||
|
|
$this->object = new Headers();
|
||
|
|
}
|
||
|
|
|
||
|
|
public function testValues(): void
|
||
|
|
{
|
||
|
|
$headers = [
|
||
|
|
'headerKey' => 'headerValue',
|
||
|
|
];
|
||
|
|
$this->assertEquals($this->object->isValid($headers), true);
|
||
|
|
|
||
|
|
$headers = [
|
||
|
|
'headerKey' => 'headerValue',
|
||
|
|
'x-appwrite-key' => 'headerValue',
|
||
|
|
];
|
||
|
|
$this->assertEquals($this->object->isValid($headers), false);
|
||
|
|
|
||
|
|
$headers = [
|
||
|
|
'headerKey' => 'headerValue',
|
||
|
|
'headerKey2' => 'headerValue2',
|
||
|
|
];
|
||
|
|
$this->assertEquals($this->object->isValid($headers), true);
|
||
|
|
|
||
|
|
$headers = [
|
||
|
|
'headerKey' => 'headerValue',
|
||
|
|
'x-appwrite-project' => 'headerValue',
|
||
|
|
'headerKey2' => 'headerValue2',
|
||
|
|
];
|
||
|
|
$this->assertEquals($this->object->isValid($headers), false);
|
||
|
|
|
||
|
|
$headers = [
|
||
|
|
'header/////Key' => 'headerValue',
|
||
|
|
];
|
||
|
|
$this->assertEquals($this->object->isValid($headers), false);
|
||
|
|
}
|
||
|
|
}
|