Here is a patch to upgrade Simpletest to 5.x. Now makes use of 5.x version of FAPI.
Still TO DO:
work on Simpletest results to display inside of a themed page - currently being displayed on their own page.
Upgrade tests to actually test Drupal 5.x. Several tests still test only version 4.6 (testing old style forms).
place simpletest in appropriate place in the new administer menu structure.
These can be opened as seperate issues.
I'm also including one updated test that will pass on Drupal 5.x.
andre
| Comment | File | Size | Author |
|---|---|---|---|
| #25 | simpletest_drupal5_2.patch | 8.59 KB | Souvent22 |
| #24 | upload_tests.patch | 6.52 KB | Rok Žlender |
| #23 | simpletest.d5.patch | 1.63 KB | Rok Žlender |
| #19 | simpletest_drupal5_1.patch | 30.07 KB | Souvent22 |
| #18 | simpletest_drupal5_0.patch | 30.02 KB | Souvent22 |
Comments
Comment #1
coupet commentedgreat! we need this.
Comment #2
andremolnar commentedA little CVS mixup on my end. This to patch against head.
I have commented out the calls to DrupalReporter and defaulting back to the simpletest reporting since the drupal reporer isn't producing output at this point. This is certainly a 'to do' to have the report wrapped in a themed page.
Once again, upgrading the module to use Drupal 5.x FAPI and including two patched tests. Also including proper .info file.
andre
Comment #3
Thomas Ilsche commentedI will try to get the drupal_reporter working again. However in the meantime for the HTMLReporter it is necesary to uncomment the " exit;" in function, otherwise it will fail to display output under certain buffering circumstances.
Comment #4
Thomas Ilsche commentedI have fixed simpletest.module to work with drupal_reporter again. Added default radio selection.
This is based on andres patch. I can also just commit it as initial 5.0 branch (if i can get to know how I do this with CVS)
Comment #5
Thomas Ilsche commentedP.S.: my last patch does not include info / tests, just simpletest.module
Comment #6
andremolnar commentedThomas - couldn't apply your patch - but i applied by hand so i can test - your patch includes a call to an undefined function... simpletest_running_output($output); Was there supposed to be more to this patch?
andre
Comment #7
andremolnar commentedugggg.... never mind - that's why you never patch by hand ;-) missed your added function...
Got this working Reporting looks better.
Though I might suggest the default test option is 'run selected tests' instead of 'all'.
I'm going to start using this as my base - and try to patch the test files as best I can.
andre
Comment #8
Thomas Ilsche commentedSure, default option selected might be more useful. Change it at will :)
Comment #9
mfbHi, what's the current status of the simpletest module for drupal 5.x?
I was hoping to get it going and add some tests for some contrib modules..
Comment #10
Rok Žlender commentedHi guys
I have joined all of the patches in this issue and added some of my code that fixes some tests. I still havent solved "[login] found name:" fail that happens in some test cases. Do any of you get this error?
I think after this problem is solved we can create a 5.0 release.
Comment #11
hadsie commentedI've been looking into the "[login] found name:" bug and I'm pretty sure it's cookie/session related.
One place I'm getting this error is when the page_creation.test calls the 'drupalLoginUser()' method. The page_view.test also calls drupalLoginUser() but doesn't fail. page_view has the line:
$html = $this->get(url("node/$node->nid/edit", NULL, NULL, TRUE));
If you follow this function, it sets up a connection and a cookie. There's nothing like this being done in page_creation prior to calling drupalLoginUser(). I tried hacking in some basic code that just sets up a cookie (using the simpletest code) and it seems to be working. But I'm definitely not doing this the Right Way.
Hopefully this helps a bit.
Comment #12
hadsie commentedTo add to this... adding something like:
$this->setCookie('PHPSESSID', 'randomcookievalue');
Seems to make this error go away. I'm not really sure where to go from here though.
Comment #13
Souvent22 commentedUpdated patch. Could we perhaps get a Drupal-5-dev branch since 6 is in development, would help make the trees a bit more clearer.
Comment #14
Souvent22 commentedNote: This patch also adds/fixes the following:
- Uses assertText instead of assertWantedText as the latter is now deprecated
- Adds the "HTTP-Auth" setting which allows one to get HTTP-Auth settings incase their evnrioment is behind a simple http-auth
- Fixes a lot of the taxonomy nodeapi issues in the taxonomy nodeapi test
- Fixes the user login test as the assertion was wrong, thus always Failing
Comment #15
Souvent22 commentedSorry, almost forgot,
in the taxonomy nodeapi test, the user_access vars were totally wrong.
They were like "create stories", etc.
This patch changes them to:
$perm = array('access content', 'create story content', 'edit story content');As they should be for D5
Comment #16
Rok Žlender commentedI did a quick review of your patch:
- version in info files is no longer needed http://drupal.org/node/152819
- settings menu should get "Simpletest settings" title
- I don't understand why did you change assertion in drupalLoginUser function to assertEqual($user->name, $user->name as I see it this will always be true because you compare variable to it self. The way it was before it checked if user was successfully logged in by looking for user name on loaded page. There are some problems probably with simpletest internal browser as hadsie discovered in #10 and #11
OK so maybe it would be better to split this patch. One part would fix simpletest module core and the other tests. Also as Souvent22 suggested we should create D5 dev branch.
Comment #17
moshe weitzman commentedthanks for working on this, everyone ... we'll create a drupal-5 branch once ths patch lands and all tests are fixed.
Comment #18
Souvent22 commentedALL tests run green with this latest patch. there are a LARGE number of fixes in this patch, i shall biefley list them here:
- fixed drupalModuleEnable, was not rebuilding module cache
- all gets now run trhoguh drupalGet
- multi-select form items are now handled correctly, they were handled wrong before
- removed depricated functions (e.g. assertWatnedText is now assertText, etc.)
- removed bad information msg check
I believe after this patch, its brancahble to a 5.0 dev tree (still in dev though, not stable of course).
Comment #19
Souvent22 commentedUpdated patch. Does a check for edit_multi variable to fix a warning
Comment #20
Rok Žlender commentedI've commited patch #19 to HEAD great work Souvent22 especially with taxonomy tests.
I made some slight modifications.
$this->setCookie('PHPSESSID', 'randomcookievalue');if you put this in loginUser function in drupal_test_case it solves the problem.I will not mark this as fixed until we find a solution to this problem.
Comment #21
Souvent22 commentedah, i forgot to bring my code over from another function to the drupalLoginFunction. i'll update that and patch. here's what i did in my payflow tests that i didn't port over:
Basically, after logging in, when we go to the /user page, the username will be displayed on the page, if it was a bad login, then the username will not be shown, thus failed. i think this is a valid solution. Thoughts?
Comment #22
Souvent22 commentedNote: Also, i don't like the idea of arbitrarily setting the cookie, as this by-passes the drupal/php session/user interaction; we want to be sure that is working also, so i'd rather get the cookie/session_id from drupal or some other means rather than arbitrarily setting it.
Comment #23
Rok Žlender commentedOK I've committed fix to login problem. The patch I committed is attached. Now all tests are green.
Comment #24
Rok Žlender commentedOne more thing.
Upload_tests.test used its own loginUser function this patch fixes this. I think when this one goes in we can branch to DRUPAL-5.
Comment #25
Souvent22 commentedUpload patch attached, should fix it, all green
Comment #26
Rok Žlender commentedCommitted to HEAD.
Souvent22 your patch did not clean up all unneeded functions so I committed patch under #24
Moshe I think now its time to create a Drupal 5 branch.
Comment #27
moshe weitzman commentedtagged, and release node created.
Comment #28
(not verified) commented