Redirect.php

<?php

namespace Liaison\Test\Addon;

class Redirect extends \Tlf\Tester {
    
    static public array $cases = [
        0 => '',
        1 => '?something_else=abc',
        2 => '#hashparam',
        3 => '?both#hashsecond',
        4 => '#hashfirst?with_both',
        5 => '?', // intentionally no paramater
    ];

    public function testGoto(){

        foreach (static::$cases as $case => $case_url){
            $this->test("case $case");
            $response = $this->get('/redirect-to/', ['case'=>$case]);

            echo "\n## Response:\n$response\n";

            //echo "\n---\n".$response."\n---\n";

            $this->str_contains(
                $response,
                "It looks like the redirect was successful!($case)"
            );

            //echo "\n\n\n\n";
            //exit;
        }

    }
}