-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResponseTest.php
More file actions
64 lines (53 loc) · 1.97 KB
/
ResponseTest.php
File metadata and controls
64 lines (53 loc) · 1.97 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
namespace FloatPHP\Tests\Classes\Http;
use PHPUnit\Framework\TestCase;
use FloatPHP\Classes\Http\Response;
/**
* Test Response class.
*/
final class ResponseTest extends TestCase
{
public function testResponseMethodsExist(): void
{
// Response class has static methods: set, setHttpHeader
$this->assertTrue(method_exists(Response::class, 'set'));
$this->assertTrue(method_exists(Response::class, 'setHttpHeader'));
}
public function testResponseClassExists(): void
{
$this->assertTrue(class_exists(Response::class));
}
public function testSetHttpHeaderMethodExists(): void
{
$this->assertTrue(method_exists(Response::class, 'setHttpHeader'));
}
public function testResponseExtendsStatus(): void
{
$this->assertTrue(is_subclass_of(Response::class, 'FloatPHP\Classes\Http\Status'));
}
public function testResponseConstants(): void
{
$this->assertTrue(defined('FloatPHP\Classes\Http\Response::TYPE'));
$this->assertEquals('application/json', Response::TYPE);
}
public function testResponseStaticMethods(): void
{
// Test that static methods exist
$reflection = new \ReflectionClass(Response::class);
$methods = $reflection->getMethods(\ReflectionMethod::IS_STATIC);
$methodNames = array_map(fn($method) => $method->getName(), $methods);
$this->assertContains('set', $methodNames);
$this->assertContains('setHttpHeader', $methodNames);
}
public function testResponseInheritance(): void
{
// Response extends Status and should have access to getMessage
$this->assertTrue(method_exists(Response::class, 'getMessage'));
}
public function testResponseClassStructure(): void
{
$reflection = new \ReflectionClass(Response::class);
$this->assertTrue($reflection->isFinal());
$this->assertEquals('FloatPHP\Classes\Http', $reflection->getNamespaceName());
}
}