1
votes

I would like to know how to make it so that temp databases are dropped after I run my Sapphire tests via YAML fixtures. Perhaps there is some code that can go in the teardown function that will drop the tmp DB?

FYI, even when all of my test pass, the tmp DB is still left behind. I know that in other phpunit frameworks, errors while running tests can cause the process to abort and thus leave behind tmp databases.

1
I know this doesn't directly answer the question, but if you are running unit tests, you might have a better time using SQLITE in memory. This is noticeably faster to run (for me it was 10 times faster) and it cleans up memory after. I can only find docs for this in SS3: docs.silverstripe.org/en/3/developer_guides/testing/… - PsychoMo

1 Answers

3
votes

Depending on your version of SilverStripe, for version 3.x, you can run yourdomain/dev/build/cleanupdb. For version 4, it's yourdomain/dev/tasks/CleanupTestDatabasesTask