HEX
Server: Apache
System: Linux 185.122.168.184.host.secureserver.net 5.14.0-570.60.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Nov 5 05:00:59 EST 2025 x86_64
User: barbeatleanalyti (1024)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: /home/barbeatleanalyti/www/public_html/webmail/vendor/sabre/http/tests/HTTP/FunctionsTest.php
<?php

namespace Sabre\HTTP;

class FunctionsTest extends \PHPUnit_Framework_TestCase {

    /**
     * @dataProvider getHeaderValuesData
     */
    function testGetHeaderValues($input, $output) {

        $this->assertEquals(
            $output,
            getHeaderValues($input)
        );

    }

    function getHeaderValuesData() {

        return [
            [
                "a",
                ["a"]
            ],
            [
                "a,b",
                ["a", "b"]
            ],
            [
                "a, b",
                ["a", "b"]
            ],
            [
                ["a, b"],
                ["a", "b"]
            ],
            [
                ["a, b", "c", "d,e"],
                ["a", "b", "c", "d", "e"]
            ],
        ];

    }

    /**
     * @dataProvider preferData
     */
    function testPrefer($input, $output) {

        $this->assertEquals(
            $output,
            parsePrefer($input)
        );

    }

    function preferData() {

        return [
            [
                'foo; bar',
                ['foo' => true]
            ],
            [
                'foo; bar=""',
                ['foo' => true]
            ],
            [
                'foo=""; bar',
                ['foo' => true]
            ],
            [
                'FOO',
                ['foo' => true]
            ],
            [
                'respond-async',
                ['respond-async' => true]
            ],
            [

                ['respond-async, wait=100', 'handling=lenient'],
                ['respond-async' => true, 'wait' => 100, 'handling' => 'lenient']
            ],
            [

                ['respond-async, wait=100, handling=lenient'],
                ['respond-async' => true, 'wait' => 100, 'handling' => 'lenient']
            ],
            // Old values
            [

                'return-asynch, return-representation',
                ['respond-async' => true, 'return' => 'representation'],
            ],
            [

                'return-minimal',
                ['return' => 'minimal'],
            ],
            [

                'strict',
                ['handling' => 'strict'],
            ],
            [

                'lenient',
                ['handling' => 'lenient'],
            ],
            // Invalid token
            [
                ['foo=%bar%'],
                [],
            ]
        ];

    }

}