HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: /home/xedaptot/ai.naniguide.com/vendor/sendgrid/php-http-client/test/unit/ResponseTest.php
<?php

namespace SendGrid\Test;

use SendGrid\Response;
use PHPUnit\Framework\TestCase;

class ResponseTest extends TestCase
{
    public function testConstructor()
    {
        $response = new Response();

        $this->assertAttributeEquals(200, 'statusCode', $response);
        $this->assertAttributeEquals('', 'body', $response);
        $this->assertAttributeEquals([], 'headers', $response);

        $response = new Response(201, 'test', ['Content-Encoding: gzip']);

        $this->assertAttributeEquals(201, 'statusCode', $response);
        $this->assertAttributeEquals('test', 'body', $response);
        $this->assertAttributeEquals(['Content-Encoding: gzip'], 'headers', $response);
    }

    public function testStatusCode()
    {
        $response = new Response(404);

        $this->assertEquals(404, $response->statusCode());
    }

    public function testBody()
    {
        $response = new Response(null, 'foo');

        $this->assertEquals('foo', $response->body());
    }

    public function testHeaders()
    {
        $response = new Response(null, null, ['Content-Type: text/html']);

        $this->assertEquals(['Content-Type: text/html'], $response->headers());
    }

    public function testAssociativeHeaders()
    {
        $response = new Response(null, null, ['Content-Type: text/html', 'HTTP/1.1 200 OK']);

        $this->assertEquals(['Content-Type' => 'text/html', 'Status' => 'HTTP/1.1 200 OK'], $response->headers(true));
    }
}