-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathProtocolTest.php
34 lines (31 loc) · 1.02 KB
/
ProtocolTest.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
<?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\Protocol;
use PHPUnit\Framework\TestCase;
final class ProtocolTest extends TestCase
{
public function testValidate() : void
{
self::assertSame('HTTP/1.0', Protocol::validate('http/1.0'));
self::assertSame('HTTP/3', Protocol::validate('Http/3'));
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Invalid protocol: Foo');
Protocol::validate('Foo');
}
public function testConstants() : void
{
$reflection = new \ReflectionClass(Protocol::class);
foreach ($reflection->getConstants() as $name => $value) {
self::assertSame(\strtoupper($name), $name);
self::assertSame($value, Protocol::validate($value));
}
}
}