silverstripe / silverstripe-framework

Silverstripe Framework, the MVC framework that powers Silverstripe CMS
https://www.silverstripe.org
BSD 3-Clause "New" or "Revised" License
721 stars 821 forks source link

[DEV] SS4: SapphireTest writes to live DB #7425

Open wernerkrauss opened 7 years ago

wernerkrauss commented 7 years ago

See #7403

Those two tests write to live DB as SapphireTest doesn't have test DB set up. Possible solutions are:

I'm happy to make a PR for the first solution in my WIP PR #7409

tractorcow commented 7 years ago

I also suggest that any sapphiretest helper that touches DB should immediately fail with a RuntimeException if a test DB isn't setup / active. We could fix it in this case, but we probably need a safe "lock" on the live db for future potential violators.

Perhaps if a test has requires_database = false, then sapphiretest should explicitly disconnect the DB?