We should add a simpletest_id() in bootstrap.inc, that returns the simpletest id (if available), and thus remove those ugly regexp against HTTP_USER_AGENT.

Comments

damien tournoud’s picture

Status: Active » Needs review
StatusFileSize
new10.8 KB

This implements simpletest_id() and fix two small things:

- the file directory should use the not prefixed id
- a typo

damien tournoud’s picture

StatusFileSize
new11.14 KB

c9606571 noted that the installer was broken and that double prefixing could happen in tearDown().

New version up for review.

damien tournoud’s picture

StatusFileSize
new11.17 KB

Fixed code comments and removed the unused parameter for simpletest_id(), following c9606571 review on IRC.

damien tournoud’s picture

Status: Needs review » Needs work

Some tests fails with this.

Badfully, we will have to make simpletest_id() to work also in the testing site. Back to the drawing board.

boombatower’s picture

The files directory should most definitely use the database prefix for the same reasons the database does. Since tests can run concurrently through shell script and such it needs the prefix.

damien tournoud’s picture

Status: Needs work » Needs review
StatusFileSize
new10.82 KB

@boombatower: I reverted back the file directory to the old behavior. Note anyway that we now add the main database prefix just to make the "clean environment" feature work correctly, not because of potential conflicts (which should not happen because the prefix is random enough).

Also:

- moved the detection of HTTP_USER_AGENT out of the database layer and in conf_init(), where it makes sense.
- cleanup the simpletest test :)

Status: Needs review » Needs work

The last submitted patch failed testing.

boombatower’s picture

Status: Needs review » Needs work

The last submitted patch failed testing.

damien tournoud’s picture

Status: Needs work » Needs review
StatusFileSize
new10.8 KB

Rerolled without significant changes.

damien tournoud’s picture

StatusFileSize
new10.82 KB

Moved the core of the user agent detection to conf_init(), in order to simplify the logic in simpletest_id, which is now a simple get/set function.

damien tournoud’s picture

StatusFileSize
new10.89 KB

Following chx' review on the IRC:

- renamed inTestingSite() to inChildSite() which is clearer and reworked comments
- remove a redundant new line

As a summary, this patch aims to remove the multiple regexps on HTTP_USER_AGENT or $db_prefix that were all over core, in the benefit of a simpler and clearer simpletest_id() function. It's a building block above which we will be able to implement #195416: Table prefixes should be per database connection, and that will, later, allow us to speed-up simpletest by simply duplicating a pre-installed Drupal instance, instead of rebuilding it at each test run.

damien tournoud’s picture

Title: Implement a simpletest_id() function » Get rid of ugly simpletest regexp.
StatusFileSize
new11.23 KB

Finally, a simpletest_id() function was not enough, so I added a small static DrupalTestRunInfo class.

Status: Needs review » Needs work

The last submitted patch failed testing.

c960657’s picture

With the patch in #13, $db_prefix is modified before settings.php is included AFAICT. If settings.php sets $db_prefix, the prefix will get overwritten. So I think this should be moved a bit down in the bootstrap process.

damien tournoud’s picture

@c960657: $db_prefix is set at the bottom of conf_init(), after the settings.php file has been included.

c960657’s picture

D'oh. Sorry :-(

boombatower’s picture

Status: Needs work » Closed (duplicate)