Closed (fixed)
Project:
SimpleTest
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Feb 2010 at 07:55 UTC
Updated:
25 Nov 2019 at 15:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dalin:P
Comment #2
dave reidSimpleTest should be run all on the same database. It takes special care to save your current db_prefix settings, changes them for testing, and then changes them back after the tests have finished? I'm not sure exactly why this is a problem?
Comment #3
dalinCurrently simpletest does this to create its table names:
However global $db_prefix is not always a string. In fact I would guess that if it's not empty then more often than not it's an array.
OR something like:
Comment #4
dave reidAgain, this is in the context of testing, not normal website operation. Are you testing CiviCRM?
Comment #5
dalinYes I'm testing CiviCRM but I think that's irrelevant. The point is that you can't concatenate an array with a string:
$foo = array('bar') . '_baz';
does not make $foo == 'bar_baz'
Comment #6
dave reidAh, I see what's going on. Seems like it might be valid.
Comment #7
agentrickardSafer perhaps to check if $db_prefix is an array and use $db_prefix['default'] in that case?
Domain Prefix has this issue, and this fix:
Comment #8
dalin@agentrickard the problem being that the 'default' key, while recommended, is not required. So in my patch I did:
Comment #9
dalinBut perhaps to better mimick what core does, we should just use '' if 'default' is missing:
Comment #10
dalinNew patch using '' if 'default' is absent.
Comment #11
agentrickardNow I wonder if I have to change my code, too. ;-p
Comment #12
moshe weitzman commentedThis is a bug in core simpletest for d7. $this->originalPrefix can be an array.
Comment #13
boombatower commentedWorks for 7.x anyway: #716394: SimpleTest prefix should override $db_prefix when assigned.
Comment #14
mysterlune commentedFollowing up on #13, there are a couple of critical lines in the "716394-db-prefix-force.patch" (for D7) file that are not in the "D6-core-simpletest.patch" file distributed with SimpleTest (6.x-2.10 nor 6.x-2.x-dev). Banged my head on the wall for quite a bit on this one, so hopefully will save a lot of trouble for some D6'ers out there who are (like me) new to SimpleTest and use an array for $db_prefix.
Summary of the change: Out of the gate, we are asked to apply the D6-core-simpletest.patch to core. In doing so, bootstrap.inc's receives updates including (~ line 1029) the following:
that, on concatenation, resolves as something like "Arraysimpletest709493". As in the D7 patch 716394-db-prefix-force.patch we need the above line to actually be the following:
The attached patch applies only this change.
The underlying assumption in rolling this patch against the (patched with D6-core-simpletest.patch) bootstrap.inc file is that folks are already running on the patched file per the distribution's INSTALL.txt
Please verify the fix does what it should.
(Brilliant module boombatower, btw. Many thanks!)
Comment #15
webchickI'm getting a bunch of these in my php_error.log:
Presumably it's a result of this same thing because I'm connecting to both Drupal and CiviCRM databases in settings.php.
However, none of the patches here works for me. :(
I noticed #710978: Domain causes major testing errors as well, and we are using Domain Access, so I'll check that one before setting this to "needs work."
Comment #16
webchickOk. My problem was Domain Access-related. Ignore me! :D
Comment #17
moshe weitzman commentedgood gosh, woman. you are using writing tests for simpletest d6 and domain access and Civicrm? And that 'variable_cache_regenerate' in the error msg looks ominous. You are a glutton for punishment.
Comment #18
webchickYes, my life has been a happy, happy place, let me tell you. ;)
Comment #19
sylvain lecoy commentedThe bug is in drupal7 as well ?
I am getting this Arraysimpletest as well because of this:
What is the status of this bug ? Should I apply the patch submitted ? Do we need to submit a patch for d7 or only for this back ported version ?
Comment #20
boombatower commentedShould be fixed.
Comment #22
dgtlmoon commentedI just lost a lot of time tracing this bug down, only that it is still part of the current stable AND current dev release. It does not look like this patch to fix the issue was applied
Comment #23
dgtlmoon commentedMarking as major because no one who uses anything than a trivial database setup can use simpletest
Comment #24
sylvain lecoy commentedI agree
Comment #25
dave reidNeeds to be re-confirmed using the lastest code.
Comment #26
dave reidComment #27
jonathan_hunt commentedI applied the patch in #10 to 6.x-2.11 and $db_prefix as an array now works for me. The release notes in 6.x-2.11 (http://drupal.org/node/935344 ) imply this issue is fixed but the patch in #10 wasn't applied.
Comment #28
bartoll commented#10: simpletest_db_prefix.diff queued for re-testing.
Comment #29
lendudeSince this was originally marked fixed, setting it back to that, since nobody complained in the intervening 8 years :)