HEX
Server: nginx/1.18.0
System: Linux test-ipsremont 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
User: ips (1000)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/quadcode/vendor/sendgrid/php-http-client/test/unit/ResponseTest.php
<?php

namespace SendGrid\Test;

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

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

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

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

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

    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));
    }
}