controller.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php
  2. header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );
  3. header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
  4. header( 'Cache-Control: no-store, no-cache, must-revalidate' );
  5. header( 'Cache-Control: post-check=0, pre-check=0', false );
  6. header( 'Pragma: no-cache' );
  7. ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  8. "http://www.w3.org/TR/html4/strict.dtd">
  9. <html>
  10. <head>
  11. <meta http-equiv="Content-type" content="text/html; charset=utf-8">
  12. <title>DataTables unit test controller</title>
  13. <style type="text/css" media="screen">
  14. #controller {
  15. font: 12px/1.45em "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
  16. margin: 0;
  17. padding: 0 0 0 0.5em;
  18. color: #333;
  19. background-color: #fff;
  20. }
  21. #test_info {
  22. position: absolute;
  23. top: 0;
  24. right: 0;
  25. width: 50%;
  26. height: 100%;
  27. font-size: 11px;
  28. overflow: auto;
  29. }
  30. .error {
  31. color: red;
  32. }
  33. #controller h1 {
  34. color: #4E6CA3;
  35. font-size: 18px;
  36. }
  37. </style>
  38. <script type="text/javascript" language="javascript" src="../js/jquery.js"></script>
  39. <script type="text/javascript" charset="utf-8">
  40. var gaoTest = [
  41. <?php
  42. function fnReadDir( &$aReturn, $path )
  43. {
  44. $rDir = opendir( $path );
  45. while ( ($file = readdir($rDir)) !== false )
  46. {
  47. if ( $file == "." || $file == ".." || $file == ".DS_Store" )
  48. {
  49. continue;
  50. }
  51. else if ( is_dir( $path.'/'.$file ) )
  52. {
  53. fnReadDir( $aReturn, $path.'/'.$file );
  54. }
  55. else
  56. {
  57. array_push( $aReturn, $path.'/'.$file );
  58. }
  59. }
  60. closedir($rDir);
  61. }
  62. /* Get the tests dynamically from the 'tests' directory, and their templates */
  63. $aFiles = array();
  64. fnReadDir( $aFiles, "tests" );
  65. for ( $i=0 ; $i<count($aFiles) ; $i++ )
  66. {
  67. $sTemplate;
  68. $fp = fopen( $aFiles[$i], "r" );
  69. fscanf( $fp, "// DATA_TEMPLATE: %s", $sTemplate );
  70. fclose( $fp );
  71. $aPath = explode('/', $aFiles[$i]);
  72. echo '{ '.
  73. '"sTemplate": "'.$sTemplate.'", '.
  74. '"sTest": "'.$aFiles[$i].'", '.
  75. '"sGroup": "'.$aPath[1].'"},'."\n";
  76. }
  77. ?>
  78. null ];
  79. gaoTest.pop(); /* No interest in the null */
  80. </script>
  81. <script type="text/javascript" language="javascript" src="controller.js"></script>
  82. </head>
  83. <body id="controller">
  84. <h1>DataTables unit testing</h1>
  85. <div id="test_running">Running test: <span id="test_number"></span></div>
  86. <div id="test_info">
  87. <b>Test information:</b><br>
  88. </div>
  89. </body>
  90. </html>