HEX
Server: Apache
System: Linux v38079.2is.nl 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: democfellows (10015)
PHP: 8.1.34
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/creativefellows.nl/comtel.creativefellows.nl/vendor/slim/psr7/tests/HeaderTest.php
<?php

/**
 * Slim Framework (https://slimframework.com)
 *
 * @license https://github.com/slimphp/Slim-Psr7/blob/master/LICENSE.md (MIT License)
 */

declare(strict_types=1);

namespace Slim\Tests\Psr7;

use PHPUnit\Framework\TestCase;
use Slim\Psr7\Header;

class HeaderTest extends TestCase
{
    /**
     * Instantiate a default header.
     *
     * @return Header
     */
    protected function headerFactory(): Header
    {
        $originalName = 'ACCEPT';
        $normalizedName = 'accept';
        $values = ['application/json'];

        return new Header($originalName, $normalizedName, $values);
    }

    public function testGetOriginalName(): void
    {
        $header = $this->headerFactory();
        $this->assertEquals('ACCEPT', $header->getOriginalName());
    }

    public function testGetNormalizedName(): void
    {
        $header = $this->headerFactory();
        $this->assertEquals('accept', $header->getNormalizedName());
    }

    public function testAddValue(): void
    {
        $header = $this->headerFactory();
        $header2 = $header->addValue('text/html');

        $this->assertEquals(['application/json', 'text/html'], $header->getValues());
        $this->assertSame($header2, $header);
    }

    public function testAddValuesString(): void
    {
        $header = $this->headerFactory();
        $header2 = $header->addValues('text/html');

        $this->assertEquals(['application/json', 'text/html'], $header->getValues());
        $this->assertSame($header2, $header);
    }
}