PHP OpenID consumer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

parseredirects.test.php 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?PHP if (!defined('INCLUDE')) { ?><html>
  2. <head>
  3. <title>Poidsy unit test - redirect tests</title>
  4. <style type="text/css">
  5. table { border-collapse: collapse; width: 100%; }
  6. td, th { border: 1px solid #000; padding: 10px; }
  7. td.error { text-align: center; color: #fff; background-color: #c00; }
  8. td.succ { text-align: center; color: #fff; background-color: #0c0; }
  9. </style>
  10. </head>
  11. <body>
  12. <table>
  13. <tr><th>Input</th><th>Expected</th><th>Actual</th><th>Result</th></tr>
  14. <?PHP
  15. }
  16. require_once('../discoverer.inc.php');
  17. function doRedirTest($output, $input) {
  18. $url = $url2 = 'http://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['SCRIPT_NAME']) . '/';
  19. $output = $url . $output;
  20. $url = $url . $input;
  21. $disc = new Discoverer($url);
  22. $aoutput = $disc->getClaimedId();
  23. $result = $aoutput == $output;
  24. echo '<tr><td><a href="', htmlentities($url), '">', htmlentities($input), '</a></td>';
  25. echo '<td>', htmlentities(str_replace($url2, '', $output)), '</td>';
  26. echo '<td>', htmlentities(str_replace($url2, '', $aoutput)), '</td>';
  27. echo '<td class="', $result ? 'succ' : 'error', '">';
  28. echo $result ? 'Passed' : 'Failed';
  29. echo '</td>';
  30. echo '</tr>';
  31. }
  32. $tests = array(
  33. 'redirtest/one.php' => 'redirtest/three.php',
  34. 'redirtest/two.php' => 'redirtest/three.php',
  35. 'redirtest/three.php' => 'redirtest/three.php',
  36. 'redirtest/four.php' => 'redirtest/three.php',
  37. 'redirtest/five.php' => 'redirtest/three.php',
  38. // 'redirtest/six.php' => 'redirtest/three.php',
  39. );
  40. array_walk($tests, 'doRedirTest');
  41. ?>