annotate DataTables-1.9.4/media/unit_testing/controller.php @ 0:ac5f9272033b draft

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