-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathRequestHeaderTest.php
41 lines (38 loc) · 1.19 KB
/
RequestHeaderTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/*
* This file is part of Aplus Framework HTTP Library.
*
* (c) Natan Felles <natanfelles@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Tests\HTTP;
use Framework\HTTP\RequestHeader;
use PHPUnit\Framework\TestCase;
final class RequestHeaderTest extends TestCase
{
public function testParseInput() : void
{
self::assertSame([
'Host' => 'localhost',
'Content-Type' => 'text/Foo',
], RequestHeader::parseInput([
'Host' => 'Foo',
'HTTP_HOST' => 'localhost',
'HTTP_CONTENT_TYPE' => 'text/Foo',
'HTTPS' => 'on',
]));
}
public function testConstants() : void
{
$reflection = new \ReflectionClass(RequestHeader::class);
foreach ($reflection->getConstants() as $name => $value) {
self::assertSame(\strtoupper($name), $name);
self::assertSame(RequestHeader::getName($value), $value);
$name = \strtr(\strtolower($name), ['_' => '-']);
$value = \strtolower($value);
self::assertSame($name, $value);
}
}
}