I found this while trying to test a patch:

An error occurred.
Path: /batch?id=2&op=do
Message: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'database.simpletest360750profile_field' doesn't exist: SELECT DISTINCT(category) FROM {profile_field}; Array
(
)
in profile_user_categories() (line 495 of .../public/modules/profile/profile.module).

To reproduce:
- check out latest 7.x from CVS,
- enable all modules,
- run any test, and you should get a similar exception.

Comments

boombatower’s picture

Status: Active » Postponed (maintainer needs more info)
JamesAn’s picture

I'm not sure..

The exception is thrown when I'm just dealing with core modules and in tests that I don't think install anything. I'm not very familiar with how the install process or Simpletest work though.. ^^"

JamesAn’s picture

Status: Postponed (maintainer needs more info) » Active

I'm pretty sure this issue isn't related to #472684: Install non-default modules one at a time to ensure proper module list is maintained during installation hooks.

There's conflict somewhere between the Simpletest and the profile module. If I turn on all modules except the profile module, tests run fine. If I turn on the profile module, tests suddenly no longer work with that "table cannot be found" error.

I'll give this issue some more time today and try to isolate what's going on.

-------------

You can even run all the tests for the profile module while it's disabled. But all testing halts when it's enabled.

JamesAn’s picture

Status: Active » Needs work

It looks like the problem arose from the patch committed in #479966: document and "fix" hook_user_categories, which changed profile_categories() to profile_user_categories(). Now, profile_user_categories() is called during a test run (if the profile module is enabled), which runs a query on the table {profile_field}.

The problem is that simpletest doesn't make a test table copy of {profile_field} like it does for many of the other tables. I don't know where to make the change to have that happen, but that looks like the root of the problem, as far as I can currently tell.

Senpai’s picture

Status: Needs work » Active

I'm waiting on this issue to get fixed so I can finish my #46149: Prevent account cancellation for uid 1 (comment 111) issue. I was planning on marking this issue active again, so thanks for comment #3.

Senpai’s picture

Status: Active » Needs work

Dangit, crossposted, and that's even with two page refreshes before posting! :)

JamesAn’s picture

The exception occurs on line 200 of include/module.inc when it executes:

$modules_installed = array_filter($module_list, '_drupal_install_module');

where

$module_list = array("number", 
  "list", 
  "text", 
  "options", 
  "field_sql_storage", 
  "field", 
  "node", 
  "system", 
  "user", 
  "filter", 
  "block", 
  "color", 
  "comment", 
  "help", 
  "menu", 
  "path", 
  "taxonomy", 
  "dblog", 
  "search", 
  "toolbar", 
)

I haven't been able to figure out exactly why yet.. sticking all sorts of fun debug and exit statements to post stuff.

babbage’s picture

I admit, I may be totally off base here, but does this issue have any relevance?
#347959: modules_installed is broken during testing

JamesAn’s picture

Possibly. #347959: modules_installed is broken during testing seems to be dealing with the same segment of code, namely, the stuff that happens in DrupalWebTestCase->setUp() in modules/simpletest/drupal_web_test_case.php.

I manually traced the bug to a menu_rebuild() call from inside the toolbar_install() as it's called by DrupalWebTestCase->setUp(). Not sure why it's executing code in the profile module, profile_user_categories, when the profile module is not one of the modules that DrupalWebTestCase->setUp() is installing. It looks like the fact that the profile module is enabled in the parent database is somehow carried into DrupalWebTestCase->setUp() when it's not supposed to be.

I'm neither familiar with this testing stuff, nor with the installing-module stuff, but I do what I can.

#0 menu_rebuild() called at [modules/toolbar/toolbar.install:26]
#1 module_invoke($module = 'toolbar', 'install') called at [include/install.inc:538]
#2 _drupal_install_module($module = 'toolbar') called at [include/module.inc:200]
#3 module_enable($module_list, $disable_modules_installed_hook) called at [includes/install.inc:519]
#4 drupal_install_modules($core_modules, TRUE); called at [modules/simpletest/drupal_web_test_case.php:1039]
#5 DrupalWebTestCase->setUp()
JacobSingh’s picture

I have the same problem. Can't run any tests.

mradcliffe’s picture

Confirming bug with latest cvs and postgresql.

aspilicious’s picture

Status: Needs work » Fixed

Can't reproduce this anymore, reopen if necessary...

boombatower’s picture

Yea!

Status: Fixed » Closed (fixed)

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