Skip to content

Commit

Permalink
Revert "Organizes the php scripts used for testing better, so that th…
Browse files Browse the repository at this point in the history
…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 b7ece8c
Show file tree
Hide file tree
Showing 38 changed files with 1,301 additions and 828 deletions.
6 changes: 1 addition & 5 deletions test/.jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
43 changes: 0 additions & 43 deletions test/data/ajax/echo/index.php

This file was deleted.

30 changes: 0 additions & 30 deletions test/data/ajax/headers/cache/index.php

This file was deleted.

12 changes: 0 additions & 12 deletions test/data/ajax/headers/request/index.php

This file was deleted.

5 changes: 0 additions & 5 deletions test/data/ajax/headers/response/index.php

This file was deleted.

4 changes: 4 additions & 0 deletions test/data/atom+xml.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php header("Content-type: atom+xml") ?>
<root>
<element />
</root>
1 change: 1 addition & 0 deletions test/data/badcall.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
undefined();
1 change: 1 addition & 0 deletions test/data/badjson.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{bad: toTheBone}
10 changes: 10 additions & 0 deletions test/data/cleanScript.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<script>
<!--
ok( true, "script within html comments executed" );
-->
</script>
<script>
<![CDATA[
ok( true, "script within CDATA executed" );
]]>
</script>
11 changes: 11 additions & 0 deletions test/data/dashboard.xml
Original file line number Diff line number Diff line change
@@ -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>
1 change: 1 addition & 0 deletions test/data/echoData.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php echo file_get_contents('php://input'); ?>
1 change: 1 addition & 0 deletions test/data/echoQuery.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php echo $_SERVER['QUERY_STRING']; ?>
5 changes: 5 additions & 0 deletions test/data/errorWithText.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

header("HTTP/1.0 400 Bad Request");

echo "plain text message";
21 changes: 21 additions & 0 deletions test/data/etag.php
Original file line number Diff line number Diff line change
@@ -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";
}

?>
1 change: 1 addition & 0 deletions test/data/evalScript.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ok( "<?php echo $_SERVER['REQUEST_METHOD'] ?>" === "GET", "request method is <?php echo $_SERVER['REQUEST_METHOD'] ?>" );
18 changes: 18 additions & 0 deletions test/data/headers.php
Original file line number Diff line number Diff line change
@@ -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";
}
20 changes: 20 additions & 0 deletions test/data/if_modified_since.php
Original file line number Diff line number Diff line change
@@ -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";
}

?>
13 changes: 13 additions & 0 deletions test/data/json.php
Original file line number Diff line number Diff line change
@@ -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} }';
}
?>
1 change: 1 addition & 0 deletions test/data/json_obj.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "data": {"lang": "en", "length": 25} }
14 changes: 14 additions & 0 deletions test/data/jsonp.php
Original file line number Diff line number Diff line change
@@ -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} })';
}
?>
1 change: 1 addition & 0 deletions test/data/name.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ERROR <script type="text/javascript">ok( true, "name.html retrieved" );</script>
24 changes: 24 additions & 0 deletions test/data/name.php
Original file line number Diff line number Diff line change
@@ -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>';
?>
12 changes: 12 additions & 0 deletions test/data/params_html.php
Original file line number Diff line number Diff line change
@@ -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>
11 changes: 11 additions & 0 deletions test/data/script.php
Original file line number Diff line number Diff line change
@@ -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." );
5 changes: 5 additions & 0 deletions test/data/statusText.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

header( "HTTP/1.0 $_GET[status] $_GET[text]" );

?>
7 changes: 7 additions & 0 deletions test/data/test.html
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions test/data/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var testBar = "bar";
jQuery('#ap').html('bar');
ok( true, "test.js executed");
7 changes: 7 additions & 0 deletions test/data/test.php
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions test/data/test2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script type="text/javascript">
var testFoo = "foo";
jQuery('#foo').html('foo');
ok( true, "test2.html executed" );
</script>
3 changes: 3 additions & 0 deletions test/data/test3.html
Original file line number Diff line number Diff line change
@@ -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>
Loading

0 comments on commit b7ece8c

Please sign in to comment.