Permalink
Browse files

Revert "Organizes the php scripts used for testing better, so that th…

…e whole logic of a unit, server-side and client-side, is contained within the unit itself. Nearly all ajax unit tests take advantage of the new 'framework'. Lots of files got deleted because they became redundant or weren't used anymore."

This reverts commit 228ab3d.
  • Loading branch information...
1 parent 6df2900 commit b7ece8c6206d87e71145d1aeefc984e1649af06a @jaubourg jaubourg committed Dec 5, 2012
View
@@ -41,15 +41,11 @@
"ajaxTest": true,
"testIframe": true,
"testIframeWithCallback": true,
- "createComplexHTML": true,
"createDashboardXML": true,
- "createWithFriesXML": true,
"createXMLFragment": true,
"moduleTeardown": true,
- "testBar": true,
"testFoo": true,
- "url": true,
- "service": true,
+ "url": true,
"t": true,
"q": true,
"amdDefined": true,
@@ -1,43 +0,0 @@
-<?php
-
- $requestArray = "REQUEST";
-
- if ( isset( $_REQUEST["requestArray"] ) ) {
- $requestArray = $_REQUEST["requestArray"];
- }
-
- $requestArray =& ${"_$requestArray"};
-
- $response = array(
- "status" => "200",
- "statusText" => "",
- "contentType" => "text/plain",
- "content" => "",
- "callback" => "",
- "delay" => 0
- );
-
- foreach( $response as $field => &$value ) {
- if ( isset( $requestArray[ $field ] ) ) {
- $value = $requestArray[ $field ];
- }
- }
-
- if ( is_array( $response["content"] ) ) {
- $response["content"] = http_build_query( $response["content"] );
- }
-
- if ( !$response["callback"] && preg_match( '/index.php\/([^\/\?&]+)/', $_SERVER["REQUEST_URI"], $match ) ) {
- $response["callback"] = $match[ 1 ];
- }
-
- header("HTTP/1.1 $response[status] $response[statusText]");
- header("Content-Type: $response[contentType]");
-
- if ( $response["delay"] ) {
- sleep( $response["delay"] );
- }
-
- echo $response["callback"]
- ? "$response[callback](" . json_encode("$response[content]") . ");"
- : "$response[content]";
@@ -1,30 +0,0 @@
-<?php
-$headers = array(
-
- "If-Modified-Since" => array(
- "request" => "HTTP_IF_MODIFIED_SINCE",
- "response" => "Last-Modified",
- ),
- "If-None-Match" => array(
- "request" => "HTTP_IF_NONE_MATCH",
- "response" => "Etag",
- ),
-
-);
-
-$header = $_REQUEST["header"];
-$value = $_REQUEST["value"];
-
-if ( $header === "If-None-Match" ) {
- $value = md5( $value );
-}
-
-$headers = $headers[ $header ];
-
-$requestHeader = isset( $_SERVER[ $headers["request"] ] ) ? stripslashes($_SERVER[ $headers["request"] ]) : false;
-if ( $requestHeader === $value ) {
- header("HTTP/1.0 304 Not Modified");
-} else {
- header("$headers[response]: $value");
- echo $requestHeader ? "OK: $value": "FAIL";
-}
@@ -1,12 +0,0 @@
-<?php
-
-$headers = array();
-
-foreach( $_SERVER as $key => $value ) {
- $key = str_replace( "_" , "-" , substr($key,0,5) == "HTTP_" ? substr($key,5) : $key );
- $headers[ $key ] = $value;
-}
-
-foreach( explode( "," , $_GET["headers"] ) as $key ) {
- echo "$key: " . @$headers[ strtoupper( $key ) ] . "\n";
-}
@@ -1,5 +0,0 @@
-<?php
-
-foreach( $_REQUEST as $header => $value ) {
- @header("$header: $value");
-}
@@ -0,0 +1,4 @@
+<?php header("Content-type: atom+xml") ?>
+<root>
+ <element />
+</root>
@@ -0,0 +1 @@
+undefined();
@@ -0,0 +1 @@
+{bad: toTheBone}
@@ -0,0 +1,10 @@
+<script>
+<!--
+ok( true, "script within html comments executed" );
+-->
+</script>
+<script>
+<![CDATA[
+ok( true, "script within CDATA executed" );
+]]>
+</script>
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<dashboard>
+ <locations class="foo">
+ <location for="bar" checked="different">
+ <infowindowtab>
+ <tab title="Location"><![CDATA[blabla]]></tab>
+ <tab title="Users"><![CDATA[blublu]]></tab>
+ </infowindowtab>
+ </location>
+ </locations>
+</dashboard>
@@ -0,0 +1 @@
+<?php echo file_get_contents('php://input'); ?>
@@ -0,0 +1 @@
+<?php echo $_SERVER['QUERY_STRING']; ?>
@@ -0,0 +1,5 @@
+<?php
+
+header("HTTP/1.0 400 Bad Request");
+
+echo "plain text message";
View
@@ -0,0 +1,21 @@
+<?php
+error_reporting(0);
+
+$ts = $_REQUEST['ts'];
+$etag = md5($ts);
+
+$ifNoneMatch = isset($_SERVER['HTTP_IF_NONE_MATCH']) ? stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) : false;
+if ($ifNoneMatch == $etag) {
+ header('HTTP/1.0 304 Not Modified');
+ die; // stop processing
+}
+
+header("Etag: " . $etag);
+
+if ( $ifNoneMatch ) {
+ echo "OK: " . $etag;
+} else {
+ echo "FAIL";
+}
+
+?>
@@ -0,0 +1 @@
+ok( "<?php echo $_SERVER['REQUEST_METHOD'] ?>" === "GET", "request method is <?php echo $_SERVER['REQUEST_METHOD'] ?>" );
View
@@ -0,0 +1,18 @@
+<?php
+
+header( "Sample-Header: Hello World" );
+header( "Empty-Header: " );
+header( "Sample-Header2: Hello World 2" );
+
+$headers = array();
+
+foreach( $_SERVER as $key => $value ) {
+
+ $key = str_replace( "_" , "-" , substr( $key , 0 , 5 ) == "HTTP_" ? substr( $key , 5 ) : $key );
+ $headers[ $key ] = $value;
+
+}
+
+foreach( explode( "_" , $_GET[ "keys" ] ) as $key ) {
+ echo "$key: " . @$headers[ strtoupper( $key ) ] . "\n";
+}
@@ -0,0 +1,20 @@
+<?php
+error_reporting(0);
+
+$ts = $_REQUEST['ts'];
+
+$ifModifiedSince = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? stripslashes($_SERVER['HTTP_IF_MODIFIED_SINCE']) : false;
+if ($ifModifiedSince == $ts) {
+ header('HTTP/1.0 304 Not Modified');
+ die; // stop processing
+}
+
+header("Last-Modified: " . $ts);
+
+if ( $ifModifiedSince ) {
+ echo "OK: " . $ts;
+} else {
+ echo "FAIL";
+}
+
+?>
View
@@ -0,0 +1,13 @@
+<?php
+error_reporting(0);
+if ( $_REQUEST['header'] ) {
+ header("Content-type: application/json");
+}
+
+$json = $_REQUEST['json'];
+if($json) {
+ echo '[ {"name": "John", "age": 21}, {"name": "Peter", "age": 25 } ]';
+} else {
+ echo '{ "data": {"lang": "en", "length": 25} }';
+}
+?>
@@ -0,0 +1 @@
+{ "data": {"lang": "en", "length": 25} }
View
@@ -0,0 +1,14 @@
+<?php
+error_reporting(0);
+$callback = $_REQUEST['callback'];
+if ( ! $callback ) {
+ $callback = explode("?",end(explode("/",$_SERVER['REQUEST_URI'])));
+ $callback = $callback[0];
+}
+$json = $_REQUEST['json'];
+if($json) {
+ echo $callback . '([ {"name": "John", "age": 21}, {"name": "Peter", "age": 25 } ])';
+} else {
+ echo $callback . '({ "data": {"lang": "en", "length": 25} })';
+}
+?>
View
@@ -0,0 +1 @@
+ERROR <script type="text/javascript">ok( true, "name.html retrieved" );</script>
View
@@ -0,0 +1,24 @@
+<?php
+error_reporting(0);
+$wait = $_REQUEST['wait'];
+if($wait) {
+ sleep($wait);
+}
+$xml = $_REQUEST['xml'];
+if($xml) {
+ header("Content-type: text/xml");
+ $result = ($xml == "5-2") ? "3" : "?";
+ echo "<math><calculation>$xml</calculation><result>$result</result></math>";
+ die();
+}
+$name = $_REQUEST['name'];
+if($name == 'foo') {
+ echo "bar";
+ die();
+} else if($name == 'peter') {
+ echo "pan";
+ die();
+}
+
+echo 'ERROR <script type="text/javascript">ok( true, "name.php executed" );</script>';
+?>
@@ -0,0 +1,12 @@
+<div id="post">
+<?php
+ foreach( $_POST as $key=>$value )
+ echo "<b id='$key'>$value</b>";
+?>
+</div>
+<div id="get">
+<?php
+ foreach( $_GET as $key=>$value )
+ echo "<b id='$key'>$value</b>";
+?>
+</div>
View
@@ -0,0 +1,11 @@
+<?php
+error_reporting(0);
+if ( $_REQUEST['header'] ) {
+ if ( $_REQUEST['header'] == "ecma" ) {
+ header("Content-type: application/ecmascript");
+ } else {
+ header("Content-type: text/javascript");
+ }
+}
+?>
+ok( true, "Script executed correctly." );
@@ -0,0 +1,5 @@
+<?php
+
+header( "HTTP/1.0 $_GET[status] $_GET[text]" );
+
+?>
View
@@ -0,0 +1,7 @@
+html text<br/>
+<script type="text/javascript">/* <![CDATA[ */
+testFoo = "foo"; jQuery('#foo').html('foo');
+ok( true, "test.html executed" );
+/* ]]> */</script>
+<script src="data/test.js"></script>
+blabla
View
@@ -0,0 +1,3 @@
+var testBar = "bar";
+jQuery('#ap').html('bar');
+ok( true, "test.js executed");
View
@@ -0,0 +1,7 @@
+html text<br/>
+<script type="text/javascript">/* <![CDATA[ */
+testFoo = "foo"; jQuery('#foo').html('foo');
+ok( true, "test.php executed" );
+/* ]]> */</script>
+<script src="data/test.js?<?php srand(); echo time() . '' . rand(); ?>"></script>
+blabla
@@ -0,0 +1,5 @@
+<script type="text/javascript">
+var testFoo = "foo";
+jQuery('#foo').html('foo');
+ok( true, "test2.html executed" );
+</script>
@@ -0,0 +1,3 @@
+<div class="user">This is a user</div>
+<div class="user">This is a user</div>
+<div class="teacher">This is a teacher</div>
Oops, something went wrong.

0 comments on commit b7ece8c

Please sign in to comment.