I'm splitting this off from #319033-23: Weird order of projects listed on updates page because that patch was turning into a huge refactoring of update status tests (originally from #253501: Tests for update.module) just since that bug happened to be the first one we're trying to fix that involves testing update status's handling of contrib modules. The more I think about it, the more we need a more thorough refactoring and redesign of how update status tests work, so I want to just start a new issue for it to work on this. Then we can go back and finish off #319033 with a tiny patch to the code and to add a single new test case. I'll be working on this either later tonight or wednesday during the day, so stay tuned for a patch...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dww’s picture

Status: Active » Needs review
FileSize
33.57 KB

A) Splits out shared stuff into a UpdateTestHelper base class that's the parent for both UpdateCoreTestCase and UpdateContribTestCase

B) Adds tons of PHPDoc all over the place.

C) System info is now defined via an array keyed by module or theme name, so you can specify different initial state for each independent module or theme.

D) What to fetch is now defined via an array keyed by project name, and the values in the array indicate the latest available release (e.g. "7_1" for core (version: "7.1"), or "1_0" for contrib ("7.x-1.0" -- the 7.x is irrelevant in the filename). I didn't want to use '.' in there, so the XML files always have the form [project_name].[latest_available].xml.

E) Added a basic test for contrib functionality.

dww’s picture

Note to committers, after applying and before committing, you need:

cvs add modules/update/tests/aaa_update_test.1_0.xml
cvs add modules/update/tests/aaa_update_test.info
cvs add modules/update/tests/aaa_update_test.module
cvs add modules/update/tests/bbb_update_test.1_0.xml
cvs add modules/update/tests/bbb_update_test.info
cvs add modules/update/tests/bbb_update_test.module
cvs add modules/update/tests/ccc_update_test.1_0.xml
cvs add modules/update/tests/ccc_update_test.info
cvs add modules/update/tests/ccc_update_test.module
cvs add modules/update/tests/drupal.7_0.xml
cvs add modules/update/tests/drupal.7_1.xml
cvs add modules/update/tests/drupal.7_2-sec.xml
cvs add modules/update/tests/drupal.dev.xml
cvs rm modules/update/tests/dev-snapshot.xml
cvs rm modules/update/tests/no-updates.xml
cvs rm modules/update/tests/normal-update.xml
cvs rm modules/update/tests/security-update.xml

Note: we could also leave out the "7_" part of the core XML files. E.g. just modules/update/tests/drupal.0.xml. At least that way the filenames themselves aren't specific to this version of core, which will make it easier to update all of these tests once we make the DRUPAL-7 branch and HEAD becomes 8.x.

I was thinking about ways to make these tests easier to "port" to a new version of core, but sadly, it's sort of all about specific version numbers and comparing them. But, we can at least make the filenames themselves not care, which is a start. ;) Thoughts?

dww’s picture

I haven't been able to chat to webchick in IRC yet to confirm she agrees with the change, but Dave Reid thought my note in #2 was important, and that it'd be better long term if the filenames didn't have the version of core in them. So, here's a re-roll of #1 without the "7_" in the core XML file names. Otherwise identical. New CVS commands when you're ready to commit:

cvs add modules/update/tests/aaa_update_test.1_0.xml
cvs add modules/update/tests/aaa_update_test.info
cvs add modules/update/tests/aaa_update_test.module
cvs add modules/update/tests/bbb_update_test.1_0.xml
cvs add modules/update/tests/bbb_update_test.info
cvs add modules/update/tests/bbb_update_test.module
cvs add modules/update/tests/ccc_update_test.1_0.xml
cvs add modules/update/tests/ccc_update_test.info
cvs add modules/update/tests/ccc_update_test.module
cvs add modules/update/tests/drupal.0.xml
cvs add modules/update/tests/drupal.1.xml
cvs add modules/update/tests/drupal.2-sec.xml
cvs add modules/update/tests/drupal.dev.xml
cvs rm modules/update/tests/dev-snapshot.xml
cvs rm modules/update/tests/no-updates.xml
cvs rm modules/update/tests/normal-update.xml
cvs rm modules/update/tests/security-update.xml

Status: Needs review » Needs work

The last submitted patch failed testing.

dww’s picture

Status: Needs work » Needs review
FileSize
33.54 KB

Sorry about that. Now that core's availability scenario can be set to "0", we need isset() instead of !empty() in update_test_mock_page(). ;) Same CVS commands as in #3, this time, all the update status tests actually pass. ;)

chx’s picture

Status: Needs review » Reviewed & tested by the community

Looks better, indeed!

Dries’s picture

Committed to CVS HEAD.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD.
Let's move back to the other issue.

dww’s picture

Yay, thanks, Dries! New patch posted at #319033-25: Weird order of projects listed on updates page

Status: Fixed » Closed (fixed)

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