Skip to content
Snippets Groups Projects
Commit 11f2cf97 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

add test script

parent cb38f40e
No related branches found
No related tags found
1 merge request!57512 php83 update
<?php <?php
/** /**
*
* TEST * TEST
* Verify if a redirect works * Verify if a redirect works
*
* Usage:
* cd ./tests
* php get_redirect.php
*
*/ */
require_once '../public_html/classes/redirect.class.php'; require_once '../public_html/classes/redirect.class.php';
...@@ -9,13 +15,20 @@ require_once '../public_html/classes/redirect.class.php'; ...@@ -9,13 +15,20 @@ require_once '../public_html/classes/redirect.class.php';
// CONFIG // CONFIG
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
$aTests=[ $aTests=[
'www.example.com - static entry' => [ 'www.example.com - static entry /mail' => [
'host'=>'www.example.com', 'host'=>'www.example.com',
'request'=>'/mail', 'request'=>'/mail',
'target'=>'https://www.example.com/webmail', 'target'=>'https://www.example.com/webmail',
'code'=>301, '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' => [ 'www.example.com - regex' => [
'host'=>'www.example.com', 'host'=>'www.example.com',
'request'=>'/somethingold', 'request'=>'/somethingold',
...@@ -23,6 +36,20 @@ $aTests=[ ...@@ -23,6 +36,20 @@ $aTests=[
'target'=>'https://www.example.com/', 'target'=>'https://www.example.com/',
'code'=>307, '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,
],
]; ];
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment