I have two Silverstripe websites running in the same WAMP 2.5 environment, sharing the same _ss_environment.php file (which sets database permissions etc.)
Both are:
When I go to localhost.example/dev/tests I get completely different behaviour:
Site #1 runs the tests without any issues and returns the expected output.
Site #2 won't run any test and comes back with this sort of error:
Couldn't run query:
SELECT DISTINCT "Group"."ClassName", "Group"."LastEdited", "Group"."Created", "Group"."Title", "Group"."Description", "Group"."Code", "Group"."Locked", "Group"."Sort", "Group"."HtmlEditorConfig", "Group"."ParentID", "Group"."ID", CASE WHEN "Group"."ClassName" IS NOT NULL THEN "Group"."ClassName" ELSE 'Group' END AS "RecordClassName"
FROM "Group"
WHERE ("Group"."ID" = ?)
LIMIT 1
Table 'ss_tmpdb6760406.group' doesn't exist
What the heck is going on?
The Site #2 does have more modules installed but I can't see how that'd affect MySQL permissions/behavior.
The only difference that makes sense to me is Site #1 was a clean composer install on 3.2.0RC1 when Site #2 has been upgraded from an earlier version of Silverstripe (via composer).
Does anyone have any idea of what is going on and how I can get Site #2 to test properly?
After removing two unmaintained modules from Site #2 the unit testing is working fine.
I'm guessing there were bugs in the modules but I don't understand how they would have caused database errors in unrelated tests.
I'd suggest that you try changing the case-sensitivity setting in MySQL. I've seen similar things before, seemingly randomly occurring, and usually on the main database rather than under test.
I don't have a ton of experience with WAMP, but it sounds like you need to find my.ini ( saving MySQL settings ) and adjust the following setting:
lower_case_table_names=2
Have a look at the docs: http://dev.mysql.com/doc/refman/5.1/en/identifier-case-sensitivity.html And this other question: How to force case sensitive table names?
I can't guarantee that will solve your problem but it's the first place I would check, assuming SQLite is not an option for you as indicated in the comments above.
I had a similar issue. My solution was to completely purge the contents of silverstripe-cache
directory (or whichever directory your particular TEMP_FOLDER
constant points to) and run sake dev/build
.
Not exactly sure why, but I believe there was an error at some point in building a class manifest and that was cached and was somehow preventing the proper rebuilding of the database schema, resulting in most tables being created except for just a few which were then being inserted into by a fixture file (which then triggered this error). Explains why it worked in the CI server, but not on my local machine. Unit tests are supposed to be totally isolated... 🙄
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.