Commit 7226cf28 authored by Mike Sherov's avatar Mike Sherov Committed by Dave Methvin

fixes #10901, PHP required for unit tests, but still allow the tests to run

parent 6c2b64df
...@@ -69,8 +69,13 @@ die(); ...@@ -69,8 +69,13 @@ die();
?> ?>
*/ */
hasPHP = false;
// javascript fallback using src files in case this is not run on a PHP server! // javascript fallback using src files in case this is not run on a PHP server!
var files = [ // please note that this fallback is for convenience only, and is not fully supported
// i.e. don't expect all of the tests to work properly
var baseURL = document.location.href.replace( /\/test\/.+/, "/"),
files = [
"core", "core",
"callbacks", "callbacks",
"deferred", "deferred",
...@@ -97,5 +102,5 @@ var files = [ ...@@ -97,5 +102,5 @@ var files = [
i = 0; i = 0;
for ( ; i < len; i++ ) { for ( ; i < len; i++ ) {
document.write("<script src=\"../src/" + files[ i ] + ".js\"><"+"/script>"); document.write("<script src=\"" + baseURL + "src/" + files[ i ] + ".js\"><"+"/script>");
} }
\ No newline at end of file
...@@ -2,6 +2,7 @@ var jQuery = this.jQuery || "jQuery", // For testing .noConflict() ...@@ -2,6 +2,7 @@ var jQuery = this.jQuery || "jQuery", // For testing .noConflict()
$ = this.$ || "$", $ = this.$ || "$",
originaljQuery = jQuery, originaljQuery = jQuery,
original$ = $, original$ = $,
hasPHP = true,
amdDefined; amdDefined;
/** /**
...@@ -117,5 +118,5 @@ function url(value) { ...@@ -117,5 +118,5 @@ function url(value) {
equal( jQuery.active, 0, "No AJAX requests are still active" ); equal( jQuery.active, 0, "No AJAX requests are still active" );
oldActive = jQuery.active; oldActive = jQuery.active;
} }
} };
}()); }());
\ No newline at end of file
module("ajax", { teardown: moduleTeardown }); module("ajax", { teardown: moduleTeardown });
// Safari 3 randomly crashes when running these tests, if ( !isLocal || hasPHP) {
// but only in the full suite - you can run just the Ajax
// tests and they'll pass
//if ( !jQuery.browser.safari ) {
if ( !isLocal ) {
test("jQuery.ajax() - success callbacks", function() { test("jQuery.ajax() - success callbacks", function() {
expect( 8 ); expect( 8 );
...@@ -2331,6 +2326,4 @@ test("jQuery.ajax - active counter", function() { ...@@ -2331,6 +2326,4 @@ test("jQuery.ajax - active counter", function() {
ok( jQuery.active == 0, "ajax active counter should be zero: " + jQuery.active ); ok( jQuery.active == 0, "ajax active counter should be zero: " + jQuery.active );
}); });
} }
\ No newline at end of file
//}
module("core", { teardown: moduleTeardown }); module("core", { teardown: moduleTeardown });
test("Unit Testing Environment", function () {
expect(2);
ok( hasPHP, "Running Unit tests without PHP is unsupported! The AJAX tests won't run without it and don't expect all tests to pass without it!" );
ok( !isLocal, "Unit tests shouldn't be run from file://, especially in Chrome. If you must test from file:// with Chrome, run it with the --allow-file-access-from-files flag!" );
});
test("Basic requirements", function() { test("Basic requirements", function() {
expect(7); expect(7);
ok( Array.prototype.push, "Array.push()" ); ok( Array.prototype.push, "Array.push()" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment