Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 0 additions & 49 deletions tests/src/Unit/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,6 @@ public function testFromPsr7(): void
$this->assertEquals('Who needs reasons?', $response->getStatusText());
}

public function testGetSetStatus(): void
{
$response = (new \Deviantintegral\Har\Response())->setStatus(404);
$this->assertEquals(404, $response->getStatus());
}

public function testGetSetStatusText(): void
{
$response = (new \Deviantintegral\Har\Response())->setStatusText('Not Found');
$this->assertEquals('Not Found', $response->getStatusText());
}

public function testGetSetContent(): void
{
$content = (new Content())->setText('test content');
$response = (new \Deviantintegral\Har\Response())->setContent($content);
$this->assertSame($content, $response->getContent());
}

public function testGetSetRedirectURL(): void
{
$uri = new Uri('https://www.example.com/redirect');
$response = (new \Deviantintegral\Har\Response())->setRedirectURL($uri);
$this->assertSame($uri, $response->getRedirectURL());
}

public function testSerialize(): void
{
$serializer = $this->getSerializer();
Expand Down Expand Up @@ -87,18 +61,6 @@ public function testSerialize(): void
$this->assertEquals($response->getComment(), $deserialized->getComment());
}

public function testSetHeadersCalculatesCorrectSize(): void
{
$response = new \Deviantintegral\Har\Response();

// Test with single header: "Content-Type: application/json"
// Size calculation: strlen("Content-Type") + 2 + strlen("application/json") + 2 = 12 + 2 + 16 + 2 = 32
// Plus final 2 for double CRLF: 32 + 2 = 34
$headers = [(new Header())->setName('Content-Type')->setValue('application/json')];
$response->setHeaders($headers);
$this->assertSame(34, $response->getHeadersSize());
}

public function testSetHeadersWithMultipleHeaders(): void
{
$response = new \Deviantintegral\Har\Response();
Expand All @@ -124,15 +86,4 @@ public function testSetHeadersWithEmptyArray(): void
$response->setHeaders([]);
$this->assertSame(2, $response->getHeadersSize());
}

public function testSetHeadersWithSingleCharacterValues(): void
{
$response = new \Deviantintegral\Har\Response();

// Test with minimal header to ensure each +2 is necessary
// "X: Y" = 1 + 2 + 1 + 2 = 6, plus final 2 = 8
$headers = [(new Header())->setName('X')->setValue('Y')];
$response->setHeaders($headers);
$this->assertSame(8, $response->getHeadersSize());
}
}