Skip to content
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
jaubourg committed Dec 5, 2012
1 parent 6df2900 commit b7ece8c6206d87e71145d1aeefc984e1649af06a
@@ -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,

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

@@ -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";
@@ -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'] ?>" );
@@ -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";
}

?>
@@ -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} }
@@ -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} })';
}
?>
@@ -0,0 +1 @@
ERROR <script type="text/javascript">ok( true, "name.html retrieved" );</script>
@@ -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>
@@ -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]" );

?>
@@ -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
@@ -0,0 +1,3 @@
var testBar = "bar";
jQuery('#ap').html('bar');
ok( true, "test.js executed");
@@ -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>

0 comments on commit b7ece8c

Please sign in to comment.
You can’t perform that action at this time.