It's been really bugging me that the SimpleTest from D6 and D7 are so out of sync now, and I wanted to see if I could backport them.

I removed all the commented out lines because it makes the code really hard to read, and I use a visual two-way diff between D6 and D7 modules and it's way easier to see the actual differences in the files. And why are there a bunch of copyrights in the top of the files??

Two new files are added in core's /includes directory rather than trying to add those new functions in the existing core files.

Also took a stab at backporting D7's class registry in #817496: Autoload via .info files which would make autoload a dependency for SimpleTest, which is not a bad thing.

Currently it's not working, but thought I'd start posting patches for initial review.

Comments

mikey_p’s picture

I'm confused, this seems to be a patch against core as well as Simpletest?

mikey_p’s picture

Nevermind, patching a patch file is as confusing as patching a patch file which is....

dave reid’s picture

Status: Active » Needs work
sun’s picture

Priority: Normal » Major

+1 Badly needed.

However, I'm mainly interested in newly introduced assertion methods and stuff. Would it be possible and would it make sense to split those "feature" changes into a separate patch?

I'm not really interested in changing the fundamental D6 implementation of SimpleTest. Also not sure whether that shouldn't require a new major version for this module.

dave reid’s picture

Yeah I've found that its going to be a very difficult effort to try and do it all at once. The first effort will probably be just to backport new assertions that don't require a wider change.

mikey_p’s picture

Priority: Major » Normal
Status: Needs work » Active

Getting

Fatal error: Call to undefined function drupal_static() in /Users/mdp/www/6/sites/all/modules/simpletest/simpletest.module on line 300

Whats your plan for this, want to backport drupal_static or patch where necessary?

I think somewhere there is a module that backports a bunch of stuff (like drupal_static) to D6. This is already likely to be dependent on Autoload for D6.

mikey_p’s picture

Priority: Normal » Major
Status: Active » Needs work

xpost

dave reid’s picture

Yep it backports the SimpleTestMissingDependencyTestCase from D7 and passes.

boombatower’s picture

Cleaned up existing issue (thus the list above) and created 6.x-2.11 so the backport will be 2.12.

andypost’s picture

This issue should be backported when commited #278425: Using basename() is not locale safe

neclimdul’s picture

StatusFileSize
new4.18 KB

Kinda tricky tracking all these in one issue but... here's the backport drupal_hmac_base64 patch. Its sort of critical because d6 simpletest is not reliable enough to use without it. Any set of tests of sufficient size will fail somewhere logging in a user or testing some form.

neclimdul’s picture

Sorry, correct format and a patch to apply over the previous core patch for testing.

dave reid’s picture

Hooray we got all of the backports to SimpleTest done, now it's just time to work on the necessary core backports.

rfay’s picture

@davereid, What ended up being the status of this?

dave reid’s picture

Status: Needs work » Needs review
StatusFileSize
new17.88 KB

We got most of the big functional backports to the testing framework itself fixed. We still have to work on functions that have changed or added in D7 and need to be backported as a part of SimpleTest's core patch.

I alos found more D7 changes to fix for now.

dave reid’s picture

StatusFileSize
new16.76 KB

Try that again.

Status: Needs review » Needs work

The last submitted patch, 890440-simpletest-backport-round2.patch, failed testing.

dave reid’s picture

Status: Needs work » Needs review
StatusFileSize
new16.5 KB
sun’s picture

+++ drupal_web_test_case.php	29 Jan 2011 17:46:22 -0000
@@ -979,7 +1042,7 @@ class DrupalWebTestCase extends DrupalTe
-    $account = user_save('', $edit);
+    $account = user_save(NULL, $edit);

Not sure whether this is correct for D6 -- did you double-check that with user_save() in detail?

+++ simpletest.module	29 Jan 2011 17:46:22 -0000
@@ -55,7 +55,6 @@ function simpletest_menu() {
     'page arguments' => array('simpletest_result_form', 4),
     'description' => 'View result of tests.',
     'access arguments' => array('administer unit tests'),
-    'type' => MENU_CALLBACK,

Did you manually run a test and verify that

1) the proper page title is displayed

2) the proper breadcrumb is displayed

?

Powered by Dreditor.

dave reid’s picture

StatusFileSize
new16.09 KB

Reverted the change to the user_save() call as by default in D6 we use the empty string. Not sure why I changed that. As for the menu callback change: when running a test result I get a title of 'Test result' and breadcrumb of "Home › Administer › Site building › Testing" which is correct.

dave reid’s picture

Status: Needs review » Needs work

Passed locally and via the test bot, so committed #22 to CVS - http://drupal.org/cvs?commit=492672

sun’s picture

Thanks for double-checking, and committing, @Dave Reid! :)

kenorb’s picture

+1

neclimdul’s picture

dave reid’s picture

"We still have to work on functions that have changed or added in D7 and need to be backported as a part of SimpleTest's core patch." Patches welcome. :)

neclimdul’s picture

I would but I get random 500 invalid header failures breaking tests. :)

Seriously though, I think it is unfortunate that we're blocking a fairly critical bug fix in favor of an amorphous "Backport everything from 7" issue. That's the only reason I bumped the issue.

dave reid’s picture

Status: Needs work » Needs review
StatusFileSize
new18.64 KB

Let's try this.

Status: Needs review » Needs work

The last submitted patch, 890440-backport-round2.patch, failed testing.

dave reid’s picture

Status: Needs work » Needs review
StatusFileSize
new26.1 KB

Getting closer.

Status: Needs review » Needs work

The last submitted patch, 890440-backport-round2.patch, failed testing.

dave reid’s picture

Status: Needs work » Needs review
StatusFileSize
new26.7 KB

And one more which should pass.

dave reid’s picture

StatusFileSize
new26.99 KB

Summary of #34:

1. Adds a 'SIMPLETEST_PATCH_VERSION' constant to bootstrap.inc rather than using the $GLOBAL variables so that we can check the versions of the core patches
2. Backports the REQUEST_TIM constant for use with drupal_generate_test_ua() and drupal_valid_test_ua().
3. Backports drupal_hmac_base64(), drupal_hash_base64(), drupal_valid_test_ua(), drupal_generate_test_ua(), and drupal_get_hash_salt() from Drupal 7 into bootstrap.inc
4. Backports latest debug() from Drupal 7 into common.inc
5. Made the core patch requirements check a runtime patch because until you try to run simpletests, you don't *actually* need the core patch.
6. Expanded the core patch requirements check to notify users with the old $GLOBAL variable to re-patch.
7. Misc backports to drupal_web_test_case.inc and simpletest.test.

Todos:
1. Backport error handling currently in common.inc.

dave reid’s picture

StatusFileSize
new44.41 KB

Attempting to include error handling backports...

kenorb’s picture

Assigned: dave reid » Unassigned
Issue summary: View changes
Status: Needs review » Closed (outdated)

Drupal 6 is no longer officially supported. If you think this issue is still relevant for 8.x, feel free to re-open.