Closed (fixed)
Project:
IP-based Determination of a Visitor's Country
Version:
6.x-1.x-dev
Component:
Code
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
24 Jun 2009 at 18:23 UTC
Updated:
29 Mar 2011 at 12:41 UTC
Comments
Comment #1
tr commentedModules get installed only for each test case, right? Not for each test. A test case that installs ip2country should contain all tests related to the use of ip2country. How do you run tests if the database isn't populated?
Comment #2
wim leersSimple: by inserting the data that is needed for the test. In my case, a single row is sufficient.
In any case, the choice should be left to the developer.
Comment #3
tr commentedWhat do you think about adding a flag in the Drupal DB (a row in the variable table, for instance) that the ip2country module can use to determine whether to load the data on install or not?
My concern is that most users expect the module to work when it is installed. If the data has to be manually loaded the first time, then I anticipate many support issues from people complaining the module doesn't work. This is by far the biggest use case. SimpleTest writers are going to be a minority, but they are better able to deal with special requirements than the average user. So requiring a variable to be set before installing this module from a test case seems to be only a small inconvenience. Not installing the data at all when the module is enabled poses a much bigger problem to the average user.
Comment #4
wim leersAgreed :)
Comment #5
tr commentedTook me longer than expected to get around to this :-(
Anyway, the change I suggested in #3 is now in the Drupal 6 AND the Drupal 7 branches of ip2country. The database will still be populated when the module is installed normally from the Drupal interface, but if you are using the module from a test case you can set the variable 'ip2country_populate_database_on_install' to FALSE and you'll get a clean database. See the Drupal 7 tests ip2country.test for an example of how to use this feature.
Comment #6
wim leersThanks! :)