This patch uses the curl, dom and simplexml extensions. I have compatibility.php, dumper.php, exceptions.php, invoker.php, reporter.php simpletest.php, unit_tester.php, xml.php, default_reporter.php, errors.php, expectation.php, reflection_php5.php, scorer.php, test_case.php and VERSION in my simpletest dir and it works. A some of the code now comes from UnitTestCase instead of reimplementing. The Drupal interface did not change -- if you used $this->_browser , well, that's not good.

Comments

chx’s picture

FileSize
81.35 KB

There was a setbrowser call in user tests. That's trivial to reimplement.

boombatower’s picture

This needs be rerolled.

chx’s picture

FileSize
61.55 KB

Here it is. Much smaller... lots of whitespace changes not included.

pwolanin’s picture

Status: Needs review » Needs work

ok, so from chx, the easiest way to setup to test this is to move the Soureforge version to somewhere else and just copy the files listed at the top to simpletest/simpletest

After fixing the .info file (note error in patch 7.x->6.x) A quick check on 7.x (HEAD) is functional; however, problems with the poll module tests (the only ones I ran):

51 passes, 16 fails and 0 exceptions.

even after adding $this->elements = FALSE; to curlExec in drupal_test_case.php as suggested by chx

Dries’s picture

Not sure where I can provide feedback on the changes necessary to get simpletest, or a deriviate thereof, in core. One of the small things that annoy me is the desc field used in the get_info hook. For consistency with core, that should be called description instead of desc.

Edit: opened a separate issue at http://drupal.org/node/235013 . [chx]

chx’s picture

Status: Needs work » Needs review
FileSize
63.04 KB

poll now passes thanks to a generic fix in handleForm of SELECT elements.

chx’s picture

FileSize
63.2 KB

Now it handles forms without a selected option. Added a TODO "handle multiple selected in a multiple SELECT" -- I will deal with that later (much later. very low priority).

chx’s picture

FileSize
63.21 KB

Now it handles when the value and the displayed label of an option to be changed are different. This one was easy... Edit: $edit[$name] == $option was changed to $edit[$name] == $option['value'] which is better in code understanding too because the former contained an implicit string cast.

chx’s picture

FileSize
75.7 KB

This version goes over all the tests with a number of failures yes but no PHP fatals.

chx’s picture

FileSize
75.88 KB

This one improves on checkbox and radio handling so filter tests pass. there are a few failures still, with node tests, working on that, too. checkbox could be more elegant.

chx’s picture

FileSize
81.77 KB

Lots of fixes. filter, node, comments, block pass... locale has 1 failure, poll and book has more... but still, we are a lot better. biggest change change is that multiple forms on one page are now actually working thanks to adding a few dots to the handleForm xpath.

chx’s picture

FileSize
82.24 KB

Meh, I could not go to sleep before poll was fixed -- curious that it broke 'cos it was poll test that was broken.

boombatower’s picture

Possibly change the message in the handleForm function.

You tried to change a !type select to !edit and that's not allowed.

to

You tried to change a !type to !edit and that's not allowed.

Example:

You tried to change a textarea to somevalue and that's not allowed.

Obviously nothing big.

Other small thing: the patch change the info file core to 6.x. Technically this will all be committed to HEAD (7.x).

Other than that it is looking nice.

From the looks of the patch it appears you are fixing general things as well. Just trying to keep it straight for record.

pwolanin’s picture

Status: Needs review » Needs work

patch fails on simpletest HEAD checkout

patching file tests/functional/node.test
Hunk #1 FAILED at 7.
Hunk #3 FAILED at 116.
Hunk #5 FAILED at 263.
3 out of 8 hunks FAILED -- saving rejects to file tests/functional/node.test.rej
patching file tests/functional/poll.test
Hunk #2 FAILED at 40.
Hunk #3 succeeded at 65 with fuzz 2.
1 out of 3 hunks FAILED -- saving rejects to file tests/functional/poll.test.rej
chx’s picture

Status: Needs work » Needs review
FileSize
96.97 KB

This one has most tests pass due to much better form handling. Profile has a few failures but... is a form a field? I do not think so. Poll tests, quite interestingly tends to break utterly if not run alone -- this has nothing to do with my changes, I would like to think 'cos even the theming of bars fail... when run alone, they pass. User registration also has failures I am studying those but I wanted to have this out.

chx’s picture

FileSize
97.16 KB

Well, user had a broken drupalGet and my code had no form action handling. Both are fixed, here.

chx’s picture

Note that though contact has two fails that is a core bug and not my code here.

chx’s picture

FileSize
103.66 KB

And now, translations pass as we now deal with the case when form actions contain queries. And, thanks to code reuse this makes clickLink works in the same case.

boombatower’s picture

Status: Needs review » Needs work

When I run any tests that uses a form (which should be all of them) it generates the following exception many times.

Unexpected PHP error [Undefined variable: handled] severity [E_NOTICE] in [/home/jimmy/software/php/simpletest/drupal_test_case.php line 588]

Code:

588: if (!isset($post[$name]) && !$handled) {

I'm going to guess that $handled needed to be initialized, but it doesn't appear that $handled is used in the code anymore. Possibly just left over?

Tests run fine without it:

588: if (!isset($post[$name])) {
boombatower’s picture

Status: Needs work » Fixed

I made the change above and committed.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.