diff --git a/test/get_redirect.php b/test/get_redirect.php index c4fe7b09a20f15626e2f995ae8ae963fd7e4bbdf..5af232230a4c9719c6610e3fba82eaddf40fb7eb 100644 --- a/test/get_redirect.php +++ b/test/get_redirect.php @@ -1,7 +1,13 @@ <?php /** + * * TEST * Verify if a redirect works + * + * Usage: + * cd ./tests + * php get_redirect.php + * */ require_once '../public_html/classes/redirect.class.php'; @@ -9,13 +15,20 @@ require_once '../public_html/classes/redirect.class.php'; // CONFIG // ------------------------------------------------------------------------ $aTests=[ - 'www.example.com - static entry' => [ + 'www.example.com - static entry /mail' => [ 'host'=>'www.example.com', 'request'=>'/mail', 'target'=>'https://www.example.com/webmail', 'code'=>301, ], + 'www.example.com - /mail2 should not match /mail but the regex' => [ + 'host'=>'www.example.com', + 'request'=>'/mail2', + + 'target'=>'https://www.example.com/', + 'code'=>307, + ], 'www.example.com - regex' => [ 'host'=>'www.example.com', 'request'=>'/somethingold', @@ -23,6 +36,20 @@ $aTests=[ 'target'=>'https://www.example.com/', 'code'=>307, ], + 'www.example.com - /iml must match regex ^/iml' => [ + 'host'=>'www.example.com', + 'request'=>'/iml', + + 'target'=>'https://www.iml.unibe.ch/', + 'code'=>307, + ], + 'www.example.com - /iml2 must match regex ^/iml too' => [ + 'host'=>'www.example.com', + 'request'=>'/iml2', + + 'target'=>'https://www.iml.unibe.ch/', + 'code'=>307, + ], ]; // ------------------------------------------------------------------------